<< Click to Display Table of Contents >> Navigation: Programming > Printing and PDF Export > Add PDF Export > Export to PDF |
This is the most compact code to export the RTF or HTML text from a WPTools Editor to PDF:
uses ..., WPPDFWP, WPRTEDefs, WPCTRMemo, WPCTRRich;
procedure TForm1.ExportFromWPTools(Sender: TObject);
var pdf : TWPPDFExport;
begin
pdf := TWPPDFExport.Create(nil);
pdf.Source := WPRichText1;
try
pdf.FileName := 'c:\exported_rtf';
pdf.Print;
finally
pdf.Free;
end;
end;
The TWPPDFExport component can be alternatively dropped on the form and the properties can be set in the IDE. Then only one line of code is required: WPPDfExport1.Print.