p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   Pro VB.NET 2002/2003 (http://p2p.wrox.com/pro-vb-net-2002-2003-74/)
-   -   Convert PDF to Tiff in code (http://p2p.wrox.com/pro-vb-net-2002-2003/53354-convert-pdf-tiff-code.html)

hexOffender January 29th, 2007 04:27 PM

Convert PDF to Tiff in code
Is there a way to convert a PDF to a Multipage Tiff in VB code.
Can it be done using an Acrobat reference(COM). I know you can save as Tiff in Acrobat. Could I just do shell calls to save As?

hexOffender January 30th, 2007 03:16 PM

I have cobbled together this code so far:

 Dim FileName As String
        Dim image As String = "Image"

        AcroXApp = CType(CreateObject("AcroExch.App"), Acrobat.CAcroApp)
        'Removing toolbar buttons from the user interface
        With AcroXApp
        End With
        AcroXAVDoc = CType(CreateObject("AcroExch.AVDoc"), Acrobat.CAcroAVDoc)
        FileName = "C:\Image.pdf"
        AcroXAVDoc.Open(FileName, "Acrobat")

        AcroXPDDoc = CType(AcroXAVDoc.GetPDDoc, Acrobat.CAcroPDDoc)
        AcroXPDDoc.ClearFlags(&H1) 'Keep Acrobat from querying a file save when component closes


        'SetParent(AcroHandle, 0)

I can open the SaveAs Dialogue, but How can I populate it with the filename I want("Image.tiff"). And then I wuld like to have this done without showing the Acrobat screens.

Dannili August 5th, 2017 04:59 AM

Convert PDF to Tiff in vb.net code
I recommend you use xspdf control http://www.xspdf.com/guide/pdf-tiff-converting/
here is the vb.net code to convert pdf to tiff image

Dim pdfConverter As PdfImageConverter = New PdfImageConverter("sample.pdf")
' Set the dpi, the output image will be rendered in such resolution
pdfConverter.DPI = 96
Dim i As Integer = 0
Do While (i < pdfConverter.PageCount)
' Convert each pdf page to a single page tiff image with original page size
'Image pageImage = pdfConverter.PageToImage(i);
' Convert pdf to single page tif in customized image size
Dim pageImage As Image = pdfConverter.PageToImage(i, 500, 800)
' Save converted image to tiff format
pageImage.Save(("Page " _
+ (i + ".tiff")), ImageFormat.Tiff)
i = (i + 1)

All times are GMT -4. The time now is 07:07 AM.

Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.