Page 1 of 1

Getting PDF DPI

Posted: Wed Apr 28, 2010 3:08 pm
by charuvas1
Hi,

I want to know DPI of PDF file? Is there any function in PDFreader to get DPI of a file at which it was written?

charu

Re: Getting PDF DPI

Posted: Wed Apr 28, 2010 5:49 pm
by Loïc
Hi,

Yes, check this code:

Code: Select all

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim oGdPictureImaging As New GdPicture.GdPictureImaging
        oGdPictureImaging.SetLicenseNumber("XXX") 'Replace XXX by valid commercial or demo KEY

        Dim hPDF As Integer = oGdPictureImaging.PdfReaderLoadFromFile("c:\test.pdf")
        If hPDF > 0 Then
            oGdPictureImaging.PdfReaderSelectPage(hPDF, 1) 'Select Page1
            Dim ImageCount As Integer = oGdPictureImaging.PdfReaderGetImageCount(hPDF)

            For i As Integer = 1 To ImageCount
                Dim ImageID As Integer = oGdPictureImaging.PdfReaderExtractImage(hPDF, i)
                If ImageID <> 0 Then
                    MsgBox("Image No: " + Str(i) + Chr(13) + _
                           "Res X: " + Str(oGdPictureImaging.GetHorizontalResolution(ImageID)) + Chr(13) + _
                           "Res Y: " + Str(oGdPictureImaging.GetVerticalResolution(ImageID)) + Chr(13))
                    oGdPictureImaging.ReleaseGdPictureImage(ImageID)
                End If
            Next
            oGdPictureImaging.PdfReaderCloseDocument(hPDF)
        End If
    End Sub

Re: Getting PDF DPI

Posted: Wed Sep 05, 2012 6:25 pm
by ksamy
Hello,
How do i that same (Getting PDF DPI) in 8.5.33 version.
Because i am getting error when use your code on that version

Re: Getting PDF DPI

Posted: Thu Oct 11, 2012 8:30 am
by ksamy
??