我正在使用 HTML 做一些工作,我想打印(在纸上)这些 HTML 文件,实际上,该文件不存在,所有内容都保存在一个字符串中,所有文本都保存在 HTML 中,但我想打印,已经格式化...
例如:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string HTML =
"<html>" +
"<head>" +
" <style type=\"text/css\">" +
" .title {" +
" color: blue;" +
" text-decoration: bold;" +
" text-size: 1em;" +
" }" +
" .author {" +
" color: gray;" +
" }" +
" </style>" +
"</head>" +
"<body>" +
" <p>" +
" <span class=\"title\">{0}</span>" +
" <span class=\"author\">{1}</span>" +
" </p>" +
"</body>" +
"</html>";
// Just a sample of what I whant to do...
// PseudoCode
//Render the HTML code
RenderHTML aa = new RenderHTML(string.Format(HTML, "Alexandre", "Bencz"));
aa.PrintDocumentInPaper();
}
}
}
我发现:http: //msdn.microsoft.com/en-us/library/w290k23d.aspx
但是,我想知道是否有另一种方法可以做到这一点,更好的方法..?