Melbourne ADUG Meeting Monday 17th July 2023 - PDF file creation and Display in Delphi with Grahame Grieve

Topic: Melbourne ADUG Meeting - PDF file creation and Display in Delphi with Grahame Grieve
Time: Jul 17, 2023 06:00 PM Canberra, Melbourne, Sydney

Join Zoom Meeting

Meeting ID: 871 5499 8353
Passcode: 663434

One tap mobile
+61731853730,87154998353#,*663434# Australia
+61861193900,87154998353#,*663434# Australia

Dial by your location
• +61 7 3185 3730 Australia
• +61 8 6119 3900 Australia
• +61 8 7150 1149 Australia
• +61 2 8015 6011 Australia
• +61 3 7018 2005 Australia
• +1 253 205 0468 US
• +1 253 215 8782 US (Tacoma)
• +1 301 715 8592 US (Washington DC)
• +1 305 224 1968 US
• +1 309 205 3325 US
• +1 312 626 6799 US (Chicago)
• +1 346 248 7799 US (Houston)
• +1 360 209 5623 US
• +1 386 347 5053 US
• +1 507 473 4847 US
• +1 564 217 2000 US
• +1 646 558 8656 US (New York)
• +1 646 931 3860 US
• +1 669 444 9171 US
• +1 669 900 9128 US (San Jose)
• +1 689 278 1000 US
• +1 719 359 4580 US

Meeting ID: 871 5499 8353
Passcode: 663434

Find your local number: Zoom International Dial-in Numbers - Zoom

An outline of Monday’s Meeting

On Monday Evening Grahame gave a presentation on PDF Creation and Scraping.

As is common with Grahame’s presentations, it was an interesting, and wide ranging presentation.

The current PDF specification is
ISO32000-2:2020, it is available for no charge
1003 Pages PDF file.

You do have to go through a payment process giving your details, prices
is 0.00, the pdf is watermarked for you.

This and prior versions are available via the following url.

For Commercial, Non Open Source products, Grahame Recommended Gnostice
Document Studio Delphi. It has very capable and solid pdf handling

Gnostice also have PDFToolkit vcl, which has additional/other functionality.

For his projects (open source), he uses the open source library pdfium
from Google Chrome (pdfium.dll) along with a delphi wrapper pdfiumlib.

PDFIUM (Scroll down) (Lazarus)

PdfiumLib Comes with example app.

There is no IDE Visual component
(At least partly because it then makes the IDE dependant on pdfium.dll)

It does have a component, you can create and configure with code.

Grahame talked about how important forms, forms he cares a lot about, he
mostly builds in code already. (so he can control exactly how they will

He showed a demo of extracting all the text from a document.
And also gave a run through of the Pdfiumlib demo.

There was then a bit of a discussion about accessibility requirements.

Search WCAG
(Web Content Accessibility Guidelines)

It is VERY wide ranging.

You can specify the parts that you will meet (based on your user

eg. You may elect not to specify you will make your document
comprehensible for a 6 year old in a highly technical field.

Tab traps are a particular issue, for visually impaired users.

Must ensure Tabs for moving from item to item in your forms don’t wind
up trapped somewhere (eg. tab into a Memo), or dont get trapped in a
limited number of fields.

Thanks Grahame

1 Like

Was the meeting recorded? I wasn’t able to make the meething but this sounds like something I am intersted in.

1 Like

Hi @vincent,
Here is the recording. It is currently still encoding for HD, so it is probably best to wait an hour or 2 from now.

1 Like

Thanks, will wait for HD.

I’m currently using a very old version of gnostice, but looking for something that can manipulate pdfs (merge pdfs, insert text, fill in form fields, convert to other formats) without referencing the vcl. My needs are driven by needing to run in a docker container - which doesn’t have the full windows api available.

Gnostice is fully intertwined with the vcl so that’s not usable in my case. The PDFium looked interesting, but just looking at the uses clause I see Graphics (seems to be for TBitmap) so that’s not going to fly either. I may just have to drop the feature altogether - along with image manipulation/conversion (where I am also still looking for a solution).

Winsoft (who was a ADUG symposium prize donor :+1:) supposedly has a version of pdfium that supports linux.


Already discounted them - not a fan of commercial libraries that are basically a very thin wrapper over an open source library :man_shrugging:

I have a fork of the wrapper library that works with osx and Linux - that might help?


Not sure. The issue is it references units line Graphics - for TBitmap - which is VCL or FMX. On windows TBitmap uses features (WIC api’s) that are not available in windows docker containers.

Hmm tricky. I haven’t changed that - just done linux/osx ports… I guess the point is that you aren’t going to run under linux.

That was a very interesting video. Thanks Grahame.

Is your Delphi code available for me to play with?

Well, the only code I used was the PDFium example in the code linked from the slides. Which are attached. Also, I added a button with an onClick that goes like this:

function getTextFromPage(page : TPdfPage) : String;
result := page.ReadText(0, page.GetCharCount);

procedure TfrmMain.Button1Click(Sender: TObject);
ts : TStringList;
i : integer;
ts := TStringList.Create;
for i := 0 to FCtrl.Document.PageCount - 1 do


(Attachment 2023-07-adug pdf.pptx is missing)


Thanks for the session and also the synopsis - I am going to post it on the ukDevGroup newsgroup if that is OK (actually asking forgiveness rather than permission as I posted it and realised I hadn’t posted here).

I still use Envision image library in my D7 project and he added a very simple PDFPreview in his code: Interval Software - Envision

1 Like

Thanks Grahame. Looks like I misunderstood. I thought the code you used in Free Pascal was different to the code you used in Delphi.

It was, but the code free pascal code is in the repo. Since I can’t post the slides, the one with the links had: - source code for dll - Delphi wrapper - pdfium binary downloads (Lazarus) - my port of the Delphi wrapper to linux and osx



One thing I forgot. (Though likely in the Recording)

Geoff mentioned and gave a link for running delphi in a docker container in wine

GitHub - lmbelo/delphi4docker: Step-by-step guide to create your own Docker image to compile Delphi projects

1 Like