Hi,
I found that it was best to obtain this 2.12 package and extract the dll(s) as needed (7zip opens it ok)...
https://www.nuget.org/packages/PdfiumViewer/2.12.0Its under Apache 2.0
https://www.apache.org/licenses/LICENSE-2.0The unit PdfiumLib, within the project says to use...
https://github.com/pvginkel/PdfiumViewer/tree/master/Libraries/Pdfium But there is a message there...
The native PDFium libraries have been removed from this repository. Please see the README or the PdfiumBuild for more information.
The ReadMe referenced is...
https://github.com/pvginkel/PdfiumViewer/blob/master/README.markdownAlso in the PdfiumLibExmaple project that the original .rar contains (lead post below), have a look in the code for MainFrm:-
procedure TfrmMain.FormCreate(Sender: TObject);
begin
{$IFDEF CPUX64}
PDFiumDllDir := ExtractFilePath(ParamStr(0)) + 'x64';
{$ELSE}
PDFiumDllDir := ExtractFilePath(ParamStr(0)) + 'x86';
{$ENDIF CPUX64}
.. and you'll note that its out of the box expecting you to place the 64bit or 32Bit dlls as shown in a directory under your project, in appropriate directories (x64 or x86) - or as you choose, just adjust the code there.
(PDFiumDllDir is defined in PdfiumCore.pas and is initially set to look in the project's main path.
var
PDFiumDllDir: PDFString = '';
)
One way or the other, get these settings as you want them, then everything works just fine.
Also note that if you also need HTML rendering, the much bigger Chromium project, directly incorporates pdfium, and so can also show pdfs in the browser component window.
See
http://wiki.freepascal.org/fpCEF3 ... If your using local pdf files you need to use full file paths as in fpCEF3_Browser.Load('file://'+ fileName)
The pdfium control requires ...
TPdfControl.LoadFromFile(fileName)
Also in MainFrm frmMain.FormCreate
You may want to change:
FCtrl.PageColor := RGB(255, 255, 200);
to
FCtrl.PageColor := RGB(255, 255, 255);
if you don't want an initial yellow background.
Paul