In C #. net, how does one generate a PDF file? There are mainly the following ways:
1. Use. Net file stream technology;
If a PDF file is generated using the. NET file stream technology, the syntax of the PDF file must be clear. For example, BT indicates that the object content starts, et indicates that the object content ends, and TD indicates that the line feed. We can download the PDF syntax instructions from Adobe's official website, but the documents have almost 1000 pages. If you are familiar with the syntax before programming, it will take a long time, and the generated PDF document may not meet the requirements. For C # code, see the attachment.
For the syntax of PDF files, see:
Http://partners.adobe.com/public/developer/en/pdf/PDFReference.pdf
2. Use third-party controls
I. Open-source controls
(1) ASP. NET fo PDF at sourceforge.net-generates XSL-FO from datatable to render PDF
② Itextsharp at sourceforge.net
1. Examples and Tutorial: http://itextsharp.sourceforge.net/
2. Also see this article: Create PDF on the fly with. NET and itextsharp by Valerio fornito, dopostback.com
③ Invalid Creator at gotdotnet-design PDF document visually using Visual Studio ide
④ Report. Net at sourceforge.net
Ii. Commercial controls
① Abcpdf. Net by websupergoo-free license also available
② Apoc XSL-FO by chive software-generates PDF using XSL-FO
③ Aspose. pdf by aspose
④ Dynamicpdf by cete Software
⑤ Listen 4net by O2 Solutions
⑥ Pdflib by pdflib GmbH
7. tallpdf. Net by tallcomponents-able to create PDF documents either programmatically using an object model or from XML.
Tutorial: Create and manipulate PDF documents ents-100%. Net by Frank REM (codeproject.com)
Export xmlpdf by visual programming-converts XML to PDF
Considering the cost, using open-source controls is a good choice. In my project, the itextsharp component is used, and the generated PDF file can meet the project requirements. The DLL, source code, and encoding instances related to itextsharp can all be found at http://itextsharp.sourceforge.net.
3. Use Acrobat Distiller
You can directly call the Acrobat Distiller object in the C # or script file (. js or. vbs) to generate a PDF file. However, for copyright consideration, you need to purchase Adobe Acrobat professional.
The code can be found:
Http://dev.yesky.com/msdn/123/2101623.shtml