Enumeration
#PDFlib
EndEnumeration
Prototype InitLibrary(licencekey.s,path.s)
Prototype LoadDocuments(documentpath.s,password.s)
Prototype GetPageCounts(HandleToDocument.i)
If OpenLibrary(#PDFlib,"pdfium.dll")
ExamineLibraryFunctions(#PDFlib)
Debug IsLibrary(#PDFlib) ; Just for testing. Value should be above zero.
Debug LibraryID(#PDFlib) ; Just for testing. Value should be above zero.
Debug CountLibraryFunctions(#PDFlib)
For i = 1 To CountLibraryFunctions(#PDFlib)
Debug i
NextLibraryFunction()
Debug LibraryFunctionName()
Next
Debug GetFunctionEntry(#PDFlib,128) ; Just for testing. Value should be above zero.
Debug GetFunction(#PDFlib,"_FPDF_InitLibrary@0") ; Just for testing. Value should be above zero.
Debug GetFunctionEntry(#PDFlib,131) ; Just for testing. Value should be above zero.
Debug GetFunction(#PDFlib,"_FPDF_LoadDocument@8") ; Just for testing. Value should be above zero.
Debug GetFunctionEntry(#PDFlib,122) ; Just for testing. Value should be above zero.
Debug GetFunction(#PDFlib,"_FPDF_GetPageCount@4") ; Just for testing. Value should be above zero.
Init.InitLibrary = GetFunction(#PDFlib,"_FPDF_InitLibrary@0") ; Call this function first before all other functions.
Debug Init("",GetCurrentDirectory()+"pdfium.dll")
LoadDocument.LoadDocuments = GetFunction(#PDFlib,"_FPDF_LoadDocument@8")
Handle.i = LoadDocument(GetCurrentDirectory()+"name_of_document.pdf","")
Debug Handle
GetPageCount.GetPageCounts = GetFunction(#PDFlib,"_FPDF_GetPageCount@4")
Debug GetPageCount(Handle)
CloseLibrary(#PDFlib)
EndIf
Everything according to PB-manual, but no success. Perhaps an expert can have a look.
Last edited by Hadrianus on Fri Jun 10, 2016 7:54 pm, edited 1 time in total.
I guess my biggest mistake is not putting p-utf8 in documentpath (althrough I do not understand why it's necessary) and I did not use InitLibrary() as it should. Are you familiar with Pdfium and all the function-arguments?
Certainly sounds interesting because it appears not to be using Ghost and it is covered by the very generous Apache Licenses v2.0. The file management looks a bit complicated.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
I downloaded from https://github.com/pvginkel/PdfiumViewer ( both 32 and 64 bit versions) and it doesn't work using either version of your code , with either dll. I get an error message stating ...
H:\DEV\pb\542\64\PDFium\x64\pdfium.dll is either not designed to run on Windows or it contains an error. Try installing the program againusing the original installation media or contact your system administrator or the software vendor for support. The only parts of your code I have modified is using the full path to the DLL and the pdf file I'm attempting to view. Nothing is wrong with the pdf as I can view it with all other viewers. Can you post the version of the dll you have somewhere that I can download it? I am using Win 7 64 , PB 5.42 64 and tried with both the 32 and 64 bit versions of the dll.
HP Z800 Workstation
CPU : Dual Xeon 5690 3.46GHz
RAM : 96GB RAM ( 8GB x 12 )
PSU : 1100W
GPU : NVIDIA RTX 3050 8GB
STORAGE : 9TB
(4) 2TB Seagate IronWolf Pro HDD
(1) 1TB Samsung 870 EVO SSD
Thanks Hadrianus. I wasn't thinking of zooming the page (though no doubt useful), but to render it onto a canvas instead of the client area of the window. The canvas is on a ScrollAreaGadget(). No luck so far but that is because I don't know what I'm doing:
I put a snippet there but since I do not know how to retrieve a handle to a device context for a CanvasGadget, any amount of sample code from me will not make matters better