Results 1 to 14 of 14
  1. #1
    2 Star Lounger
    Join Date
    Apr 2004
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PDF to EXCEL using VB (VB/VBA ONLY)

    Is there a way to take a PDF file and put it into an excel spreadsheet? If so How?

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: PDF to EXCEL using VB (VB/VBA ONLY)

    <img src=/S/hmmn.gif border=0 alt=hmmn width=15 height=15> Never heard of a way myself but here is the manual method PDF to Excel conversion
    Jerry

  3. #3
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Jeddah, Saudi Arabia
    Posts
    243
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: PDF to EXCEL using VB (VB/VBA ONLY)

    I suppose it would depend on the structure and complexity of the document but you could print the PDF document to a file using a generic Text Only printer, then parse that file using VBA in Excel.

    Regards,
    Kevin Bell

  4. #4
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDF to EXCEL using VB (VB/VBA ONLY)

    Not for free. There are conversion programs you can buy but the PDF format is proprietary and not published (alto I'm sure there are hacks out there that have reverse engineered the format for certain versions of PDF). I've used Able2Extract from http://www.investintech.com/able2extract.html, it's about $90 but there's an Excel only version for less. Also, if the PDF is protected, nothing can be copied anyway.

    Deb

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: PDF to EXCEL using VB (VB/VBA ONLY)

    > the PDF format is proprietary and not published

    Actually, Adobe has published the specification for PDF, but apparently each program has a slightly different interpretation which makes it difficult for one vendor's program to reliably interpret another vendor's PDF. They also sometimes have "bugs" in different places, so it's useful to have a different PDF print driver around as a backup.

    The bigger problem, as you point out, is the protection. To work around that, "import" programs typically use OCR to interpret an image of the document, to avoid violating the Digital Millennium Copyright Act by actually cracking the encryption.

  6. #6
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDF to EXCEL using VB (VB/VBA ONLY)

    Ah, didn't know it was so public a format. I had always heard that Adobe had licenses that you had to pay to integrate it with your product. Considering that it is public, it's a bit nuts that vendors can not reliably produce a consistent format as you say. I too have seen quite quality in PDF creation from different programs. In that case I may use this new knowledge to see if I can add an Excel to PDF file for a current project (output two worksheets that are order forms to a PDF file). Thanks for the info.

    Deb

  7. #7
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDF to EXCEL using VB (VB/VBA ONLY)

    The inconsistent implementations of PDF are largely due to:

    1. The spec is badly specified. Unfortunately, many/most specs (and standards) are written by folkes who may know the subject matter but do not know how to write a proper specification. In many/most cases, the specs are not reviewed properly. In other cases, the person writing the spec does not understand the subject matter. And, all of the above.

    2. The educational system has failed to teach people how to OBJECTIVELY READ. This is very important for such specs.

    3. Even when umderstood, some developers have been known to do it their way, in spite of a spec/standard/common sense.

  8. #8
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDF to EXCEL using VB (VB/VBA ONLY)

    I can definitely relate to all you said -- standards aren't necessarily standard, they written somewhat broadly with few 'must' rules. Years ago I did a lot of work IEEE 488 (aka GPIB - a test equipment communications protocol) and was so frustrated to get one GPIB card from one vendor that worked one way and another that worked differently. I would have to write patches in software to try and compensate for the differeces in these cards so that the different test equipment they were installed in could talk to each other. The authors of these things don't seem to take into account that someone has to write software (or design hw) to implement their words and people can so do you take the spec literally or not (e.g., is a 10 millisec delay between signals, exactly 10.0 or is it 9.5-10.5)

    As for PDF, I decided to not wade these waters, the rewards are not worth the effort of rolling my own when I can put the burden on the user to get their own PDF maker (and pay for the quality they want; free or pay). I'll just search their list of installed printers for "PDF" and notify them if they have it installed or not.

    Thnx,
    Deb

  9. #9
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDF to EXCEL using VB (VB/VBA ONLY)

    Standards/specs written by committee may even be worse than those written by a few individuals.

    The committee KNOWS what the document is SUPPOSED to say, so the ASSuME things, if they even do, review the critter.
    However, those not privy to the committee's actions are left in the dark.

    Companies that do not directly/indirectly participate in the relevant standards activities, thinking they can save money by just implementing drafts and published specs, are outright fools.

    These are the reasons that ISO 9660, and the High Sierra spec, and ISO/IEC 13346 have been so poorly/inconsistently implemented.
    Another example. I used to always wonder why a particular company implemented a particular standard "improperly", until I met the person in that company who was their representative on the relevant standards committee. He was truely inept.

    Anyway, 'nuf for discusing my religion.
    Those not having experienced standards development won't believe anyway.

  10. #10
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDF to EXCEL using VB (VB/VBA ONLY)

    Yes I was going to query the list of installed printers using the Windows API EnumPrinters and then parse each one for the string "PDF" since I figured it has to be in its name somewhere. Then if the user selected they want to print to PDF but their default printer is something else, I'd warn them that they need to change their printer setting (or do it for them if ok'd) before they can print. If they select PDF printer as the output, but no PDF printer is listed, I'd show an error message that they need a PDF printer driver installed. I haven't started this yet but will do so in next few hours. With so many non-Adobe PDF printer/conversion programs out there, I wasn't going to try and list them.

    On the Lounge I came across <post#=87919>post 87919</post#> and will try and use that as the basis. One reply referenced http://vbnet.mvps.org/index.html?cod.../browseadv.htm code to query the printers altho it's a bit imposing. I just want the printer names and will write them to a listbox for the user to select from (and for me to parse). That's the plan so far.... we'll see how it goes.

    Deb

  11. #11
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDF to EXCEL using VB (VB/VBA ONLY)

    <P ID="edit" class=small>(Edited by JanB on 03-Jan-06 08:49. )</P>If the user has a PDF printer listed, there's no need for user action to change printers if you save & restore the current printer:

    ' test if there's a PDF printer available. if so then:
    Dim strDefaultPrinter As String
    strDefaultPrinter = ActivePrinter

    ' change to PDF printer and print

    ActivePrinter = strDefaultPrinter

    Works fine for us. I always put that last line between an Exit_Error: label and an Exit Sub line to make sure that the user's printer is restored even if an error happened, by putting Resume Exit_Error in the error handler.

  12. #12
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDF to EXCEL using VB (VB/VBA ONLY)

    Yes that's exactly what I was going to do but first I need to get that list of installed printers. Setting the active printer is easy as you show but I don't yet know how to fetch the list of all installed printers. I'll work on that tomorrow... it's past midnight now, been working on this project for 15 hrs today... had enough <img src=/S/nosleep.gif border=0 alt=nosleep width=27 height=15>

    Deb

  13. #13
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PDF to EXCEL using VB (VB/VBA ONLY)

    The PDF format is very public.
    Addison-Wesley publishes the spec in a book. and the book spec is downloadable from Adobe's web site.

    It is not a good spec, not very easy to follow, at least it was a few years ago, maybe more recent versions are better.

  14. #14
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: PDF to EXCEL using VB (VB/VBA ONLY)

    <P ID="edit" class=small>(Edited by jscher2000 on 03-Jan-06 11:19. pdfFactory info filled in)</P>Maybe you can start a project to collect the names of PDF printers? These are two I have used:

    (1) CutePDF Writer from http://www.cutepdf.com/Products/CutePDF/writer.asp (free)

    Name in the Printers control panel = CutePDF Writer
    Name in Word as ActivePrinter = CutePDF Writer on CPW2:

    (2) pdfFactory from http://www.fineprint.com/products/pdffactory/index.html ($50)

    Name in the Printers control panel = FinePrint pdfFactory
    Name in Word as ActivePrinter = FinePrint pdfFactory on FPP1:

    Is there any other point of reference that should be collected? For example, are you using a little Windows API code you could post and we could test our various printers?

Posting Permissions

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