IWPPdfCreator PDFCreator

[Top]  [Chapter]  [Previous]  [Next]

This property provides a reference to the PDFCreator interface. This interface can be used to initialize and start the PDF creation. The reference will ne null in case your license (or the DLL) does not contain PDF creation.

 

This code will export the text in Editor #1 to PDF. PrintSecond() will export from editor 2.

 

IWPPdfCreator PDFCreator = WPDLLInt1.PDFCreator;

if (PDFCreator!=null)

{

  PDFCreator.PDFFile = "c:\\pdffile.pdf";

  PDFCreator.Print();

} else MessageBox.Show("PDF Creation not available");

 

If you need to create multiple pages through mail merge use code such as this C# example.

 

IWPPdfCreator PDFCreator = WPDLLInt1.PDFCreator;

if (PDFCreator!=null)

{

 WPDLLInt1.PDFCreator.PDFFile = "c:\\testa.pdf";

 WPDLLInt1.PDFCreator.BeginDoc();

 GotoFirstDataRow();

 while (! AtEndOfData() )

 {

         WPDLLInt1.Memo.MergeText("");

         WPDLLInt1.Memo.ReformatAll(false,false);

         WPDLLInt1.PDFCreator.Print();

         GotoNextDataRow();

 }

 WPDLLInt1.PDFCreator.EndDoc();

} else MessageBox.Show("PDF Creation not available");

 

The call to ReformatAll is required to reformat the text inside this loop. Usally the text is not formatted until the Application is idle. If you export right after a file was loaded, ReformatAll also must be used. The functions printed in green are placeholders.


[iwppdfcreatorpdfcreator.htm]    Copyright © 2007 by WPCubed GmbH