I am trying to convert incoming .pdf reports into corresponding .jpeg files (one per page) and for some reason it is not working for me at the moment, I am using the following code:
- Code: Select all
ofdGetPDFFile.Filter = "PDF Documents|*.pdf"
If ofdGetPDFFile.ShowDialog = DialogResult.OK Then
Dim pdf As PdfDocument = New Spire.Pdf.PdfDocument
pdf.LoadFromFile(ofdGetPDFFile.FileName)
Dim i = 1
'Loop through all pages in the document
For Each page As PdfPageBase In pdf.Pages
'Extract images from each page and save them to a specified file path
For Each image As Image In page.ExtractImages()
image.Save($"c:/epdehrs/temp/images/{IO.Path.GetFileName(ofdGetPDFFile.FileName)}{i}.jpeg", Drawing.Imaging.ImageFormat.Jpeg)
i += 1
Next
Next
End If
and it does produce an image, however content does not seem to match what i am seeing on the original .pdf document
maybe content i am trying to access can't be accessed that way .. i am going to attach a few samples so hopefully you could guide me in the right direction
Regards,
Alex