Showing results for 
Search instead for 
Did you mean: 

Acrobat SaveAs

Hi All,


I'm trying to convert PDF files to MS Word so that I can easily add a Table of Contents, headers/footers, etc.  This is part of a packet creation tool that I'm developing that collect various types of files, converts them to PDF and merges them into a single PDF.  Currently I have everything working.  The tool can convert any of our file types to PDF and merge them.  I am even able to add bookmarks in the PDF via creating Word files with headings and exporting those to PDF.  That sort of serves as a TOC.  But I can't quite figure out how to add headers, footers, page numbers and TOC to the final merged PDF.  If I could get all of my files into MS Word format first, it has the ability to do all this.  The problem that I'm having is with files that are already in PDF format.  If I use the MS Word API to convert them to Word, it reformats and moves things around.


So I found that if I use the SaveAs function in full Adobe Acrobat, it can convert the PDF files to Word and preserve all the formatting.  But the Acrobat API is a lot harder to use than MS Office.  I found some code that can supposedly be used to do this, but it is very confusing trying to convert it to LabVIEW and I'm not even sure you can. 

Here is the code and the VI is attached...


AcroPDDoc pdfd = new AcroPDDoc();
 Object jsObj = pdfd.GetJSObject();
 Type jsType = pdfd.GetType();
 //have to use acrobat javascript api because, acrobat
 object[] saveAsParam = { "newFile.doc", "com.adobe.acrobat.doc", "", false, false };
 jsType.InvokeMember("saveAs",BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance,null, jsObj, saveAsParam, CultureInfo.InvariantCulture);


It wouldn't let me add a constructor for the Binder method, so the only way I could get Run to light up was with a feedback node... not sure exactly how noobish that was... but I'm guessing it was.


I may be completely in noob land here... but I kept finding stuff that matched what some of the documentation online was describing and it made me feel like I might be on the right path.  At a certain point I had to give up though.


I am open to suggestions for other methods of getting page numbers, headers/footers and working hyperlinks into a merged PDF of PDF files.  Bookmarks work, but hyperlinks to bookmarks only seem to work within the sections of the individual PDFs.  It's almost like the PDFs within the merged one are still treated as individuals and hyperlinks between them won't work. 


I'm currently using some DLLs called Expert PDF Merge and HTML to PDF to create PDFs.  I just don't have many options for editing files that already are PDF.






0 Kudos
Message 1 of 2



Yes, the interface to Adobe software is not easily navigated. That's why you will see many 3rd party interfaces to provide the functionality to Adobe software.


It looks like you are on the correct path, but one thing I notice is that you have an ActiveX interface and a subVI to convert JSObject to a .net reference. Unfortunately, this will not work as the interface to Adobe Acrobat is ActiveX.


I wrote a small program to get the page number, but I cannot seem to find the ActiveX definition for the JSObject reference. If someone could help with that and the methods associated, then we can get one step closer.

0 Kudos
Message 2 of 2