Home | About us | Overview | Softwares - Downloads | Evaluate | Order | Support | old forums | Contact | F.A.Q. | Documentations | Search | Sitemap

Convert from PDF to Tiff

Example requests & Code samples for any GdPicture Softwares.

Convert from PDF to Tiff

Postby coeus on Wed Nov 21, 2007 1:45 am

Is there a way to convert from PDF to tiff? Here is some sample code that works fine for jpg but not PDF

Me.OpenFileDialog1.ShowDialog()
Me.Imaging1.CreateImageFromFile(Me.OpenFileDialog1.FileName)
Me.Imaging1.TiffSaveAsNativeMultiPage(My.Application.Info.DirectoryPath & "\MyConvertFile.tif")
coeus
 
Posts: 5
Joined: Tue Oct 09, 2007 7:42 pm

Code to convert PDF file to multipage tiff image

Postby Loïc on Wed Nov 21, 2007 6:48 pm

Hi,

You can convert PDF to tiff using the GdViewer & Imaging classes:

Code to convert PDF file to multipage tiff image:

Code: Select all
Dim nPage As Long
Dim oImaging As Object, oGdViewer As Object

Set oImaging = CreateObject("gdpicturepro5.Imaging")
Set oGdViewer = CreateObject("gdpicturepro5.GdViewer")

oGdViewer.SetLicenseNumber ("XXXX")
oImaging.SetLicenseNumber ("XXX")
oGdViewer.LockControl = True
oGdViewer.DisplayFromPdfFile ("c:\test.pdf")
For nPage = 1 To oGdViewer.PageCount
    oGdViewer.DisplayFrame (nPage)

    If nPage = 1 Then
       oImaging.SetNativeImage (oImaging.CreateClonedImage(oGdViewer.GetNativeImage))
       Call oImaging.TiffSaveAsNativeMultiPage("c:\output.tif")
    Else
       Call oImaging.TiffAddToNativeMultipage(oGdViewer.GetNativeImage)
    End If
Next nPage
oImaging.TiffCloseNativeMultiPage



Regards,

Loïc
User avatar
Loïc
Site Admin
 
Posts: 1002
Joined: Tue Oct 17, 2006 11:48 pm
Location: France

Re: Convert from PDF to Tiff

Postby clocklear on Thu Feb 21, 2008 6:27 pm

Can you convert the image format while converting from PDF to Tiff?

For instance my PDF is a 12 page color document and I want a single method to convert it to a black and while multipage Tif. All examples I have seen use single images and not multipage images.
clocklear
 
Posts: 6
Joined: Sat Jan 12, 2008 12:04 am

Re: Convert from PDF to Tiff

Postby Loïc on Thu Feb 21, 2008 7:16 pm

Hi,

To save as 1bpp multipage tiff file you need to replace this part of the code sample:

Code: Select all
    If nPage = 1 Then
       oImaging.SetNativeImage (oImaging.CreateClonedImage(oGdViewer.GetNativeImage))
       Call oImaging.TiffSaveAsNativeMultiPage("c:\output.tif")
    Else
       Call oImaging.TiffAddToNativeMultipage(oGdViewer.GetNativeImage)
    End If


By this one:

Code: Select all
   oImaging.SetNativeImage (oImaging.CreateClonedImage(oGdViewer.GetNativeImage))
   oImaging.ConvertTo1Bpp
   If nPage = 1 Then   
      Call oImaging.TiffSaveAsNativeMultiPage("c:\output.tif")
   Else
      Call oImaging.TiffAddToNativeMultipage(oImaging.GetNativeImage)
      oImaging.CloseNativeImage()
   End If


Best regards,

Loïc
User avatar
Loïc
Site Admin
 
Posts: 1002
Joined: Tue Oct 17, 2006 11:48 pm
Location: France


Return to Example requests & Code samples

Who is online

Users browsing this forum: No registered users and 1 guest