11 thoughts on “PDFium Delphi VCL example control

  1. Peter

    Hi Andy, I like PDF documents! 😉

    I can’t load the DLLs (both 32 & 64). Are they correct? SafeLoadLibrary fails. ???

  2. Neville

    Hi Andy,
    I’m having the same problem.

    I downloaded the DLL’s directly from your link.
    If it helps, the error message from LoadLibrary (within SafeLoadLibrary) is titled “PDFium Test: PdfiumLibExample.exe – Bad Image” and says the DLL (I’m using the x86 version) “is either not designed to run on Windows or it contains an error”.

    Any thoughts?

  3. Andreas Hausladen Post author

    How did you download the DLLs? With “git clone” or by right clicking the “pdfium.dll” link and “save link as” what downloads a GitHub web page but not the file.

    1. Neville

      Thanks Andy.
      You were right. I used “Save link as” from GitHub, and despite looking like it had downloaded the DLL file, it was in fact just an HTML page in a file with extension .dll.

      Downloading the whole project (I used the “Download Zip” button at the project root) and extracting the DLL files works fine.

      1. Peter

        Ok, I had the same problem with git. Now it is working well.

  4. Jean-Marc

    Hi Andy,
    i tested it out with a pdf plan (880x625mm, 8.23 MB). It is very, very slow. To loading and rendering this plan it tokes minutes (Compiled in XE6, Win64). Resizing the windows tokes minutes and the whole pc freezes. Also that sheems to be a problem with the colors. The background is rendered in yellow.
    Loading the same plan in adobe reader takes 5 sec. and the background is white how it should be.
    My question is: Come this problems (Perfomance, Wrong Colors) from the pdfium.dll or is this a problem from the wrapper?

    1. Andreas Hausladen Post author

      You can pause the application to find out if it is the wrapper or the DLL.
      Can it be that the PDF file consists of a scanned paper (one bitmap inside the PDF). AcrobatReader uses a trick to resize the page faster. It scales the already rendered page and then after some milliseconds it renders the page in the new size.

      The page color is changed in the example code with “FCtrl.PageColor := RGB(255, 255, 200);”. Remove that line and you have a white background.

      BTW: The code is only an “Example of a PDF VCL Control”.

  5. Peter

    Another question: Can the wrapper/PDFium write PDF files (write on canvas, write out as PDF file)? I haven’t seen code for that so far.

    1. Andreas Hausladen Post author

      It can’t. PDFium has some functions to modify a PDF but they are very limited and I think only to fill a PDF form.

Comments are closed.