PDF Viewer Window

I’ve had a look at previous discussions about PDF viewer components, but they are quite old posts (2005 - 2012) and likely things have changed since then.

I want view PDF files in a window with the minimum of extra visual clutter. Just the page contents and optionally the thumbnails.

My first try was the TAdvPDFViewer from TMS. It’s based on the Windows API. Overall it works ok, but there are some limitations. Scaling doesn’t work well and there’s no option for rotation.

I also tried using the Acrobat Reader ActiveX control, but it seems impossible to remove the right side pane with all of the extra stuff the user doesn’t need.

This is for a freeware project so zero to low cost is what I can afford. Suggestions?

I use PDFium. It’s free and powerful.

2 Likes

I’ll check it out. Thanks.

Here is a ADUG presentation that @GrahameDGrieve did for ADUG last year, that may have some useful information for you.

3 Likes

And there was subsequent discussion here … Melbourne ADUG Meeting Monday 17th July 2023 - PDF file creation and Display in Delphi with Grahame Grieve

1 Like

I’m getting errors about functions not available as soon as the component is created.

Is there anything I need to do to make the PDFium units work for Delphi?

I see these ate the top of each unit:

{$IFDEF FPC}
  {$MODE Delphi}
{$ENDIF}

You have the/a dll for it ?

Do you have pdfium.dll in place?

OK, I got it going. Looks like the version of the PDFium wrapper I downloaded is out of date or different in some way. As soon as I used the ones from here it just worked.

1 Like

I have almost everything working now. Just need to implement dropping a file onto the reader (should be easy enough) and working out how to show the thumbnails. This last one doesn’t seem to be implemented natively so I might have to skip it for now. I don’t know if any users will even want to show them.

1 Like

Has anyone here implemented dropping of files onto the PDFium control ? It shows the “not accept” (circle with diagonal line) whenever files are dragged over it. Is it even capable of accepting file drops or would I need to add that functionality?

Never mind. As often happens when asking a question here, something clicks and you come up with the solution shortly after posting! I now have my app responding to the WM_DROPFILES message and accepting files.

2 Likes

A couple of more questions for those PDFium users please.

Is there a way to do a 2 page layout / view? If not I can always just use 2 of the controls side by side with the same file.

Has anyone used TPdfLinkGotoDestination ? I looks like it is used as a bookmark, but not sure how you generate them.

Something else I haven’t managed to find is how to do continuous scrolling mode (where you can see the end of one page and the start of the next).

It seems to be part of the PDFium DLL capabilities, but maybe not in the Delphi control wrapper?