Asp. net2.0 perfect solution for exporting PDF files [reprinted]

Source: Internet
Author: User

PDF Introduction: PDF (Portable Document Format) is an electronic file Format developed by Adobe. This file format has nothing to do with the operating system platform. That is to say, PDF files are common in Windows, Unix, and Apple's Mac OS Operating Systems. This feature makes it an ideal document format for electronic document distribution and digital information dissemination on the Internet. More and more e-books, product descriptions, company announcements, online materials, and emails are beginning to use PDF files. PDF files have become an industrial standard for digital information.

:

OfFinal(In fact, both winform and console programs can be done in the same way ).

Text,Image,Data TableExport

 

Sample fileProvidedVarious solutionsDue to time issues, I hope you can study other requirements on your own.

Itextsharp-4.0.3-dll.zip

ICSharpCode. SharpZipLib. dll http://download.csdn.net/down/135897 ICSharpCode. SharpZipLib. dll

The content in the. dll class library implements the compression and decompression functions. It isOpen SourceOf

2. Reference

3. Background code:

 

DataRow dr;
Datatable. Columns. Add (dr [dr [datatable. Rows. Add (dr );
}}

}

Document document using writer. getInstance (document, document. Open ();
BaseFont bfChinese Font fontChinese
Document. Add (
ITextSharp. text. Image jpeg document. Add (jpeg );
PdfPTable table
Table. addCell (} document. Add (table );

Document. Close ();
} Response. Write (de. ToString ());
}}}

 

4. Front-end code:



5. Foreground operations:

6. attribute description:

Itextsharp-4.0.3-dll.zipThe sample file contains almost all PDF Processing Requirements

Color:Font fontChinese

Note: U text comment:
You can add a short text section to your document, but it is not part of the document content. The comment includes the title and content:
Annotation a = new Annotation (
"Authors ",
"Maybe it's because I wanted to be an author myself that I wrote iText .");

Alignment:Cell. HorizontalAlignment = Element. ALIGN_CENTER;
Cell. VerticalAlignment = Element. ALIGN_MIDDLE;

Underline/strikethrough:Chunk chunk1 = new Chunk ("This text is underlined", FontFactory. getFont (FontFactory. HELVETICA, 12, Font. UNDERLINE ));
Chunk chunk2 = new Chunk ("This font is of type ITALIC | STRIKETHRU", FontFactory. getFont (FontFactory. HELVETICA, 12, Font. ITALIC | Font. STRIKETHRU ));

Encryption:Public void setEncryption (boolean strength, String userPassword, String ownerPassword, int permissions );

 

 

 

Phrase text1 = new Phrase (text, font); PdfPCell cell = new PdfPCell (text1); cell. verticalAlignment = VA; cell. horizontalAlignment = HA; cell. padding = 0.5F; // cell. fixedHeight = height; cell. minimumHeight = height;

 

 

 

ITextSharp. text. image img1 = iTextSharp. text. image. getInstance (img, iTextSharp. text. baseColor. WHITE); if (img. width> cell. width | img. height> cell. height) {img1.ScaleToFit (cell. width, cell. height);} cell. fixedHeight = cell. minimumHeight; cell. image = img1;

 

 

 

Due to time issues: For more information, such as watermark cell spacing and border in the header and footer attributes directory, Please study the document yourself.

.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.