|
楼主 |
发表于 2023-12-18 23:08
来自手机
|
显示全部楼层
可以先把PDF读入内存,然后从内存读取,但不太会。其它人的有段代码如下
Public Sub SetPDFByteContent(PDFBytes() As Byte)
Dim i As Long, DataLen As Long, PageCount As Long
CloseDocument
Content = PDFBytes
DataLen = UBound(Content) - LBound(Content) + 1
hDoc = FPDF_LoadMemDocument(VarPtr(Content(LBound(Content))), DataLen, "")
If hDoc = 0 Then Err.Raise vbObjectError, , "couldn't open PDF from content"
PageCount = FPDF_GetPageCount(hDoc)
If PageCount = 0 Then CloseDocument: Err.Raise vbObjectError, , "couldn't open any pages"
End Sub |
|