Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Control Pages That Print

New Here ,
Jan 10, 2021 Jan 10, 2021

I have an evidence form I want to be able to control specific printing sequences when the user presses print.  Can anyone help me out with code, or point me in the direction, that does the following:

 

  • Disable the ability to print from the menu or Ctrl-P so that the user only has the option to use the print button.  I want to add additional code to this button to check that the document is completed before submission.
  • When the print button is pressed on the form the first page is sent and then a message box comes up that says "Would you like to print an evidence envelope?"  If the user presses yes we would like to see the following:
    1. Bring up a message box before the print that reminds them of instructions to check the printer. (i.e. put an envelope in the bypass tray or verify tray 2 has envelopes)
    2. Only prints page 2 of 2 (the information that goes on the envelope)
  • Can I hide page 2 of 2 and just make this a single page form?

 

Thank you!!

TOPICS
How to , JavaScript , PDF forms , Print and prepress
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
2 ACCEPTED SOLUTIONS
Community Expert ,
Jan 10, 2021 Jan 10, 2021

For #2, use this code as the Mouse Up script of your print button:

 

if (app.alert("Would you like to print an evidence envelope?",2,2)==4) {
	app.alert("Instructions for printing: ...",3);
	this.print({nStart: 1, nEnd: 1});
}

 

For #3: No, you can't hide a page, unless the file is opened only in Acrobat. If it's opened in Reader you can delete it, if it was originally spawned from a Template object, and then re-spawn it, I guess, but I think it's not worth the trouble, to be honest.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 14, 2021 Jan 14, 2021

Try this:

 

 

if (app.alert("Would you like to print an evidence envelope?",2,2)==4) {
	app.alert("Instructions for printing: ...",3);
	this.print({nStart: 0, nEnd: 0}); // print page 1
	this.print({nStart: 1, nEnd: 1}); // print page 2
} else {
	this.print({nStart: 0, nEnd: 0}); // print page 1
}

 

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2021 Jan 10, 2021

First point: Not possible!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 10, 2021 Jan 10, 2021

Which part?  Or all of it?  If so, why?  I'm trying to learn.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2021 Jan 10, 2021

"Disable the ability to print from the menu or Ctrl-P so that the user only has the option to use the print button. "

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2021 Jan 10, 2021

Unless printing is prohibited by a security policy the user will always be allowed to print the file. You can't stop them from doing so.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2021 Jan 10, 2021

For #2, use this code as the Mouse Up script of your print button:

 

if (app.alert("Would you like to print an evidence envelope?",2,2)==4) {
	app.alert("Instructions for printing: ...",3);
	this.print({nStart: 1, nEnd: 1});
}

 

For #3: No, you can't hide a page, unless the file is opened only in Acrobat. If it's opened in Reader you can delete it, if it was originally spawned from a Template object, and then re-spawn it, I guess, but I think it's not worth the trouble, to be honest.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 10, 2021 Jan 10, 2021

Thank you very much!  That works like a champ.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 10, 2021 Jan 10, 2021

I can't get the evidence sheet only to print when I press no.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 11, 2021 Jan 11, 2021

I don't follow... If you press No in the first dialog the print window will not open.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 13, 2021 Jan 13, 2021

Correct.  

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 13, 2021 Jan 13, 2021

So what's the problem?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 14, 2021 Jan 14, 2021

I actually want it to print the evidence sheet only if they select no. 

 

Is there a way to designate what tray to print from?  For instance,  let's say I have a piece of evidence I need to package.   I would fill out the form, click print,  the evidence sheet would print from tray 3.  If I sele t yes for the envelope it would print from tray 1.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 14, 2021 Jan 14, 2021

Isn't that what happens if they click Yes, too? So what's the point of asking them?

And no, you can't select a tray in the script, only a printer.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 14, 2021 Jan 14, 2021

If they say no it should print page 1 of 2.  If they say yes they need both with the 1 of 2 automatically going to the default printer and them being able to choose the tray on the 2 of 2

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 14, 2021 Jan 14, 2021

Would it be possible to click print. Get a the print window for 1/2 AMF then ask if the user needs an envelope?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 14, 2021 Jan 14, 2021

Try this:

 

 

if (app.alert("Would you like to print an evidence envelope?",2,2)==4) {
	app.alert("Instructions for printing: ...",3);
	this.print({nStart: 0, nEnd: 0}); // print page 1
	this.print({nStart: 1, nEnd: 1}); // print page 2
} else {
	this.print({nStart: 0, nEnd: 0}); // print page 1
}

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 14, 2021 Jan 14, 2021

You are truly awesome.  Thank you.

Can you please shoot me an e mail?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2021 Jan 15, 2021
LATEST

You're welcome!

I don't know your address but you can contact me via [try6767 at gmail.com].

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines