John, this is the diff between the Sep 2020 version I have and the code you posted :
Hi John, just FYI… the line:
BmpBits := nil;
…was already included in my version of Pdfiumcore.pas.
Different versions?
Cheers,
Kim.
Yes, looks like I have an old version.
The version I have came via https://github.com/grahamegrieve/PdfiumLib from Paul’s earlier post. Could someone please give me the link to the more recent version?
Many thanks, really appreciate the help.
HI John, I dowloaded the ZIP file using the ‘Code’ button from the page you mentioned:
Cheers,
Kim.
Hi John.
Github is the lastest version. My version on disk comes from ~14 months ago.
I was going to say you must have the latest version, because they seem to have refactored away from the very Windows-y parameters … except …
On checking both Andreas’ and Grahame’s repos, they both have the HDC and etc parameters.
So I’m not sure where the code you currently have came from … ?
It’s okay.
https://github.com/ahausladen/PdfiumLib gives me a version dated October and seems to work well without modification.
Ok, mystery solved. @GrahameDGrieve’s repo has been (at least partially) adapted to also work in fpc.
I didn’t see that there was an overload of the TPdfPage.Draw procedure further down.
I don’t know why you were hitting that one instead of the original that is still there … but cool, glad Andreas’ original repo is working for you.
https://github.com/ahausladen/PdfiumLib/ I am having errors with this version. The older version worked more stable.
What errors are you seeing?
It appears the version on Github is still the same as the one I downloaded and it has been working very well for me.
@John_Van_De_Giessen
I realise that 6 months has now past, but nevertheless I’ve just done a major update of my PdfPageCount unit and uploaded it to GitHub here.
I’ve done quite a bit of testing and the only PDF files that won’t return a page number are those with any access restrictions (ie have encryption).
Thanks for letting me know Angus. I’ll check it out.