1

I am using PDFObject to embed a PDF with form fields in a html page.

I would like to add a button to the page, which will cause acrobat to submit the fields back to the web server. If I was doing this within the PDF, it would look like this

Here is what I have so far, which throws an exception, because pdf does not contain a property called doc.

$(document).ready(function () {
            var pdf = new PDFObject({ url: "test.pdf" }).embed("pdf");

            $("#savebutton").button({ icons: { primary: "ui-icon-disk" }, text: true, label: "Save" });

            $("#saveButton").click(function () {
                pdf.doc.submitForm("submiturl", false);
            });
        });

So the crux of the question, how do I get access to the "doc" object within the pdf's DOM, from the page. Is this even possible?

Community
  • 1
  • 1
Brook
  • 5,949
  • 3
  • 31
  • 45

1 Answers1

1

I think the only way to interact with an embedded pdf is using .postMessage(), e.g.

var pdf = document.getElementById("PDFObj");
pdf.postMessage([message]);

Then you need some JavaScript in the PDF (yes, you can do that, but have fun figuring it out) to catch it.

nwellcome
  • 2,279
  • 15
  • 23