Convert from PDF to multipage Tiff or JPEG
Convert from PDF to multipage Tiff or JPEG
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")
Me.OpenFileDialog1.ShowDialog()
Me.Imaging1.CreateImageFromFile(Me.OpenFileDialog1.FileName)
Me.Imaging1.TiffSaveAsNativeMultiPage(My.Application.Info.DirectoryPath & "\MyConvertFile.tif")
Code to convert PDF file to multipage tiff image
Hi,
You can convert PDF to tiff using the GdViewer & Imaging classes:
Code to convert PDF file to multipage tiff image:
Regards,
Loïc
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
Re: Convert from PDF to Tiff
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.
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.
Re: Convert from PDF to Tiff
Hi,
To save as 1bpp multipage tiff using CCITT4 compression file you need to replace this part of the code sample:
By this one:
Best regards,
Loïc
To save as 1bpp multipage tiff using CCITT4 compression 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", CompressionCCITT4)
Else
Call oImaging.TiffAddToNativeMultipage(oGdViewer.GetNativeImage)
End If
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
Loïc
Re: Convert from PDF to Tiff
I tried your code with a multipage PDF, but only the first page seemed to be converted in black/white.
Thanks
Thanks
Re: Convert from PDF to Tiff
Hi,
I tried it. No problem. I have a multipage tiff in b&w for all pages.
I give you the code I used:
Hope this helps.
Loïc
I tried it. No problem. I have a multipage tiff in b&w for all pages.
I give you the code I used:
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 ("XXX")
oImaging.SetLicenseNumber ("XXX")
oGdViewer.LockControl = True
oGdViewer.DisplayFromPdfFile ("c:\test.pdf")
For nPage = 1 To oGdViewer.PageCount
oGdViewer.DisplayFrame (nPage)
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
Next nPage
oImaging.TiffCloseNativeMultiPage
Hope this helps.
Loïc
Re: Convert from PDF to Tiff
Shame on me, it was my fault.
Your code does work !!!
Thanks
Your code does work !!!
Thanks
Convert from PDF to JPEG
Another sample to convert multipage PDF to multiple JPEG images:
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 ("XXX")
oGdViewer.LockControl = True
oGdViewer.DisplayFromPdfFile ("c:\test.pdf")
For nPage = 1 To oGdViewer.PageCount
oGdViewer.DisplayFrame (nPage)
oImaging.SetNativeImage (oGdViewer.GetNativeImage)
Call oImaging.SaveAsJPEG("c:\output" + Str(nPage) + ".jpg", 75)
Next nPage
oGdViewer.CloseImage
- kketterman
- Posts: 32
- Joined: Tue Apr 21, 2009 6:55 pm
Re: Convert from PDF to Tiff
I'm still looking but I cannot find the .NET equivalent to these methods.Loïc wrote:Hi,
To save as 1bpp multipage tiff file you need to replace this part of the code sample:
By this one: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
Best regards,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
Loïc
oImaging.SetNativeImage (oImaging.CreateClonedImage(oGdViewer.GetNativeImage))
Re: Convert from PDF to multipage Tiff or JPEG
Damn thats a nice workaround man
ive been using converter sites like http://convertjpgpdf.net/ to do my conversions but i dont appreciate them very much^^
so thanks for this
regards
peter
ive been using converter sites like http://convertjpgpdf.net/ to do my conversions but i dont appreciate them very much^^
so thanks for this
regards
peter
-
- Posts: 1
- Joined: Tue Nov 14, 2023 6:11 pm
Re: Convert from PDF to multipage Tiff or JPEG
Can you convert the image format while converting from PDF to Tiff?
myindigocard
jjsploit download
myindigocard
jjsploit download
Re: Convert from PDF to multipage Tiff or JPEG
Start by dragging and dropping your PDF into the designated area on the conversion page, or by clicking the "Select A File" button.
There is a drop-down menu where you can select a TIFF, JPG, or PNG file.
Click the Convert To TIFF button after selecting TIFF as the file format for this project.
After logging into a service like Apple, Google, or Adobe, you may either download the TIFF or send it to someone else via email or a link.
There is a drop-down menu where you can select a TIFF, JPG, or PNG file.
Click the Convert To TIFF button after selecting TIFF as the file format for this project.
After logging into a service like Apple, Google, or Adobe, you may either download the TIFF or send it to someone else via email or a link.
Who is online
Users browsing this forum: No registered users and 1 guest