Export from WPTools

If you are using WPTools you are only one line code away from full-featured PDF files.

To export simply use the TWPDExport component.

Assign the property Source and execute 'Print'.

If you need to print additional data on each page, such as watermarks, use the OnBeginPrintPage
event and draw to the wPDF "Canvas". Of course you can use BeginDoc to export several
documents to the same PDf file and combine that data with data exported from the reporting
engine.


Window-less RTF to PDF conversion

// This sample code creates a TWPRichText and a TWPDFExport 
// on the fly and uses both to create a PDF file:

uses WPDefs, WPPrint, WpWinCtr, WPRich, WPPDFR1, WPPDFWP

procedure RTF2PDF( RTFname, PDFname : string);
var
  WPRichText: TWPRichText;
  WPPDFExport: TWPPDFExport;
begin
  WPRichText:= TWPRichText.CreateParented(Application.Handle);;
  WPPDFExport:= TWPPDFExport.Create(nil);
  WPPDFExport.Source := WPRichText;
  try
    WPRichText.LoadFromFile( RTFname );
    WPPDFExport.FileName := PDFname;
    WPPDFExport.Print; 
  finally
  WPRichText.Free;
  WPPDFExport.Free;
  end;
end;

back