|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 liujunwei4321 于 2023-12-18 21:14 编辑
D.7z
(86.65 KB, 下载次数: 12)
pdfium.7z
(1.92 MB, 下载次数: 17)
- Private Declare PtrSafe Sub FPDF_InitLibrary Lib "d:\pdfium.dll" ()
- Private Declare PtrSafe Sub FPDF_DestroyLibary Lib "d:\pdfium.dll" ()
- Private Declare PtrSafe Function FPDF_LoadDocument Lib "d:\pdfium.dll" (ByVal file_path As String, Optional ByVal Password As String = "") As LongPtr
- Private Declare PtrSafe Function FPDF_LoadMemDocument Lib "d:\pdfium.dll" (ByVal pData As Long, ByVal DataLen As Long, Optional ByVal Password As String = "") As LongPtr
- Private Declare PtrSafe Sub FPDF_CloseDocument Lib "d:\pdfium.dll" (ByVal hdoc As LongPtr)
- Private Declare PtrSafe Function FPDF_GetPageCount Lib "d:\pdfium.dll" (ByVal hdoc As LongPtr) As Long
- Dim hdoc As LongPtr
- Private Sub Class_Initialize()
-
-
- Dim strencode As String, filename As String
- filename = "d:\1.pdf"
- filename = "d:\中.pdf"
-
- FPDF_InitLibrary
- hdoc = FPDF_LoadDocument(filename, vbUnicode)
- 'hdoc = FPDF_LoadMemDocument(?)
- MsgBox FPDF_GetPageCount(hdoc)
- FPDF_CloseDocument (hdoc)
- End Sub
复制代码
调用pdfium(c++库)来获取pdf页码,如果文件名没有中文,程序没问题,但是如果文件名中有中文,就不行,估计是编码问题,请问如何解决?
当然也可以从内存读取文件,如果可以,如何改呢?
|
|