How to add text to a pdf file using Access VBA??

I'm down on my hands and knees, begging.  I have 300 files that I want to put a variable string at the top of the first page (centered, or at the right hand side).  I am using Acrobat X and Microsoft Access 2010 and I do have the SDK and have spend over 10 hours so far searching it and the internet in general, for help and still am coming up empty handed. 
I can do the looping and passing variables with my eyes closed, but I cannot get the syntax for the actual opening of the pdf and inserting the string. 
I was trying to modify code I found yesterday that is supposed to add an annotation, but I don't want an annotation, I just want a string of text at the top of page 1. For now, all I want is to be successful at doing ONE file.  Can someone please give me a concrete example of the code I need to use?  Like I said, I'm in begging mode
Public Sub AddText()
    Dim pdDoc As Acrobat.AcroPDDoc
    Dim page As Acrobat.AcroPDPage
    Dim annot As Acrobat.AcroPDAnnot
    Dim jso As Object
    Dim strPath As String
    Dim intpoint(1) As Integer
    Dim intpopupRect(3) As Integer
    Dim props As Object
    Set pdDoc = CreateObject("AcroExch.PDDoc")
    pdDoc.Open ("c:\Test\Test.pdf")
    Set page = pdDoc.AcquirePage(0)
    'Set annot = page.AddAnnot(0)
    intpoint(0) = 0
    intpoint(1) = page.GetSize.y
    intpopupRect(0) = 0
    intpopupRect(1) = page.GetSize.y - 100
    intpopupRect(2) = 200
    intpopupRect(3) = page.GetSize.y
    annot.SetColor (vbRed)
    annot.SetContents "JCPC - 22 - 2011050000001"
    pdDoc.Save 1, "c:\Test\Test.pdf"
    pdDoc.Close
    Set pdDoc = Nothing
    MsgBox "Done"
End Sub

You cannot skip arguments, you can either use the function with one
argument (just the required argument), or you have to provide all of them.
Also, it looks like you are trying to specify 20 parameters, even though
the function only takes 19. Try the following:
Call jso.addWaterMarkFromText("Test Text", jso.app.Constants.Align.Center,
jso.Font.Helv, 16, _
    jso.Color.Black, 0, 0, True, True, True, _
    jso.app.Constants.Align.Center, jso.app.Constants.Align.Center, _
    100, 100, False, 1, False, 0, 1)
I just typed this in without running it through the compiler, so there may
be typos in the code, but you should get the idea of how the code is
supposed to look like.
Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
[email protected]
http://www.khkonsulting.com
On Fri, Jul 26, 2013 at 1:55 PM, I Love Mustangs

