|
Window-less RTF to PDF conversion |
Top Previous Next |
|
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 // WPTools 4 WPRichText:= TWPRichText.CreateParented(Application.Handle); // WPTools 5: // WPRichText:= TWPRichText.CreateDynamic; WPPDFExport:= TWPPDFExport.Create(nil); WPPDFExport.Source := WPRichText; try WPRichText.LoadFromFile( RTFname ); WPPDFExport.FileName := PDFname; WPPDFExport.Print; finally WPRichText.Free; WPPDFExport.Free; end; end;
|