Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 用C语言将网页打印为PDF#_C#_Pdf_Visual Studio 2012_Printing_Webpage - Fatal编程技术网

C# 用C语言将网页打印为PDF#

C# 用C语言将网页打印为PDF#,c#,pdf,visual-studio-2012,printing,webpage,C#,Pdf,Visual Studio 2012,Printing,Webpage,对于一个学校项目,我必须用C#将网页打印成PDF格式。 我可以通过在chrome en中按ctrl+p并选择另存为pdf来手动执行此操作。 我想用我的程序来做,因为我必须打印30000个网页。 我必须打印的网页示例为“” 我是新来的,所以如果我没有提供足够的信息,请询问 代码对我来说也很特别,它是: <!DOCTYPE html> <html> <body> <div id="light_wrapp"> <div id="light_titl

对于一个学校项目,我必须用C#将网页打印成PDF格式。 我可以通过在chrome en中按ctrl+p并选择另存为pdf来手动执行此操作。 我想用我的程序来做,因为我必须打印30000个网页。 我必须打印的网页示例为“” 我是新来的,所以如果我没有提供足够的信息,请询问

代码对我来说也很特别,它是:

<!DOCTYPE html>
<html>
<body>
<div id="light_wrapp">
<div id="light_title_description">
This is a demo of a seamless insert of an Icecat LIVE product data-sheet in your website. Imagine that this
responsive data-sheet is included in the product page of your webshop. <a
href="https://icecat.biz/get_attachment.cgi?6752" target="_blank">How to integrate Icecat LIVE JavaScript.</a>
</div>
</div>
<div id="loadLiveIcecat"></div>
<input type="hidden" id="liveIcecatData"
data-icecat_id=""
data-brand="HP"
data-part_code="D8G49AAE"
data-ean_upc=""
data-language_code="nl"
datasignature="
gn4vxXU3uI7JPKzL1RNoPAFGPRYdNmwmWJ5FeQj1J45Ba2qiaVYgoE%2FEXwpjaBSdKTrk%2F
%2ByI0AiT5CW1bk3r6SmHY%2FdUuQN3fss8h0se8w9mSw7FDr8SWvqoawB3m69lt6Ske4n%2F01IpEFO9Y
QEVpW9kFZRPWH%2Fuy0yuIbDdm4pd7%2BT9XbPFEk0fKGRH57Nkj5%2FvNEiMW1JhdzV86rJR5ME11j3P
0PJhBMGT1tm2AA0uiDILSNuOwnTWc2WVFEHzC4xr8Q591rPC%2B%2Bue230VowhLLmZTczheEGWrTCA
Wl%2B5Fj4qeLjLe3qTq1MxQaqSIUJXG5rz0BdR%2Fe8ZwkMNAgQ%3D%3D"
data-timestamp="1453663924"
data-shopname="openIcecat-url"
>
</body>
</html>
<link rel="stylesheet" type="text/css" href="/themes/basic/css/icecat/demo.css" >
<script type="text/javascript" src="https://live.icecat.biz/js/live-current.js"></script>
<script type="text/javascript" src="http://prf.icecat.biz/themes/basic/js/icecat/live/init.js"></script>

这是在您的网站上无缝插入Icecat LIVE产品数据表的演示。想象一下
响应性数据表包含在您的网店的产品页面中。

您可以尝试使用第三方库ABCpdf

它使webpag2Pdf变得简单

Doc theDoc = new Doc();
theDoc.AddImageUrl("http://www.google.com/");
theDoc.Save(Server.MapPath("htmlimport.pdf"));
theDoc.Clear();

您可以尝试使用itextsharp,这是一个开放库,允许您将HTML内容转换为PDF。我尝试过,但我得到的HTML代码是PDF中的文本。HTML代码对我来说也很特殊。如果您尝试过,但不起作用,请向我们展示您拥有的内容。