Similar Messages

  • How to extract text from a PDF file using php?

    How to extract text from a PDF file using php?
    thanks
    fabio

    > Do you know of any other way this can be done?
    There are many ways. But this out of scope of this forum. You can try this forum: http://forum.planetpdf.com/

  • How to add text to a pdf file?

    I was sent a rental application as a pdf file which I need to fill in but I can't seem to add text to it.
    How does one open a pdf file and add text to it?
    I have acrobat professional that came with adobe cs3 on my mac.
    Thanks for any advice.

    If you don't have the original and need a word version that you can edit.
    Open PDF  go to Save As... choose Word and then choose format.
    See this: http://www.screencast.com/t/igS0SoMDri
    Note: this only works with text based files.
    once its converted you can edit to you heart's content.  Then once edited as need create a new PDF with a different name.
    Open the Acrobat original Document Click on On Tools (if AcrobatX) and choose replace Pages and choose your new pdf as source. the choose desired pages or choose entire document.
    If you have any form Fileds and they have been displaced choose edit Form, click on each field in turn than needs moving, use up down right or left arrow keys to nudge the elements to desired position.
    If you have have a Form that has extended reader rights you have to remove those right by saving a copy without rights. Then onece editting completed you have to add rights.

  • How do I add text to existing PDF files using Acrobat Pro10.1?

    I upgraded to Acrobat Pro just so that I would be able to complete blank forms send to me as PDF files.  But sometimes I can edit them and sometimes I cannot.  And the "help" does mention anything as ordinary as form filling.
    FoxLuca

    Phillip,
    Thanks for letting me know.  I see that under Save as PDF there are several
    options and to I chose the "reader extended PDF" and "enable adding text to
    non-fillable forms.
    John

  • How to extract text from a PDF file?

    Hello Suners,
    i need to know how to extract text from a pdf file?
    does anyone know what is the character encoding in pdf file, when i use an input stream to read the file it gives encrypted characters not the original text in the file.
    is there any procedures i should do while reading a pdf file,
    File f=new File("D:/File.pdf");
                   FileReader fr=new FileReader(f);
                   BufferedReader br=new BufferedReader(fr);
                   String s=br.readLine();any help will be deeply appreciated.

    jverd wrote:
    First, you set i once, and then loop without ever changing it. So your loop body will execute either 0 times or infinitely many times, writing the same byte every time. Actually, maybe it'll execute once and then throw an ArrayIndexOutOfBoundsException. That's basic java looping, and you're going to need a firm grip on that before you try to do anything as advanced as PDF reading. the case.oops you are absolutely right that was a silly mistake to forget that,
    Second, what do the docs for getPageContent say? Do they say that it simply gives you the text on the page as if the thing were a simple text doc? I'd be surprised if that's the case.getPageContent return array of bytes so the question will be:
    how to get text from this array? i was thinking of :
        private void jButton1_actionPerformed(ActionEvent e) {
            PdfReader read;
            StringBuffer buff=new StringBuffer();
            try {
                read = new PdfReader("d:/getjobid2727.pdf");
                read.getMetaData();
                byte[] data=read.getPageContent(1);
                int i=0;
                while(i>-1){ 
                    buff.append(data);
    i++;
    String str=buff.toString();
    FileOutputStream fos = new FileOutputStream("D:/test.txt");
    Writer out = new OutputStreamWriter(fos, "UTF8");
    out.write(str);
    out.close();
    read.close();
    } catch (Exception f) {
    f.printStackTrace();
    "D:/test.txt"  hasn't been created!! when i ran the program,
    is my steps right?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to add a table to pdf file ?

    How to add a table to pdf file ?
    Not able to use the table component. Its not active.
    Any help pls
    Thanks
    Peter
    http://www.ethos.ag

    http://forum.java.sun.com/faq.jsp#format

  • How can i scan to a pdf file using hp officejet 4500 scan feature

    how can i scan to a pdf file using hp officejet 4500 scan feature.  only give a jpg or bit extension

    pf1tarac wrote: how can i scan to a pdf file using hp officejet 4500 scan feature.  only give a jpg or bit extension
    Hello pf1tarac, I don't believe that is possible. In order to create a PDF file, you would need Adobe Acrobat or some other PDF compatible product to save a scan to the PDF format.
    There are some free PDF programs available.  Here  is a link to one of them.
    Please click the White Kudos star on the left, to say thanks.
    Please mark Accept As Solution if it solves your problem.

  • Pdf files - how can I add text to a pdf file

    I want to allow my Google group to fill info out on a Numbers form, but the Mac users evidently don't have Numbers. I sent it to them as a pdf file, but text can't be added to it as a pdf file. There has got to be a way. I tried using Tools - annotate - add text, but that didn't really work. Any help?

    Because you are recent switcher to OS X I'd strongly recommend bookmarking and using these links, they're designed for those that have recent made the switch and for this considing it.
    Mac 101
    Switch 101
    Find Out How Video tutorials
    List of Useful URLs for switchers

  • How to edit or add text to a PDF file from an e mail

    I would like to open a PDF file from an e mail received to work the file to edit and or add text, my e mail service is  LIVE.CA  (hot mail), I have Iwork 09 

    You can convert the PDF text to regular text (.txt) and then import/open into another program and make your changes, then save the file in the programs format (for your later editing) and then choose Print from the program and there may/may not be a option to save as PDF again.
    You'll need a free (limited use) PDF to text utility like
    PDF OCR
    http://solutions.weblite.ca/pdfocrx/
    Trouble here of course is you lose all the formatting and have to reformat, but it's a lot less expensive than Adobe's software.
    LibreOffice is free to use and can save as PDF format if iWork doesn't save as PDF, it should unless Apple is really peeved at Adobe.

  • How does full-text search for pdf files work?

    Hi there,
    Basically I can see my pdf file in the content server.. inside the pdf there's a piece of test that says: "Test's Sample" but when I do a search with that string the file gets filtered from the results.
    I think it has to do with the ' (single quote) being there because other text in the pdf works fine.. so I was wondering how does VDK store this full text? where? I'd like to see how it gets translated IF that's how it works with pdf files....
    Following advice from Re: Parse error with search query I tried doing the search by:
    Test\'s Sample
    Test`s Sample
    "Test's Sample"
    The database is db2 if that helps.. how can I fix this problem?

    Nevermind, I fixed it by changing the VDK filters (in case someone is looking for a solution too).
    Cheers,

  • How [Insert|Add] Image into Opening PDF file with Acrobat SDK.

    Hi Guys,
    I'm trying to insert|add image file into opening PDF file with specified location (X|Y) and scale (Width|Hight) but got many of troubles
    If use third party like iTextSharp or something else thing become simple but i want to use Acrobat SDK to do this
    Any suggestion or idea?
    Any help appreciated.

    Thank for your interested.
    I use VB.NET and Acrobat
    Here is some my code:
    Try
       If File.Exists(T(0)) Then
       Dim AcroAVDoc As AcroAVDoc = Ap.GetActiveDoc
       Dim AcroPDDoc As AcroPDDoc = AcroAVDoc.GetPDDoc
       Dim AcroPDPage As Acrobat.AcroPDPage = AcroPDDoc.AcquirePage(Integer.Parse(T(3)))
       Dim data() As String = T(1).Split("^")
       Dim imgX = data(0)
       Dim imgY = data(1)
       Dim imgWidth = data(3)
       Dim imgHight = data(4)
       'TODO: insert into opening PDF file
       Return 1
       End If
       Catch ex As Exception
       End Try
    I don not know what to do next to insert an image (JPEG, PNG, ..) into PDF file.
    Can you show me or suggest some solution, idea?
    Thank in advance.

  • Software to add text/fill in PDF file

    Hi,
    Been using my MacBookPro about a year now, after 30 years in PC-land. Is there any software that came with the system (Snow Leopard) that allows me to fill in forms (write on top of a PDF form) so I can print out the form typed, instead of filling in the form by hand after printing it?
    I know I won't be able to modify the form, I'd just like to fill it in with type.
    Thanks!

    East Coast user wrote:
    Is there any software that came with the system (Snow Leopard) that allows me to fill in forms (write on top of a PDF form) so I can print out the form typed, instead of filling in the form by hand after printing it?
    Sure! Open the PDF in Preview, go to Tools > Annotate > Add Text.
    When you are done, print it or print it to a new PDF.

  • How can I auto export a PDF File using the "Smallest File Size" preset and set the Exported File Name based on information from an Imported PDF?

    Greetings all,
    I am trying to create a script to automate a PDF export process for my company for inDesign. I’m fairly new to inDesign itself and have no previous experience with javascript, although I did take C++ in high school and have found it helpful in putting this code together.
    We have an inDesign template file and then use the Multi-page PDF importer script to import PDF files. We then have to export two version of each file that we import, then delete the imported file and all of the pages to reset the template. This has to be done for nearly 1000 pdf files each month and is quite tedious. I’m working on automating the process as much as possible. I’ve managed to piece together code that will cleanup the file much quicker and am now trying to automate the PDF exports themselves.
    The files are sent to us as “TRUGLY#####_Client” and need to be exported as “POP#####_Client_Date-Range_North/South.pdf”
    For example, TRUGLY12345_Client needs to be exported as POP12345_Client_Mar01-Mar31_North and POP12345_Client_Mar01-Mar31_South.
    There are two templates built into the template file for the north and south file that are toggled easily via layer visibility switches. I need to get a code that can ideally read the #s from the imported Trugly file as well as the Client and input those into variables to use when exporting. The date range is found in the same place in the top right of each pdf file. I am not sure if this can be read somehow or if it will have to be input manually. I can put North or South into the file name based on which template layer is visible.
    I am not sure how to go about doing this. I did find the following code for exporting to PDF with preset but it requires me to select a preset and then type the full file name. How can I set it to automatically use the “Smallest File Size” preset without prompting me to choose and then automatically input some or preferably all of the file name automatically? (If the entire filename is possible then I don’t even want a prompt to appear so it will be fully automated!)
    PDF Export Code (Originally from here: Simple PDF Export with Preset selection | IndiSnip [InDesign® Snippets]):
    var myPresets = app.pdfExportPresets.everyItem().name;
    myPresets.unshift("- Select Preset -");
    var myWin = new Window('dialog', 'PDF Export Presets');
    myWin.orientation = 'row';
    with(myWin){
        myWin.sText = add('statictext', undefined, 'Select PDF Export preset:');
        myWin.myPDFExport = add('dropdownlist',undefined,undefined,{items:myPresets});
        myWin.myPDFExport.selection = 0;
        myWin.btnOK = add('button', undefined, 'OK');
    myWin.center();
    var myWindow = myWin.show();
    if(myWindow == true && myWin.myPDFExport.selection.index != 0){
        var myPreset = app.pdfExportPresets.item(String(myWin.myPDFExport.selection));
        myFile = File(File.saveDialog("Save file with preset: " + myPreset.name,"PDF files: *.pdf"));
        if(myFile != null){
            app.activeDocument.exportFile(ExportFormat.PDF_TYPE, myFile, false, myPreset);
        }else{
            alert("No File selected");
    }else{
        alert("No PDF Preset selected");
    So far my code does the following:
    1) Runs the Multi-Page PDF Import Script
    2) Runs PDF Export Script Above
    3) Toggles the Template
    4) Runs #2 Again
    5) Deletes the imported PDF and all pages and toggles template again.
    It’s close and much better than the original process which was almost 100% manual but I’d like to remove the Preset prompt from the PDF script and have it automatically select the “Smallest File Size” preset. and then if there’s a way to have it auto-fill in the file name so no user input is required at all other than selecting each file to import. (If there’s a way to setup a batch action for the multi-import script that would be even better!)
    Thanks in advance and if there’s anything else I can provide that would help please let me know! Even a nudge in the right direction will be a big help!

    If you hold down the option key, it will typically show the location. Or you can often hit option-return on the file and it will reveal the file in the Finder, instead of opening it.
    Final option is to open it, and just option-click the filename in the toolbar of Preview and it should show you the location.
    It's probably an attachment to an email you've received. If you have Mail set to cache emails and their attachments it'll be stashed in a subdirectory of ~/Library/Mail. Which is fine.

  • Add bookmarks to pdf file using Excel VBA

    Good morning -
    I have, through internet searches, created an Excel macro that prints numerous workbooks to pdf, combines them into one file and prints that file.  I have been searching for the last piece, which is adding bookmarks, but have not had any luck getting any of it to work.  The following is the code that I am using to add the bookmarks -
    Dim avdoc, pddoc, app As Object
    Dim stFile As String
    Dim btitle As Boolean
    Dim PDBookmark As CAcroPDBookmark
    stFile = "D:\Test\Test.pdf"
    Set app = CreateObject("AcroExch.app")
    Set avdoc = CreateObject("AcroExch.AVDoc")
    Set pddoc = CreateObject("AcroExch.PDDoc")
    pddoc.Open stFile
    Set avdoc = pddoc.OpenAVDoc(stFile)
    Set PDBookmark = CreateObject("AcroExch.PDBookmark", "")
    app.MenuItemExecute ("NewBookmark")
    btitle = PDBookmark.SetTitle("Test Bookmark")
    This code does insert a bookmark on the first page of the document.  The bookmark title displays as Untitled instead of Test Bookmark as the code states.  Can someone answer the following questions -
    1.  Why is the code not changing the bookmark from Untitled to Test Bookmark, and
    2.  How would I nodify the above code to go to a certain page then enter the bookmark.
    All help is greatly appreciated.  Thanks in advance for your time.

    Good morning Reinhard -
    Thanks you very much for the help.  I implemented as follows:
    1.  app.MenuItemExecute ("NewBookmark")
    btitle = PDBookmark.GetByTitle(pddoc, "Untitled")
    btitle = PDBookmark.SetTitle("Total Accessories / Hardgoods")
    I added the "btitle =" due to it erroring out.  However, when I step through the code and get to that line, I get the "Excel has encountered an error and needs to close" error.  Is there a reference that I'm missing that you know of?
    2.  I was able to find the code to get to a specific page number and it is working great.
    Thanks again for all of your assistance.

  • How can I add text to a pdf

    How can I add additonal text to a saved pdf?

    Hi remax13
    You Need Adobe Acrobat to Add Text to your PDf files. Two Ways to do this.
    1. Convert your PDf to Native file like word, Excel
    2. Make Changes in the output file
    3. Convert it back to PDF
    Or
    See the below link to use the Add Text and Edit Text Tool in Acrobat.
    http://help.adobe.com/en_US/acrobat/X/pro/using/WS2DE764BD-5706-4e3a-9360-5F2F968223AC.w.h tml

Maybe you are looking for

  • Field value selection on a selection screen

    Hi expert, I have a requirement. In a selection screen say there are 4 fields let say f1, f2, f3, f4.  Now If a select a value of f1 in the selection screen based on the value of f1,  other fields (f2, f3, f4 ) will be populated. How can i do that? A

  • Account Assignment Category in ME51N

    Hi All, I am facing a problem in the t.code me51n with account assignment category.If i press f4 i am getting a new window in that i can make any entry as default entry. So, actully in our project we r having around 22 entries. So, in that wat ever i

  • System config network error while parsing /etc/hosts

    I am configuring RAC on Oracle Linux,i have configured /etc/hosts on both nodes,when ever i opened network, its displaying error message. system config network error while parsing /etc/hosts wrong ip on line 25 wrong ip on line 26 wrong ip on line 27

  • Download not available?

    Hi, i tried downloading jdeveloper 11g preview 3 and get http://www.oracle.com/webapps/dialogue/dlgpage.jsp: We're sorry. An unexpected exception has occurred when contacting Database. Cannot proceed further. You can change or re-visit previous page(

  • Accessing SAP via a WebGUI

    We shall be teaching a SAP-related course to the students who are registered for a Masters degree by u2018distance learningu2019. In other words, these students do not actually visit the University classrooms but they get their course material on-lin