Create PDF from multipage-Tiff and write it to a stream

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

Create PDF from multipage-Tiff and write it to a stream

Post by ebbiTeam » Fri Jul 01, 2011 10:29 am

Hello,

I have another problem to solve. ;)
There's a need in our project to load a multipage-Tiff and create a multipage PDF-document not only to file but also to stream for further use in another component.

I only see two possibilities to implement this:

1. Using the

Code: Select all

PdfCreateFromMultipageTIFF
, store the pdf to a temporary file and read it into a stream.

2. Build upthe page manually from scratch starting with

Code: Select all

NewPDF()
Do you have some other idea due to the fact that these solutions are a bit circuitous?

Best regards
Tobias Herold

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

Re: Create PDF from multipage-Tiff and write it to a stream

Post by Loïc » Fri Jul 01, 2011 12:34 pm

Hi,

Sure there is an easier & faster way:

Code: Select all

      Dim oGdPictureImaging As New GdPictureImaging()
      Dim new_pdf As New GdPicturePDF

      oGdPictureImaging.SetLicenseNumber("XXX")
      new_pdf.SetLicenseNumber("XXX")

      Dim TiffID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("c:\mymultipage.tif")
      new_pdf.NewPDF()

      For i As Integer = 1 To oGdPictureImaging.TiffGetPageCount(TiffID)
         oGdPictureImaging.TiffSelectPage(TiffID, i)
         new_pdf.AddImageFromGdPictureImage(TiffID, False, True)
      Next

      oGdPictureImaging.ReleaseGdPictureImage(TiffID)

      Dim memory_stream As New IO.MemoryStream
      new_pdf.SaveToStream(memory_stream) 'Save to stream
      new_pdf.SaveToFile("c:\dumppage.pdf") 'or save to file
      new_pdf.CloseDocument()
Hope this helps !

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

Re: Create PDF from multipage-Tiff and write it to a stream

Post by ebbiTeam » Fri Jul 01, 2011 2:49 pm

Thank you, that helped a lot!

I have another question regarding this issue.
What's the difference between

Code: Select all

CreateGdPictureImageFromFile
and

Code: Select all

TiffCreateMultiPageFromFile
?

As I found out the time of creation for the first one is much faster.

But why should I use the special tiff-function?

Best regards
Tobias Herold

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest