A way to find out whether a pdf file is image based
A way to find out whether a pdf file is image based
Hi,
Is there a way to find out whether a pdf file is image based or not? i.e. whether this pdf file has image or text data?
Thank you
charu
Is there a way to find out whether a pdf file is image based or not? i.e. whether this pdf file has image or text data?
Thank you
charu
Re: A way to find out whether a pdf file is image based
Hi,
here an idea:
- Open the PDF
- Extract text
- Get Image count
If Image count = 1 and text is empty you have lot of chance to have "image based" PDF.
Kind regards,
Loïc
here an idea:
- Open the PDF
- Extract text
- Get Image count
If Image count = 1 and text is empty you have lot of chance to have "image based" PDF.
Kind regards,
Loïc
Re: A way to find out whether a pdf file is image based
Hi,
As you said I use your functions to know file is image base or not. But it gives me execption if PDF file is a fallible form. It throw exception.
Exception message:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
My code is as below:
As you said I use your functions to know file is image base or not. But it gives me execption if PDF file is a fallible form. It throw exception.
Exception message:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
My code is as below:
Code: Select all
Dim oGdPictureImaging As New GdPicture.GdPictureImaging
oGdPictureImaging.SetLicenseNumber("xxxxx")
Dim PdfID As Integer = oGdPictureImaging.PdfReaderLoadFromFile(InputFilePath)
If PdfID > 0 Then
Dim imgCount As Integer = oGdPictureImaging.PdfReaderGetImageCount(PdfID)
Dim fleText As String = oGdPictureImaging.PdfReaderGetPageText(PdfID)
If imgCount >= 1 And fleText = "" Then
MsgBox("file is image base")
Else
MsgBox("file is text base")
End If
End If
oGdPictureImaging.ReleaseGdPictureImage(PdfID)
Re: A way to find out whether a pdf file is image based
Hi,
You have first to select a page.
Please, make a call to PdfReaderSelectPage before using PdfReaderGetImageCount.
Kind regards,
Loïc
You have first to select a page.
Please, make a call to PdfReaderSelectPage before using PdfReaderGetImageCount.
Kind regards,
Loïc
Re: A way to find out whether a pdf file is image based
Hi,
As you said i call oGdPictureImaging.PdfReaderSelectPage(PdfID, 1) 'Select Page1
before PdfReaderGetImageCount. But I get an exception which i explain earlier.
It occurs only in fallible form PDF.
As you said i call oGdPictureImaging.PdfReaderSelectPage(PdfID, 1) 'Select Page1
before PdfReaderGetImageCount. But I get an exception which i explain earlier.
It occurs only in fallible form PDF.
Re: A way to find out whether a pdf file is image based
Hi,
Please attach PDF which cause this error for investigation.
Kind regards,
Loïc
Please attach PDF which cause this error for investigation.
Kind regards,
Loïc
Who is online
Users browsing this forum: No registered users and 1 guest