Can I programatically measure a PDF page using WPViewPDF ?

  • Greetings!

    We use wpdf to create PDF files from TIF images. Works fine.
    We are creating an automated test application to validate that our code always creates correct PDF files. For this, we need a tool that can open a PDF and tell us the PDF page size.

    Can WPViewPDF do this?

    Please advise!

    Thank you!

    • Offizieller Beitrag

    Hi,

    there are certain commands for this, all can be used by
    WPViewPDF.Command( id ) or WPViewPDF.CommandEx( id, IntPar )
    The result value is an integer.

    The command ids are:

    COMPDF_GetPageCount = 201; // get count of loaded pages
    COMPDF_GetViewPage = 202; // get current page
    COMPDF_GetPageWidth = 203; // IntPar = pageno
    COMPDF_GetPageHeight = 204; // IntPar = pageno
    COMPDF_GetPageRotation = 205; // IntPar = pageno
    COMPDF_GetYPos = 210; // Get Scroll Y Pos in 72 dpi
    COMPDF_GetXPos = 211; // Get Scroll x Pos in 72 dpi
    COMPDF_GetWidth = 212; // Get Window width in 72 dpi
    COMPDF_GetHeight = 213; // Get Window height in 72 dpi
    COMPDF_GetPageUnderMouse = 214; // Page under current Mouse position (for popup menues!)

    Using
    WPViewPDF.CommandEx( COMPDF_GetPageWidth , pageno )
    WPViewPDF.CommandEx( COMPDF_GetPageHeight , pageno )
    It is possible to read the page width and height. The result value is measured in the native PDF resolution, 72 dpi.

    BTW.: I was able to improve the image support a bit more. Images with certain color spaces now also show up.

    Kind Regards,

    Julian Ziersch