Results 1 to 4 of 4
  1. #1
    afshin is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    65

    exporting pdf format of an access report to jpg format by vba

    i want to convert the pdf output of an access report into images.


    i call the ConvertPDFToImage() function by this command:

    strPDFPath = "D:\Report.pdf"
    strImagePath = "D:\ReportImage.jpg"
    Call ConvertPDFToImage(strPDFPath, strImagePath)

    and ConvertPDFToImage() is here:

    Sub ConvertPDFToImage(pdfPath, imagePath As String)
    Dim AcroApp As Acrobat.CAcroApp
    Dim acroDoc As Acrobat.CAcroPDDoc
    Dim AcroAVDoc As Acrobat.AcroAVDoc
    Dim AcroPDDoc As Acrobat.AcroPDDoc
    Set AcroApp = CreateObject("AcroExch.App")
    Set acroDoc = CreateObject("AcroExch.PDDoc")
    Set AcroAVDoc = CreateObject("AcroExch.AVDoc")
    If AcroAVDoc.Open(pdfPath, vbNull) <> True Then
    Exit Sub
    End If
    Set AcroAVDoc = AcroApp.GetActiveDoc
    Set AcroPDDoc = AcroAVDoc.GetPDDoc
    AcroApp.MenuItemExecute "File.ExportAsImage"
    AcroApp.CloseAllDocs
    AcroApp.Exit

    Set AcroApp = Nothing
    Set AcroAVDoc = Nothing
    Set AcroPDDoc = Nothing
    End sub

    but AcroApp.MenuItemExecute "File.ExportAsImage" cannot accept the saved directory of images and names.
    do you have any ways to solve this?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    afshin is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    65
    very very tanks to you. your code solved my problem.

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Quote Originally Posted by afshin View Post
    very very tanks to you. your code solved my problem.
    Care to share the changes then?

    This site (like others) is here to help others, and it might help anyone else wanting to do the same thing.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Exporting an Access report to PDF format
    By Glenn_Suggs in forum Reports
    Replies: 3
    Last Post: 11-02-2018, 04:44 AM
  2. Customize Date Report when exporting the data to excel format
    By fluffyvampirekitten in forum Access
    Replies: 1
    Last Post: 08-19-2015, 03:33 AM
  3. Replies: 0
    Last Post: 02-25-2015, 08:09 AM
  4. Replies: 4
    Last Post: 03-12-2013, 06:49 PM
  5. Replies: 7
    Last Post: 10-11-2012, 01:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums