Create PDF using Delphi 5 + Canvas + WPRichText (WpTools3) + ImageXpress (pegasus)

  • Hi,

    I've a software that i need generate a PDF File.

    Today I m using, Printer.Canvas, but for build a PDF I'm need a virtual Printer PDF. Then I need to create this file without this virtual Printer.

    I need to make a PDF mixing TIFF files, WpRichText, Barcode QRCode and Canvas for customize some things in pages.

    Also I installed WPDF and i tried to use this component.

    With the Printer.Canvas its worked but with WPPDFPrinter I can't.

    All pages stayed white.


  • I got it changing

    Xpress.PrinterhDC: = WPPDFPrinter1.ReferenceDC;

    to

    Xpress.PrinterhDC: = WPPDFPrinter1.Canvas.Handle;

    Now i need to include a new page from WPRichText of WPTools3. And when I use WpRichText.DrawTo (WPPDFPrinter1.Canvas, x, y, 00). not work.

    Have it a problem between the versions?

    I m testing the WPDF before to do buy and I wiil need of WPViewerPdf as well ... but first, I need to know if will work.

    Tks

    • Offizieller Beitrag

    In general: If you use wPDF.BeginDoc and EndDoc you can mix WPTools and Canvas output in the same PDF files. This means if yo use WPDFExport you can use the Export method and BeginPage(EndPage in any order.

    WpRichText.DrawTo (WPPDFPrinter1.Canvas ...) should work just fine, I assume the problem is the resolution. Did you try on any empty page, before prior output and ViewPort Change?

    What you can also do is: Create a metafile + metafile canvas, let WPTools (or any other tool) print on it, and send it to wPDF.

    Good that you found ReferenceDC - I did not notice it in your source. ReferenceDC is the device handle which is used to create the internal metafile, which is used by wPDF to capture the drawing comand.