Results 1 to 10 of 10
  1. #1
    Join Date
    Aug 2006
    Posts
    12

    Exclamation Unanswered: Opening a PDF in my VB Script

    Ok, I'm doing something that is kind of outside the box in my Access application. I have a series of reports that my app generates and puts them into PDFs. That's easy enough and pretty much standard. My question comes to how do I think take that PDF, open it up and do a Save As in order to put it into .png format? I have the PDF.ocx ActiveX control referenced so that's already set up.

    Here's my small snippet of code that I'm using that is failing:
    Dim vPDF As Acrobat.CAcroPDDoc
    DoCmd.OpenReport rstLevels("ReportAbbrev").Value, acViewNormal, , rstLevels("Key").Value & " = '" & rstKeyNums(rstLevels("Key").Value).Value & "'"
    vPDF.Open rstLevels("ReportAbbrev").Value & rstKeyNums(rstLevels("Key").Value).Value & ".PDF"
    vPDF.Save 1, rstLevels("ReportAbbrev").Value & rstKeyNums(rstLevels("Key").Value).Value & ".png"

    It gets to the vPDF.Open line and tells me that it's not set. I've declared vPDF correctly I believe but I'm hoping someone can help me out here! Any help would be great. I'm open to better avenues than the one I'm going down as well.

    Thanks in advance for your help!!

  2. #2
    Join Date
    Aug 2006
    Posts
    12
    Just trying to bump this up. Someone has got to have some ideas.

  3. #3
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    What is the PDF being opened with? I don't have adobe acrobat on my computer, but I know you can't save pdf files in other formats via Reader. I don't know about acrobat. So, maybe when you are trying to resave it that's why it goes huh.

    As a side note, if you are wanting to save this and OCR it, tif's are better...but if you are going to OCR it, why not save it to doc,txt,rtf and save time
    Ryan
    My Blog

  4. #4
    Join Date
    Aug 2006
    Posts
    12
    on my computer I have got Acrobat Distiller and Acrobat PDFWriter which basically act as virtual printers. So that is what I'm using. I can open up the PDF and do a Save As by hand and save it as a PNG file but I'm not getting it to work through my code.

    To answer your question, I'm using PNG because it's at the request of a client for their intranet needs. The do not have adobe viewing capabilities on the computers throughout their company so they need it posted in the form of a PNG file for the purposes of posting internally. We have to also create the PDFs, though, so that the higher ups can go out to the website I've created for them and see all their reports corporation wide. So there's not the flexibility of me choosing a better format as I'm at the mercy of the client.

  5. #5
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    I am not too good at VBA, so heads up.

    Anyway both of those are like printers as you said, so what essentially you are doing is printing a file to your computer through the COM1 or LPT1 port, but you think you are saving it. That being said, what happens if you say .Print vs .Save?
    Ryan
    My Blog

  6. #6
    Join Date
    Aug 2006
    Posts
    12
    Well, I'm printing it. That is correct but what I'm wanting to do is then open up that report that I've printed to a PDF and then do a Save As to then save it as a PNG file. Does that make sense? So basically I want my code to act as if I opened my printed PDF file, go to the File menu, go down to Save As and click. I can do it manually and it works fine but it's been a pain in the butt trying to automate it. I was hoping that someone would have done something similar to this before.

  7. #7
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    PNG is an image file, right?
    Why are you saving a PDF in that format? What's wrong with leaving it as is?

    You're leaping out of Access world and into API land if you're wanting to get this done... Even then I can't say I have the foggiest on how to do this!
    George
    Home | Blog

  8. #8
    Join Date
    Aug 2006
    Posts
    12
    Well, I can't leave it as a PDF file because the client I have doesn't have ability to read PDF at their store level and the client is large enough that it'd be a HUGE cost to them to upgrade all of their machines at the store level with PDF reading capabilities and they want the ability to post these reports to their intranet. Believe me, I'd LOVE to be able to leave them in PDF format but at this point it's not an option unfortunately.

    So I'm REALLY hoping someone knows how to do a Save As on a PDF file to save it in another format using VB Script!!

  9. #9
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by jacobt
    t'd be a HUGE cost to them to upgrade all of their machines at the store level with PDF reading capabilities
    http://www.google.co.uk/search?hl=en&q=pdf+reader&meta=
    Looks free to me...
    George
    Home | Blog

  10. #10
    Join Date
    Aug 2006
    Posts
    12
    Quote Originally Posted by georgev
    Not if their computers are still using Windows 98 which is not longer supported. Yes, they are well behind the times!

    Anyway, I have an update on this thread. I had to resort to using an outside software vendor that will convert a PDF to pretty much any format you wish it to and you can call it through a command line. So, therefore, I can automate it to convert all 5000+ PDFs into PNG format!!! The software is called ABC Amber PDF2Image converter in case you all are curious. It might come in handy for anyone who might want to convert PDFs into some other format

    Thanks for the replies. I just thought that the info might come in handy to some.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •