Using Excel VBA to add text to a PDF file
I am trying to open a PDF file with Excel 2013 by using VBA and then adding text to specific locations on the PDF.
I have Adobe Acrobat 9 Pro installed on a Windows 7 PC with Office 2013.
Thanks in advance.
I am trying to open a PDF file with Excel 2013 by using VBA and then adding text to specific locations on the PDF.
I have Adobe Acrobat 9 Pro installed on a Windows 7 PC with Office 2013.
Thanks in advance.
@lrosenth is certainly right about Acrobat 9 no longer being supported by Adobe (neither is Acrobat X), but that does not mean that you are on your own. This forum is frequented mostly by users of Adobe's applications, and that means we don't care much about Adobe's support policy.
The good news is that whatever works with Acrobat DC and VBA should also work with Acrobat 9 (at least regarding the task you want to perform).
The bad news is that there is no functionality in the IAC (Interapplication Communication) API that would allow you to create static PDF content outright. If you want to do that, you need to use the Acrobat plug-in interface and create a plug-in (that requires C/C++). You can however create form fields and annotations (which are dynamic content), and then flatten this dynamic content to convert it to static PDF content. All this can be done using a combination of native IAC functionality and functionality from the JavaScript API that you access via the JSObject. See here for an example of how to use the the JSObject: Adobe Acrobat and VBA - An Introduction - KHKonsulting LLC
The only problem with this approach is that if your document already has some dynamic content, you would need to perform a selective flattening, and that complicates things quite a bit.
Take a look at these JavaScript methods:
Doc.addField() - Add a form field: Acrobat DC SDK Documentation
Doc.addAnnot() - Add an annotation: Acrobat DC SDK Documentation
Doc.flattenPage() - flatten one or more pages: Acrobat DC SDK Documentation
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.