Using Excel VBA to save PDF file as a text (plain) file?

I'm using 8.0 Acrobat Pro.
Third party apps are not an option (I'm restricted from installing anything on my office PC).
I could simply save each PDF manually, but given the number of files this would not be practical.
The text it will output does not have to be pretty by any means (and I'm aware it won't be).
As long as I can get the PDF files in a text file format, there would be no further obstacles for me - because I would then be able to get Excel to gather-import all the data and consolidate-clean-organize everything accordingly at that point.
What's in these PDF files are simply names, numbers, and email addresses (basic office text type data stuff simple).
I wish to save them all as text files, and then use Excel to suck all the data from those newly created text files and consolidate-organize them accordingly.
The VBA module I've seen referrenced around the web is the following beneath; however, I am having no luck with it.
I keep getting the error message:
ActiveX component can't create object or  return reference to this object (Error 429)
I am running Microsoft Office 2010 | Excel (and using Adobe Acrobat Pro 8.0).
Any help is extremely appreciated.
Here is the VB code in Excel I'm having trouble with:  What this is supposed to do is simply find the specified PDF file and save it as a Plain Txt File.
Sub Convert_PDF_To_Text_File()
Dim AcroXApp As Object
Dim AcroXAVDoc As Object
Dim AcroXPDDoc As Object
Set AcroXApp = CreateObject("AcroExch.App")
AcroXApp.Hide
Set AcroXAVDoc = CreateObject("AcroExch.AVDoc")
AcroXAVDoc.Open strPDFPath, "Acrobat"
AcroXAVDoc.BringToFront
Set AcroXPDDoc = AcroXAVDoc.GetPDDoc
Dim jsObj As Object
Set jsObj = AcroXPDDoc.GetJSObject
jsObj.SaveAs strOutputFile, "com.adobe.acrobat.plain-text"
AcroXAVDoc.Close False
AcroXApp.Exit
End Sub

one other thought is that you can create text files with a batch process inside of acrobat.  Advanced ---> Document Processing ----> Batch Processing.
Choose new sequence, give it a name
Step 1: Select Commands ----> Choose "execute javascript", then hit "Add."  Click on "Execute Javascript" that was just added on the right, then hit the edit button and toss in the script below that I grabbed from the javascript samples (also, if your docs have multiple pages you'll need to embed the for loop into another for loop that cycles through each page).  You'd also want to change the name of the saved txt file to the name of pdf you're doing it to.  It shouldn't be that hard, but I'm guessing you're probably alot more familiar with VBA then javascript which is why you're choosing to do it from excel.  I'm kind of in the same boat of having written a bunch of VBA, but not much javascript.  I highly recommend investing some time into learning acrobat scripting b/c VB does have it's limitations when it comes to messing with PDF's.
* function to extract the text content of the current page and save to a file.
try  {
var p = this.pageNum;
var n = this.getPageNumWords(p);
app.alert("Number of words in the page: " + n);
var str = "";
for(var i=0;i<n;i++) {
var wd = this.getPageNthWord(p, i, false);  
if(wd != "") str = str + wd;  
// save the string into a data object
this.createDataObject("whatever.txt",str); 
// pop up a file selection box to export the data
this.exportDataObject("whatever.txt");
// clean up
this.removeDataObject("whatever.txt");
} catch (e)  { 
app.alert(e)

Similar Messages

  • How to save .pdf file using office word and excel

    Can someone help me how to save .pdf files using office word and excel?  I reinstalled my adobe 7.0 pro in my new pc and before I was able to do it but with my old pc.

    For anything after Office 2003, you have to print to the Adobe PDF printer. If you installed AA 7 on OS newer than XP, you may have to do a workaround to get it to work. With later versions of WORD you can always use the MS plugin for creating PDFs.

  • Is there any way we can save PDF files of 1.8v & 1.9v to 1.4v using plug-in?

    is there any way we can save PDF files of 1.8v & 1.9v to 1.4v using plug-in? (using PDDocSavePara )

    Something like this.
    Change VER variable to version number as you need. ex. VER = 7 -> PDF 1.7
    pdoc = AVDocGetPDDoc(avDoc);
    PDDocSaveParams saveParams;
    unsigned char buffer[sizeof(_t_PDDocSaveParams)];
    saveParams = (PDDocSaveParams)buffer;
    memset(saveParams, 0, sizeof(_t_PDDocSaveParams));
    saveParams->fileSys = ASGetDefaultFileSys();
    saveParams->major = 1;
    saveParams->minor = VER;  //change version here
    saveParams->saveFlags = PDSaveFull | PDSaveCollectGarbage | PDSaveForceIncremental | PDSaveKeepModDate;
    saveParams->size = sizeof (_t_PDDocSaveParams);
    saveParams->saveFlags2 = PDSaveUncompressed;
    PDDocSaveWithParams (pdoc, saveParams);

  • Can i save pdf files onto playbook?

    is it possible to save pdf files onto the playbook? i tried downloading one from a website and it showed up in the active downloads from where i then opened it, but it didnt permanently save. i thought maybe the adobe reader could store it but it didnt. 
    also, is it possible to transfer and save pdf files from a pc onto playbook? 
    this was one of the major things i was hoping the playbook could do..may determine whether it's worth keeping

    It's not through the Blackberry Desktop Software that I am transferring PDFs, Word, Excel files onto the Playbook; only media synching is supported at this time by that means. I did it on my PC through Windows Explorer, ie. the normal box you open on your computer when you click on "documents" and see the contents of your computer folders. There, in the left panel if you go down you see "computer", and click on it to display sub-folders, it should show the "Playbook" if you have a good USB connection. If you click on that PlayBook icon you will then see folders of the Playbook, including documents. That's where I pasted the documents, and they were then available to read and edit on the Playbook through Word to Go, Adobe Reader, etc. 
    The problem then (which other strings discuss) is that while you can paste in a set of documents organized in folders with sub-folders, the Playbook only sees the documents as being in a single folder. They apparently will still retain their organization though I haven't checked that.
    There is no way to synchronize in the way that DataViz Documents to Go does on the smartphones, and to me that is a big omission that RIM needs to take care of soon, or more specifically DataViz who I believe RIM owns now. The technology has been there for around 10 years. On my Palm I used to synchronize documents from my PC onto my Palm, work on various documents there, then when I synched again all the changes would automatically update on the documents on my PC. The only way to do this now is manually copy back from the Playbook to the PC, which is only OK if you are just working on one document.

  • How do I save PDF files by default to the folder of the source file?

    How do I save PDF files by default to the folder of the source file with Acrobat 9.0.0 Standard?

    I am not seeing that behaviour. If I right-click a link to a .pdf file, I get the file saved with the original filename.
    Maybe one of the settings in about:config controls that?
    pdfjs.previousHandler.preferredAction is a setting that has a value of 4 with my setup. I have no idea what that means, and I could not find any explanation anywhere. You could try using different numbers for that value and see if any make any difference. Why has nobody bothered to explain that setting anywhere?

  • Print to PDF - using Snow Leopard (Saving a PDF file when printing is not supported. Instead, choose

    i have a PDF form that i created that is used as a custom proposal that my company sends out to potential clients. the form in its editable state is only used internally. we recently upgraded to snow leopard, but prior to the upgrade, we were able to fill the custom proposal form out using adobe reader, and, as you well know, we weren't able to save that edited document as a PDF with the custom form fields filled out. our work around using adobe reader was to print to a pdf using the adobe pdf printer in the printer dialog. with the addition of snow leopard, however, instead of choosing the adobe pdf printer, we were to choose PDF from the bottom left corner, then Save As PDF, and it would spit out an uneditable pdf that then allowed us to email it to the potential client without them being able to edit it as well as have an internal, digital copy for our records instead of having lots of paper floating around (i know this is also doable using security that disallows the client certain editing privileges, but printing to a pdf is much quicker and more efficient, and the pdf security isn't really that secure at its best).
    in any case, i came across this gem of a post here on the support forums that installs another option from the PDF drop down on the bottom left of the print dialog menu that reads Save As Adobe PDF and is supposed to do exactly what i am trying to get it to do...print to a pdf file from adobe reader.
    http://kb2.adobe.com/cps/509/cpsid_50981.html    
    once i updated to acrobat 9.2 (as the link above suggests 9.1), however, the Save As Adobe PDF does appear in the print dialog menu, but it still gives me the same error that acrobat 8 - 9 gave me while using Snow Leopard — Saving a PDF file when printing is not supported. Instead, choose File > Save — and as i've already explained, you can't save an edited pdf form in reader (as i am the only one in the office with acrobat) and still keep the fields as you've entered them in. the only work around is to print to a pdf but is apparently having some recent problems.
    using acrobat, however, i know that i can save the editable pdf as a new file with the fields customized as i have left them, but it still saves it as an editable pdf and the print to a pdf option still remains the best option...that way we have digital copies internally that are uneditable that can be printed at any time or emailed to the client.
    how can i do print to a pdf, based on what i've written above, using snow leopard and acrobat and reader?

    A simple way is to flatten the form fields, which converts the field appearances to regular page contents. You can do this with JavaScript or PDF Optimizer (Advanced > PDF Optimizer > Discard Objects > Flatten form fields). A very nice script that adds a custom menu item can be found here: http://www.uvsar.com/projects/acrobat/flattener/

  • "Save Pdf File" window

    Hi,
    I have an Access 2000 aplication which works fine with Acrobat 8.1.2 Pro
    -you select a product name
    -a PDF file is generated from this product's "Report"
    -and it's sent by mail
    It is a VBA code which stores: folder name, file name, printer name into Windows Registry
    I have migrated the file to Access 2007 and now there is a problem.
    It opens a "Save Pdf file" window and asks me to select a folder and to enter a file name.
    Seems that name and folder retrieve from the registry is not working.
    What is it? What can I do to resolve the problem? Any idea?
    Thanks,

    I searched without success ...How to find it?
    I have this:
    ' Put the output filename where Acrobat could find it
    bSetRegValue HKEY_CURRENT_USER, _
                     "Software\Adobe\Acrobat Distiller\PrinterJobControl", _
                     Find_Exe_Name("application", "C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE"), _
                     sOutputFolder & "\\" & sPDFName

  • How to save pdf file in database

    Dear All,
    my application is forms 6i and database is 8i,requirement is that how to save pdf file in database and users can view through forms

    I'll apologize up front for the length of this post. I have a few database procedures I created that write a file to a BLOB column in a table as well as retrieve the BLOB from the column after it stored there. I have successfully stored many different types of binary file to the database using these procedures - including PDF files. I have not used these procedures in a Form so I can confirm that they will work, but theoretically they should work. I'm including the code for each procedure in this posting - hence the apology for the long post! :-)
    Also, since these procedures reside on the database you will need to use Forms TEXT_IO built-in package to write your file to the server before you can use these procedures to store and retrieve the file from the database.
    These procedures reads and writes a binary file to a table called "LOB_TABLE." You will need to modify the procedure to write to your table.
    -- Author :  Craig J. Butts (CJB)
    -- Name   :  load_file_to_blob.sql
    --        :  This procedure uses an Oracle Directory called "IN_FILE_LOC".  If you
    --           already have a directory defined in the database or would prefer to use
    --           a different Directory name, make sure you modify line 21 to reflect the
    --           new Directory name.
    -- ==================================================================================
    -- History
    -- DATE        WHO         DESCRIPTION
    -- 12/11/07    CJB         Created.
    CREATE OR REPLACE PROCEDURE load_file_to_blob (p_filename IN VARCHAR2) IS
       out_blob    BLOB;
       in_file     BFILE;
       blob_length INTEGER;
       vErrMsg     VARCHAR2(2000);
    BEGIN
       -- set the in_file
       in_file := BFILENAME('IN_FILE_LOC',p_filename);
       -- Get the size of the file
       dbms_lob.fileopen(in_file, dbms_lob.file_readonly);
       blob_length := dbms_lob.getlength(in_file);
       dbms_lob.fileclose(in_file);
       -- Insert a new Record into the tabel containing the
       -- filename specified in P_FILENAME and a LOB_LOCATOR.
       -- Return the LOB_LOCATOR and assign it to out_blob.
       INSERT INTO lob_table (filename, blobdata)
          VALUES (p_filename, EMPTY_BLOB())
          RETURNING blobdata INTO out_blob;
       -- Load the file into the database as a blob.
       dbms_lob.open(in_file, dbms_lob.lob_readonly);
       dbms_lob.open(out_blob, dbms_lob.lob_readwrite);
       dbms_lob.loadfromfile(out_blob, in_file, blob_length);
       -- Close handles to blob and file
       dbms_lob.close(out_blob);
       dbms_lob.close(in_file);
       commit;
       -- Confirm insert by querying the database
       -- for Lob Length information and output results
       blob_length := 0;
       BEGIN
          SELECT dbms_lob.getlength(blobdata) into blob_length
            FROM lob_table
           WHERE filename = p_filename;
       EXCEPTION WHEN OTHERS THEN
          vErrMsg := 'No data Found';
       END;
       vErrMsg := 'Successfully inserted BLOB '''||p_filename||''' of size '||blob_length||' bytes.';
       dbms_output.put_line(vErrMsg);
    END;
    -- Author   :  Craig J. Butts (CJB)
    -- Name     :  write_blob_to_file.sql
    -- Descrip  :  This procedure takes a BLOB object from a database table and writes it
    --             to the file system
    -- ==================================================================================
    -- History
    -- DATE        WHO         DESCRIPTION
    -- 12/11/07    CJB         Created.
    CREATE OR REPLACE PROCEDURE write_blob_to_file ( p_filename IN VARCHAR2 ) IS
       v_blob      BLOB;
       blob_length INTEGER;
       out_file    UTL_FILE.FILE_TYPE;
       v_buffer    RAW(32767);
       chunk_size  BINARY_INTEGER := 32767;
       blob_position INTEGER := 1;
       vErrMsg     VARCHAR2(2000);
    BEGIN
       -- Retrieve the BLOB for reading
       BEGIN
          SELECT blobdata
            INTO v_blob
            FROM lob_table
           WHERE filename = p_filename;
       EXCEPTION WHEN OTHERS THEN
          vErrMsg := 'No data found';
       END;
       -- Retrieve the SIZE of the BLOB
       blob_length := DBMS_LOB.GETLENGTH(v_blob);
       -- Open a handle to the location where you are going to write the blob
       -- Note:  The 'WB' parameter means "Write in Byte Mode" and is only
       --          available in the UTL_FILE pkg with Oracle 10g or later.
       --        USE 'W' instead for pre Oracle 10q databases.
       out_file := UTL_FILE.FOPEN('OUT_FILE_LOC',p_filename, 'wb', chunk_size);
       -- Write the BLOB to the file in chunks
       WHILE blob_position <= blob_length LOOP
          IF ( ( blob_position + chunk_size - 1 ) > blob_length ) THEN
             chunk_size := blob_length - blob_position + 1;
          END IF;
          dbms_lob.read(v_blob, chunk_size, blob_position, v_buffer );
          UTL_FILE.put_raw ( out_file, v_buffer, TRUE);
          blob_position := blob_position + chunk_size;     
       END LOOP;  
    END;Hope this helps.
    Craig...
    -- If my response or the response of another is helpful or answers your question please mark the response accordingly. Thanks!

  • I have just upgraded to OSX 10.6.8 and now I cannot open or save PDF files from the internet. I get a dialogue box saying the QuickTime plugin has failed. I have tried to download the latest plugin but this doesn't work. Can anyone help?

    I have just upgraded to OSX 10.6.8 and now I cannot open or save PDF files from the internet using either Safari or Firefox. I get a dialogue box saying the QuickTime plugin has failed. Can anyone help?

    Is this what you downloaded: iTunes 10.7?
    When the update fails what if any error report do you get, specifically? Please do this before trying again:
    Repair the Hard Drive and Permissions
    Boot from your Snow Leopard Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities menu. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.

  • Avoiding the 'Save PDF File As' dialog when printing to the adobe PDF printer from a service

    Hello, can someone please help.
    I have Adobe Acrobat 8 Pro installed.
    I have an in house application which (among many other things) effectively monitors a directory and prints the file to the default printer. It works fine when run as an application.
    I have set the defaults on the Adobe PDF printer to put the output PDF file into a directory and not to open it so it works silently without prompts.
    When I run my application as a service, it brings up the 'Save PDF File As' dialog and I would like to avoid this. My impression is that if I put the right registry key in then it will work.
    I do not want to do any scripting if I can avoid it.
    Thanks for all constructive help given.

    Thank for your help Bill, but changing settings in the distiller did not seem to work. As my application prints directly to the default application without using anything specific to Acrobat, I was hoping there was a simple way forward. A colleague suggested copying registry entries from the account I logged on as to the S-1-5-18 entry, then rebooting. This had no effect as the prompt still comes up.
    Aandi, I don't have the Acrobat SDK or any experience of it.
    Also I'm not sure where any code/script would sit since the application is stable and so I would rather not change it.
    If it amounts to a few lines of javascript sitting outside the application then that would be of interest.

  • How to remove  "save pdf file as" dialog in startdoc with adobe acrobat 6

    We set up pdfWriter as default printer and hope to generate pdf file with startdoc call. The existing code worked great on Adobe Acrobat 5. However, after we upgraded to Adobe Acrobat 6(complete install), the same code behaved differently. Somehow, startdoc always popped out a "save pdf file as" dialog box and ask for the file path but ignored the input path parameter(the pdf file was generated at the path that user manully input in).
    W do not like this dialog box at all and expect silent action. How to remove this annoying dialog box and make the old code working (taking the parameter as pdf file path)?
    Thanks for your help.
    JD

    Hi
    I accessed to a website from my uni library computer using my student account and download a pdf file in there. However, that pdf file contains a line of words saying "Accessed by ... University Library on 30 Mar 2007". This line is printed vertically and on the left side of the page.
    Do you know how to remove that line? I think the website just embedded that line into the file.
    Please help.
    Thank you very much.
    tuanduy

  • TS1702 I downloaded ibooks to my ipad so I have a place to save PDF files.  I do not get the "open in ibooks" option.  Only get "mail" and "print" option.

    I downloaded ibooks to my ipad so that I can save PDF files to ibooks but I do not get an "open in ibooks" message to select.  When I choose the icon, I only get mail or print option.

    Where are these PDFs coming from?  What do you mean by "save PDF files to ibooks" and then "I do not get an 'open ibooks' message?  If they are saved to ibooks (I assume you used itunes to save a dragged in PDF to the ibooks panel in apps) then you should be able to open and view them in ibooks.  If they are not in ibooks (I'm assuming this is the case, since you want to get an "open in ibooks" option from the *share* icon, right?) then where are they on the mini, which app?

  • HT5925 Can I save pdf files on iCloud?

    Can I save pdf files on iCloud?

    I installed a PDF reader.
    It allows attaching pdf files to my iPod and synching with iTunes.
    But I don't use iCloud, still. I do all backups local to iTunes library.
    However, it should work no matter where or what IF you have files attached to an app that allows files.
    When I make changes to files attached to apps, they change and show under iTunes - tried renaming a file on the computer and changed on iPod.

  • How save pdf files which r in inbox for nooia c503

    how save pdf files which r in inbox for nooia c503

    AFAIK, i do not believe this is possible on Series40 devices such as the own that you use.

  • How to save PDF files on an iPad files

    How do I save PDF files onto an iPad?

    There are several common ways to do this:
    1) Email the files to yourself and choose "Open In" from the mail application by long pressing on the attachment(s)
    2) Use a file sharing service like box.net, dropbox, gdrive or skydrive and choose "open in" from those applications
    3) Use iTunes as I describe in response to this thread: http://forums.adobe.com/thread/992991

Maybe you are looking for

  • Creating a survey in Pages

    I need to create a survey for a research project. I'd like to have checkboxes for participants to select. Having a difficult time trying to figure out how to do this in pages. Is there an easy way to create a survey?

  • How to activate web cam on Satellite C660-C660D?

    I cant get my webcam built in to work on Satellite C660D/C660. Do I need to switch it on or download a driver? Help

  • Can you just sync playlists across 2 macs with identical libraries

    can you just sync playlists across 2 macs with identical libraries. i have done a carbon copy of my home mac itunes library to a work mac.  i'll then switch itunes match on on the home mac, and i am assumign i won't need to redownload everything to m

  • Application profiler

    Hi, My webdynpro application is integrated into portal via iview. I want to run "Application Profiler" (nwa -> Analysis -> performance) to analyse the amount of time needed to invoke methods in the web dynpro. Unfortunately, after i start profiling (

  • Why my minimized JFrame dosen't blink...

    Hi, i m trying to built a small local messenger where i am opening a new window by clicking on the user name as like normal messenger... no my problem is that if the chat window that appears after clicking on username is mimimized and some it receive