已经知道提取pdf中的图片,如何将每一页另存为图片格式呢?
请指教
Dim doc As org.apache.pdfbox.pdmodel.PDDocument = Nothing 'pdf,目录,文件名,文件数,页数
Try
doc = org.apache.pdfbox.pdmodel.PDDocument.load(Args(0))
Dim pages = doc.getDocumentCatalog().getAllPages()
Dim i As Integer = 1
Dim ii As Integer = 1
Dim file As String
For Each page As object In pages
Dim resources = page.getResources()
Dim imgs = resources.getImages()
If imgs IsNot Nothing Then
For Each key As object In imgs.keySet
FileSys.CreateDirectory(Args(1))
imgs.get(key).write2file(Args(1) & Args(2) & i)
file = file & "|" & Args(1) & Args(2) & i
file = file.Trim("|")
i + = 1
If i >= Args(3) Then
Exit For
End If
Next
End If
ii + = 1
If ii >= Args(4) Then
Exit For
End If
Next
Return file
catch ex As exception
Finally
If doc IsNot Nothing Then
doc.close()
End If
End Try