首页  软件  游戏  图书  电影  电视剧

请输入您要查询的软件:

 

软件 PDFizer 可以将html转换成pdf格式文档的工具 
内容 First, set a reference in your project to the 3 DLL's that Pdfizer uses. Here are the 3 dll names to set a reference to:

ICSharpCode.SharpZipLib.dll (This component is used to parse the HTML)

itextsharp.dll (This component is used by Pdfizer to create the PDF document)

Pdfizer.dll (This is the main component with the HtmlToPdf object that executes the conversion operations).

Now we can add some code to use this component. Here is the code to generate a PDF from some HTML specified:

// set a path to where you want to write the PDF to.string sPathToWritePdfTo = @"C:\new_pdf_name.pdf"; // build some HTML text to write as a PDF. You could also // read this HTML from a file or other means.// NOTE: This component doesn't understand CSS or other // newer style HTML so you will need to use depricated // HTML formatting such as the <font> tag to make it look correct.System.Text.StringBuilder sbHtml = new System.Text.StringBuilder();sbHtml.Append("<html>");sbHtml.Append("<body>");sbHtml.Append("<font size='14'>My Document Title Line</font>");sbHtml.Append("<br />");sbHtml.Append("This is my document text");sbHtml.Append("</body>");sbHtml.Append("</html>"); // create file stream to PDF file to write tousing (System.IO.Stream stream = new System.IO.FileStream

(sPathToWritePdfTo, System.IO.FileMode.OpenOrCreate)){ // create new instance of Pdfizer Pdfizer.HtmlToPdfConverter htmlToPdf = new Pdfizer.HtmlToPdfConverter(); // open stream to write Pdf to to htmlToPdf.Open(stream); // write the HTML to the component htmlToPdf.Run(sbHtml.ToString()); // close the write operation and complete the PDF file htmlToPdf.Close();}This component also supports PDF Chapters. You could add a single line of code right before the Run() method to make the HTML specified a single chapter like this:

// open stream to write Pdf to tohtmlToPdf.Open(stream); // add a chapter for this HTMLhtmlToPdf.AddChapter("My Chapter Title 1"); // write the HTML to the componenthtmlToPdf.Run(sbHtml.ToString());Repeat the AddChapter() and Run() methods for each chapter you want to add and then Close() to commit it to the PDF.

标签 PDFizer
缩略图
软件名称 PDFizer 可以将html转换成pdf格式文档的工具
软件图标
软件大小 420KB
发布时间
软件平台
软件语言 英文软件
软件授权 免费软件
操作系统 windows平台
系统类型
用户评分 3
软件版本
官方网站
官方网址
软件截图
软件总类 电脑游戏
软件大类 软件下载-应用软件-浏览阅读
软件小类 浏览阅读
开发者
主办单位名称
ICP备案名
备案号
使用年龄
下载链接
攻略教程
详细介绍
操控设备
隐私政策
查看权限
敏感权限获取说明
软件类型 国外软件
安全警示 适度休息有益身心健康,请勿长期沉迷于使用电脑或刷手机。
随便看

 

传承兰台文化,共同保存历史记忆!兰台网收藏软件、游戏、图片、图书、电影、电视剧等互联网档案,是免费和可借阅文本、电影、音乐等档案的数字图书馆。

 

Copyright © 2004-2025 xlantai.com All Rights Reserved
更新时间:2025/5/7 8:56:31