{oapdf_gg}
Office software is closely linked to the PDF,the PDF is also must have to control!      Set home Page  Add to Favorites  
You are here:Home > PDF Application > PDF Development
PDF Development
Using C# language the whole PDF document Strategy Guide Graphic
Finishing by: Date:2009-04-17 20:59:48 Popularity: Tags:

the second Create Writer examples

Once you create a document, we can create the document a number of examples Writer, all of which were inherited from the Writer example of abstract class "iTextSharp.text.DocWriter".

At the same time, there is another situation, you can have iTextSharp.text.pdf.PdfWriter document PDF document, if you want to create a TeX document, you can use iTextSharp.text.TeX.TeXWriter package.

Writer class constructor is private, you can only be resolved through the following methods to create an example:

public static xxxWriter getInstance (Document document, Stream os); (xxx is a Pdf or Xml)

your way through the following examples to create a:

PdfWriter writer = PdfWriter.getInstance (document, new FileStream ( "Chap01xx.pdf "));

but you almost never use Writer instance (unless you want to create a PDF, or wish to use advanced some very special function, such as ViewerPreferences or Encryption ). Therefore, the approach adopted by the following examples have been enough:PdfWriter.getInstance (document, new FileStream ( "Chap01xx.pdf "));

in the first step in creating a document, not the meaning of the first parameter, the second parameter can be any kind of flow, so far we have been using System.IO.FileStream will be written into the document Document, sample code 0105 used the System.IO.MemoryStream (This is not an independent example, you have to test the Servlet Engine in the code.

third step Open Document

u Abstract

write you before any actual data, you may wish to adopt some of the following methods to write a summary of the document:

public boolean addTitle (String title)

public boolean addSubject (String subject)

public boolean addKeywords (String keywords)

public boolean addAuthor (String author)

public boolean addCreator (String creator)

public boolean addProducer ()

public boolean addCreationDate ()

public boolean addHeader (String name, String content)

you can choose their own title, subject, keyword, author, creation of procedures, but the following product information will always be added:iTextSharp (or iTextSharp reference) and the creation of time (in fact the two methods is automatically invoked ).

you can also add a custom name for the "header information", but that there is no role for PdfWriter, 0101 If you look at the example of code generated pdf document, "Document Properties", we can see that only the creation of PDF procedures and products that date, and sample code of the 0106 "Document Properties" box for more information.

there isArticle InformationsComment Information
Category column

Site Help | Site Map | Feedback |
OAPDF.COM Copyright 2009 V1.1