Create Multi-Page Tiff Stream from Multi-Page PDF Stream

Example requests & Code samples for GdPicture Toolkits.
Post Reply
cjsavas
Posts: 1
Joined: Tue Oct 26, 2010 5:03 pm

Create Multi-Page Tiff Stream from Multi-Page PDF Stream

Post by cjsavas » Tue Oct 26, 2010 10:53 pm

hi, I am currently evaluating this product and would like to see a sample where you load a muli-page PDF Stream, and convert to a Multi-Page TIFF stream. Currently I am able to convert a multi-page PDF to a multi-page TIFF but I have to physically save the TIFF to the file system.

Thank you.

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

Re: Create Multi-Page Tiff Stream from Multi-Page PDF Stream

Post by Loïc » Thu Oct 28, 2010 12:19 pm

Hi,

here the sample, hope this helps !

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
      Dim MultiTiffID As Integer

      oGdPictureImaging.SetLicenseNumber("XXX")

      Dim PdfID As Integer = oGdPictureImaging.PdfReaderLoadFromFile("c:\test.pdf")

      If PdfID <> 0 Then
         For i As Integer = 1 To oGdPictureImaging.PdfReaderGetPageCount(PdfID)
            If oGdPictureImaging.GetStat = GdPicture.GdPictureStatus.OK Then
               oGdPictureImaging.PdfReaderSelectPage(PdfID, i)
               Dim RasterizedPageID As Integer = oGdPictureImaging.PdfReaderRenderPageToGdPictureImage(PdfID, 200, True) '200 DPI, can be changed.

               If i = 1 Then
                  MultiTiffID = oGdPictureImaging.TiffCreateMultiPageFromGdPictureImage(RasterizedPageID)
               Else
                  oGdPictureImaging.TiffAppendPageFromGdPictureImage(MultiTiffID, RasterizedPageID)
               End If
               oGdPictureImaging.ReleaseGdPictureImage(RasterizedPageID)
            End If
         Next

         Dim strm As New IO.MemoryStream
         oGdPictureImaging.SaveAsStream(MultiTiffID, strm, GdPicture.DocumentFormat.DocumentFormatTIFF, 65536)
         oGdPictureImaging.ReleaseGdPictureImage(MultiTiffID)
         oGdPictureImaging.PdfReaderCloseDocument(PdfID)
      End If
   End Sub

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest