Convert PDF to Image Using VBA Macro

Anonymous
2010-10-13T14:11:49+00:00

Hi

I have pdf file which i need to convert to ImageFormat [ PNG or GIF ] using Word VBA Macro

please provide the solution either through VBA or VB or .net framework

thanks


Orcas

Microsoft 365 and Office | Install, redeem, activate | For home | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Jay Freedman 205.9K Reputation points Volunteer Moderator
    2010-10-13T14:15:18+00:00

    Is it absolutely required to do this in Word? It would be much easier to use a program that's actually designed to do this. Try Snagit (www.techsmith.com) -- there's a free trial version you can download.


    Jay Freedman

    MS Word MVP  FAQ: http://word.mvps.org

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2010-10-13T14:17:32+00:00

    Word has no native ability to open or process PDF files.


    Graham Mayor - Word MVP

    www.gmayor.com

    Posted via the Communities Bridge

    http://communitybridge.codeplex.com/

    0 comments No comments
  3. Anonymous
    2012-08-29T07:11:28+00:00

    I think PDF to Image Converter can help you solve this program, you can have a try, windows supported. http://www.oxpdf.com/pdf-to-image-converter.html

    3 people found this answer helpful.
    0 comments No comments
  4. Steve Rindsberg 99,086 Reputation points MVP Volunteer Moderator
    2012-08-29T16:12:27+00:00

    Depending on the quality of image you need and on whether a conversion of just the first page will do it for you, you could automate PowerPoint instead.

    Set the PPT slide size to proportions that match the PDF

    Insert the PDF as an object

    Position it to 0,0 and set it to the slide's height and width

    Save the slide as a PNG or GIF

    Simple example, automated from within PPT

    You could modify the code to automate PPT from other apps

    Sub SavePDFAsPng(sPathToPDF As String, sPathToPNG As String)

    Dim oPres As Presentation

    Dim oSh As Shape

    ' Height/Width are hardcoded here

    ' You could get trickier and bring the PDF into any presentation

    ' once to get its proportions, delete it, set the slide size to the same

    ' proportions, then re-insert the PDF

    Dim sngWidth As Single

    Dim sngHeight As Single

    sngWidth = 612

    sngHeight = 792

    Set oPres = Presentations.Add

    With oPres

    With .PageSetup ' set it to 8.5x11

    .SlideHeight = sngHeight  ' 11in * 72 points per inch

    .SlideWidth = sngWidth

    End With

    .Slides.AddSlide 1, .SlideMaster.CustomLayouts(1)

    With .Slides(1)

    Set oSh = .Shapes.AddOLEObject(0, 0, sngWidth, sngHeight, , sPathToPDF)

    Call .Export(sPathToPNG, "PNG")

    End With

    .Saved = True

    .Close

    End With

    End Sub

    Sub TestSavePDFAsPng()

    Call SavePDFAsPng("C:\Temp\MyTest.pdf", "C:\Temp\MyTest.PNG")

    End Sub

    8 people found this answer helpful.
    0 comments No comments
  5. Anonymous
    2012-09-26T02:09:43+00:00

    I don't use VBA or VB to convert a PDF file to image, that seems too difficult. I often use PDF to Image Converte, which I think is much easier to do the task. This is the converter I often use and you can also have a try! http://www.pdf-converter-creator.com/pdf-to-image.html

    0 comments No comments