Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Scripting button to print LiveCycle form (XML) to PDF - getting "Access denied" error

akgrimes
Level 3
Level 3

I have a dynamic form that goes through a workflow. When the workflow is done and the form is complete, I need the final user to "finalize" it by printing it to PDF so that the dynamic properties are removed. We store these PDFs in a system that can't work with dynamic PDFs.

When I place a print button, clicking the button does bring up a print dialog box. However, when I choose "Adobe PDF" as my printer, it says "Access denied." When I try to print that version by clicking File/Print/Adobe PDF it will print a static PDF.

When I have a version of the form without a print button, I can also click File/Print/Adobe PDF to print a static PDF.

Is there a way to program a button to allow users to click, get a print dialog box, and print to PDF?

I would prefer a button that gets the user to the point of choosing Adobe PDF as the printer over displaying a message box to users telling them how to print to PDF using File/Print/Adobe PDF, but that's the only workaround I can think of.

0 Replies
radzmar
Level 10
Level 10

What script do you use within your print button?

akgrimes
Level 3
Level 3

xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);

This is the script when I place a print button on the form.

radzmar
Level 10
Level 10

Weird, the script is just the default script of the print button ans should work.

Did you test if the error also occurs of another users computer? It's possibly just a local problem.

I found a few threads regarding ths problem you should check:
adobe xi std will not print to pdf access denied
How to fix broken "Print to AdobePDF" ?

You also can try a custom script like

var pp = event.target.getPrintParams();

    pp.printerName = "Adobe PDF";

event.target.print(pp);

or just

app.execMenuItem("Print");

akgrimes
Level 3
Level 3

Thank you!! This worked like a charm!

  1. var pp = event.target.getPrintParams(); 
  2.     pp.printerName = "Adobe PDF"
  3. event.target.print(pp);