bblanchon / pdfium-binaries

📰 Binary distribution of PDFium
853 stars 182 forks source link

VBA 64 call pdfium.dll crash #172

Open loquat opened 1 month ago

loquat commented 1 month ago

the latest version PDFium 128.0.6611.0 windows x64 Public Declare PtrSafe Function FPDF_LoadDocument Lib "pdfium" (ByVal file_path As String, Optional ByVal Password As String) As LongPtr Public Declare PtrSafe Sub FPDF_CloseDocument Lib "pdfium" (ByVal hPDF As LongPtr) Public Declare PtrSafe Function FPDF_GetPageCount Lib "pdfium" (ByVal hPDF As LongPtr) As Long Public Declare PtrSafe Sub FPDF_InitLibrary Lib "pdfium" () Public Declare PtrSafe Sub FPDF_DestroyLibrary Lib "pdfium" ()

Public Function pdfium_GetPages(ByVal sPath As String) As Long Dim hPDF As LongPtr Dim bytBuff() As Byte StrToUTF8 sPath, bytBuff 'convert sPath to UTF8 array FPDF_InitLibrary hPDF = FPDF_LoadDocument(bytBuff(0)) If hPDF Then pdfium_GetPages = FPDF_GetPageCount(hPDF) FPDF_CloseDocument hPDF 'Excel crashs here End If FPDF_DestroyLibrary End Function

loquat commented 1 month ago

office 365 x64