Free Support Forum - aspose.com

Suggestion for getting a single PDF page as image

I understand (at least I think so) that to extract a page from a PDF you need to cycle through the entire file, at least to the page you want.

In my case I have a test PDF with 620 pages. To get say page five it takes several seconds and to get page 600 it takes forever.

Any ways it would be cool to have some method to specifiy the page to convert to an image and not have to cycle through the entire file, do not know if this is possible either.

Dim converter As Kit.PdfConverter = New Kit.PdfConverter()
converter.BindPdf(PdfFileToWorkOn)
converter.DoConvert()

Dim prefix As String = ImageFolder & "\"
Dim suffix As String = ".png"
Dim Cnt As Integer = 1
Dim Dummy As New System.IO.MemoryStream

While converter.HasNextImage()
Application.DoEvents()
If imageCount = Convert.ToInt32(NumericUpDown1.Value) Then
converter.GetNextImage(prefix & cnt.ToString & suffix, System.Drawing.Imaging.ImageFormat.Png )
MsgBox("Imaged created")
Exit While
Else
converter.GetNextImage(Dummy)
End If

cnt = imageCount + 1
End While

Hi,

You can use the StartPage and EndPage property of the PdfConverter class. If you want to get the 600 page, simply set StartPage and EndPage to 600.

Thanks.

Hi Kevin,

Thanks for your advice.Yes, it's reasonable to implement arbitrary extracting & converting in PdfConvert in more direct way. we hope such methods would be available in next release.