Fast allocation of pdf pages to a stream

Discussions about PDF management.
Post Reply
ebbiTeam
Posts: 20
Joined: Fri May 13, 2011 3:49 pm

Fast allocation of pdf pages to a stream

Post by ebbiTeam » Fri Jun 24, 2011 2:43 pm

Hello,

I need to supply pages of a loaded pdf document to a stream for working with it in another component.
It's important that this stream contains the pdf data and not some kind of image format.

So far I have found out only one solution for this requirement:

Code: Select all

 Public Sub SetPreview(ByVal page As PDFSplitterDocumentPage)
        m_gdPicture.PdfReaderSelectPage(page.FileID, page.PageNumber)
        Dim pdfSample As Integer = m_gdPicture.PdfReaderRenderPageToGdPictureImage(page.FileID, 200, False)
        Dim readStream as MemoryStream = New MemoryStream()
        m_gdPicture.SaveAsPDFStream(pdfSample , readStream, False, "", "", "", "", "")

        'Further handling...    
End Sub
In this solution the "m_gdPicture.PdfReaderRenderPageToGdPictureImage" function slows down the display process in the preview component.

Is there a possiblity to reach a faster loading?

Thanks and best regards!
Tobias Herold

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Fast allocation of pdf pages to a stream

Post by Loïc » Sat Jun 25, 2011 12:44 pm

Hi,

I don't fully understand what you need to do and why use the PdfReaderRenderPageToGdPictureImage function. Anyway, to improve the rasterization process you can only try to decrease the resolution of rendering. Currently you are using 200.

Also, in GdPicture.NET 8 which will be release on next monday we bring full PDF support to split page of PDF to a new PDF which can subsequently saved to file or to a stream.

Hope this helps !

Loïc

ebbiTeam
Posts: 20
Joined: Fri May 13, 2011 3:49 pm

Re: Fast allocation of pdf pages to a stream

Post by ebbiTeam » Mon Jun 27, 2011 9:53 am

Sorry for not being clearly enough with my explanation.

I need your component to get a pdf stream from a pdf file. This stream I will need in another component.

The only way to get data out of the loaded file is the PdfReaderRenderPageToGdPictureImage function as it seems.
This will lead to a picture stream which has no searchable ability (text is not markable) - the outcoming file is not pdf native.
Furthermore as mentioned the rendering process of this function is relatively slow and decreasing the resolution will have the effect of bad image quality.

I will now try out the new Version and get back here with my experiences soon.

Best regards
Tobias Herold

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Fast allocation of pdf pages to a stream

Post by Loïc » Mon Jun 27, 2011 11:29 am

Hi Tobias,

I understand better now.

In V7 we was not able to save existing PDF keeping original PDF data, a raster format conversion was required and was resulting on a PDF image based only.
The new version has now the ability to save existing PDF to stream keeping all data.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests