Using an Excel sheet or .csv file to automatically update form information in Acrobat










1














I would like to populate form fields in a pdf automatically by reading from an excel sheet.



For example, if I have a field in a pdf document called "Address", and I have an excel sheet in the same folder with a cell containing the "Address", I would like the field in the pdf to automatically update if someone changes the address cell in the excel sheet.



I am aware that you can import an excel sheet into Acrobat Pro manually, but I would like this to happen automatically when the document opens.



I have been looking into using Acrobat's javascript, but am unable to get a sense of how to use it for this application.



If I haven't made myself clear, please feel free to ask and I will try clarify.



Cheers










share|improve this question





















  • Welcome to Stack Overflow! Please take the tour, look around, and read through the Help Center, in particular How do I ask a good question? If you run into a specific problem, research it thoroughly, search thoroughly here, and if you're still stuck post your code and a description of the problem. Also, remember to include Minimum, Complete, Verifiable Example. People will be glad to help
    – Andreas
    Nov 12 '18 at 5:37















1














I would like to populate form fields in a pdf automatically by reading from an excel sheet.



For example, if I have a field in a pdf document called "Address", and I have an excel sheet in the same folder with a cell containing the "Address", I would like the field in the pdf to automatically update if someone changes the address cell in the excel sheet.



I am aware that you can import an excel sheet into Acrobat Pro manually, but I would like this to happen automatically when the document opens.



I have been looking into using Acrobat's javascript, but am unable to get a sense of how to use it for this application.



If I haven't made myself clear, please feel free to ask and I will try clarify.



Cheers










share|improve this question





















  • Welcome to Stack Overflow! Please take the tour, look around, and read through the Help Center, in particular How do I ask a good question? If you run into a specific problem, research it thoroughly, search thoroughly here, and if you're still stuck post your code and a description of the problem. Also, remember to include Minimum, Complete, Verifiable Example. People will be glad to help
    – Andreas
    Nov 12 '18 at 5:37













1












1








1







I would like to populate form fields in a pdf automatically by reading from an excel sheet.



For example, if I have a field in a pdf document called "Address", and I have an excel sheet in the same folder with a cell containing the "Address", I would like the field in the pdf to automatically update if someone changes the address cell in the excel sheet.



I am aware that you can import an excel sheet into Acrobat Pro manually, but I would like this to happen automatically when the document opens.



I have been looking into using Acrobat's javascript, but am unable to get a sense of how to use it for this application.



If I haven't made myself clear, please feel free to ask and I will try clarify.



Cheers










share|improve this question













I would like to populate form fields in a pdf automatically by reading from an excel sheet.



For example, if I have a field in a pdf document called "Address", and I have an excel sheet in the same folder with a cell containing the "Address", I would like the field in the pdf to automatically update if someone changes the address cell in the excel sheet.



I am aware that you can import an excel sheet into Acrobat Pro manually, but I would like this to happen automatically when the document opens.



I have been looking into using Acrobat's javascript, but am unable to get a sense of how to use it for this application.



If I haven't made myself clear, please feel free to ask and I will try clarify.



Cheers







javascript acrobat






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 '18 at 5:30









M.ArmstrongM.Armstrong

61




61











  • Welcome to Stack Overflow! Please take the tour, look around, and read through the Help Center, in particular How do I ask a good question? If you run into a specific problem, research it thoroughly, search thoroughly here, and if you're still stuck post your code and a description of the problem. Also, remember to include Minimum, Complete, Verifiable Example. People will be glad to help
    – Andreas
    Nov 12 '18 at 5:37
















  • Welcome to Stack Overflow! Please take the tour, look around, and read through the Help Center, in particular How do I ask a good question? If you run into a specific problem, research it thoroughly, search thoroughly here, and if you're still stuck post your code and a description of the problem. Also, remember to include Minimum, Complete, Verifiable Example. People will be glad to help
    – Andreas
    Nov 12 '18 at 5:37















Welcome to Stack Overflow! Please take the tour, look around, and read through the Help Center, in particular How do I ask a good question? If you run into a specific problem, research it thoroughly, search thoroughly here, and if you're still stuck post your code and a description of the problem. Also, remember to include Minimum, Complete, Verifiable Example. People will be glad to help
– Andreas
Nov 12 '18 at 5:37




Welcome to Stack Overflow! Please take the tour, look around, and read through the Help Center, in particular How do I ask a good question? If you run into a specific problem, research it thoroughly, search thoroughly here, and if you're still stuck post your code and a description of the problem. Also, remember to include Minimum, Complete, Verifiable Example. People will be glad to help
– Andreas
Nov 12 '18 at 5:37












1 Answer
1






active

oldest

votes


















0














In Excel I would set up a cell onChange event for the cell which contain the address. If the cell value changes you can call acrobat and fill the form with the new value. Attached the vbs/vba subroutine code you need in xls to fill the form in a pdf.



Help and background info you will find in the Adobe Acrobat SDK, IAC section. Good luck, Reinhard



fileIn = "D:Test2.pdf" '// state the full path of the file to open
xlsCellValue = "newAddress" '// value you want to set

Set App = CreateObject("AcroExch.App") '// start Adobe Acrobat
App.Show '// show Acrobat or comment out for hidden mode

Set AVDoc = CreateObject("AcroExch.AVDoc") '// connect to Ac Viewer
if AVDoc.Open(fileIn,"") then '// Open a file into viewer
Set PDDoc = AVDoc.GetPDDoc '// Get the Doc opened in the viewer
set jso = PDDoc.GetJSObject '// Connect to Acrobat JS
set xf = jso.getField("Address") '// get field object
xf.value = xlsCellValue '// set field value
jso.app.alert(xf.value) '// Display new value in a MsgBox
PDDoc.save 1, fileIn '//save the file
end if

App.CloseAllDocs '// close active documents
App.exit





share|improve this answer




















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256381%2fusing-an-excel-sheet-or-csv-file-to-automatically-update-form-information-in-ac%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    In Excel I would set up a cell onChange event for the cell which contain the address. If the cell value changes you can call acrobat and fill the form with the new value. Attached the vbs/vba subroutine code you need in xls to fill the form in a pdf.



    Help and background info you will find in the Adobe Acrobat SDK, IAC section. Good luck, Reinhard



    fileIn = "D:Test2.pdf" '// state the full path of the file to open
    xlsCellValue = "newAddress" '// value you want to set

    Set App = CreateObject("AcroExch.App") '// start Adobe Acrobat
    App.Show '// show Acrobat or comment out for hidden mode

    Set AVDoc = CreateObject("AcroExch.AVDoc") '// connect to Ac Viewer
    if AVDoc.Open(fileIn,"") then '// Open a file into viewer
    Set PDDoc = AVDoc.GetPDDoc '// Get the Doc opened in the viewer
    set jso = PDDoc.GetJSObject '// Connect to Acrobat JS
    set xf = jso.getField("Address") '// get field object
    xf.value = xlsCellValue '// set field value
    jso.app.alert(xf.value) '// Display new value in a MsgBox
    PDDoc.save 1, fileIn '//save the file
    end if

    App.CloseAllDocs '// close active documents
    App.exit





    share|improve this answer

























      0














      In Excel I would set up a cell onChange event for the cell which contain the address. If the cell value changes you can call acrobat and fill the form with the new value. Attached the vbs/vba subroutine code you need in xls to fill the form in a pdf.



      Help and background info you will find in the Adobe Acrobat SDK, IAC section. Good luck, Reinhard



      fileIn = "D:Test2.pdf" '// state the full path of the file to open
      xlsCellValue = "newAddress" '// value you want to set

      Set App = CreateObject("AcroExch.App") '// start Adobe Acrobat
      App.Show '// show Acrobat or comment out for hidden mode

      Set AVDoc = CreateObject("AcroExch.AVDoc") '// connect to Ac Viewer
      if AVDoc.Open(fileIn,"") then '// Open a file into viewer
      Set PDDoc = AVDoc.GetPDDoc '// Get the Doc opened in the viewer
      set jso = PDDoc.GetJSObject '// Connect to Acrobat JS
      set xf = jso.getField("Address") '// get field object
      xf.value = xlsCellValue '// set field value
      jso.app.alert(xf.value) '// Display new value in a MsgBox
      PDDoc.save 1, fileIn '//save the file
      end if

      App.CloseAllDocs '// close active documents
      App.exit





      share|improve this answer























        0












        0








        0






        In Excel I would set up a cell onChange event for the cell which contain the address. If the cell value changes you can call acrobat and fill the form with the new value. Attached the vbs/vba subroutine code you need in xls to fill the form in a pdf.



        Help and background info you will find in the Adobe Acrobat SDK, IAC section. Good luck, Reinhard



        fileIn = "D:Test2.pdf" '// state the full path of the file to open
        xlsCellValue = "newAddress" '// value you want to set

        Set App = CreateObject("AcroExch.App") '// start Adobe Acrobat
        App.Show '// show Acrobat or comment out for hidden mode

        Set AVDoc = CreateObject("AcroExch.AVDoc") '// connect to Ac Viewer
        if AVDoc.Open(fileIn,"") then '// Open a file into viewer
        Set PDDoc = AVDoc.GetPDDoc '// Get the Doc opened in the viewer
        set jso = PDDoc.GetJSObject '// Connect to Acrobat JS
        set xf = jso.getField("Address") '// get field object
        xf.value = xlsCellValue '// set field value
        jso.app.alert(xf.value) '// Display new value in a MsgBox
        PDDoc.save 1, fileIn '//save the file
        end if

        App.CloseAllDocs '// close active documents
        App.exit





        share|improve this answer












        In Excel I would set up a cell onChange event for the cell which contain the address. If the cell value changes you can call acrobat and fill the form with the new value. Attached the vbs/vba subroutine code you need in xls to fill the form in a pdf.



        Help and background info you will find in the Adobe Acrobat SDK, IAC section. Good luck, Reinhard



        fileIn = "D:Test2.pdf" '// state the full path of the file to open
        xlsCellValue = "newAddress" '// value you want to set

        Set App = CreateObject("AcroExch.App") '// start Adobe Acrobat
        App.Show '// show Acrobat or comment out for hidden mode

        Set AVDoc = CreateObject("AcroExch.AVDoc") '// connect to Ac Viewer
        if AVDoc.Open(fileIn,"") then '// Open a file into viewer
        Set PDDoc = AVDoc.GetPDDoc '// Get the Doc opened in the viewer
        set jso = PDDoc.GetJSObject '// Connect to Acrobat JS
        set xf = jso.getField("Address") '// get field object
        xf.value = xlsCellValue '// set field value
        jso.app.alert(xf.value) '// Display new value in a MsgBox
        PDDoc.save 1, fileIn '//save the file
        end if

        App.CloseAllDocs '// close active documents
        App.exit






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 13 '18 at 17:27









        ReFranReFran

        687512




        687512



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256381%2fusing-an-excel-sheet-or-csv-file-to-automatically-update-form-information-in-ac%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Use pre created SQLite database for Android project in kotlin

            Darth Vader #20

            Ondo