The renewal maintenance has officially ended for Progress iMacros effective November 30, 2023.
This Wiki site will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely, The Progress Team
Difference between revisions of "ONPRINT"
Line 20: | Line 20: | ||
*SAVEAS | *SAVEAS | ||
*:First introduced in iMacros version 12.6 | *:First introduced in iMacros version 12.6 | ||
− | *:Specifies the path where the print output file should be saved | + | *:Specifies the path where the print output file should be saved if the chosen printer creates such a file output as .pdf or .xps files. |
+ | |||
=== Examples === | === Examples === | ||
Line 36: | Line 37: | ||
ONPRINT P=4 SAVEAS=c:\temp\testprinter.xps | ONPRINT P=4 SAVEAS=c:\temp\testprinter.xps | ||
+ | |||
+ | === Remarks === | ||
+ | |||
+ | The ONPRINT command to print to a file can only handle printing the '''top frame''' of the document on the browser. If a document has more than one frame, a number of other saveas dialogs (as many as sub-frames in the document) will be shown and remain unhandled. While it is possible to handle one of these saveas dialogs with the [[ONDOWNLOAD]] command, the subsequent ones will remain unhandled. | ||
=== See Also === | === See Also === | ||
[[PRINT]] | [[PRINT]] |
Revision as of 16:22, 30 March 2020
Handles print dialogs. The ONPRINT command must appear before the PRINT command which triggers the printer dialog to come up.
Syntax
ONPRINT P=n BUTTON=(PRINT|CANCEL)
or introduced in version 12.6, the ONPRINT command can accept the extra parameter SAVEAS to indicate where the print output file should be saved:
ONPRINT P=n BUTTON=(PRINT|CANCEL) SAVEAS=path_to_print_output_file
Parameters
- P
- Specifies the number of the printer to use in the drop down list. If you use only P= or P=* the most recently selected printer is used. Typically this is the default windows printer.
- Related forum post: How to determine the printer number.
- Button
- Specifies the button on the Print dialog. By default the PRINT button is selected. With CANCEL the dialog is canceled and no page is printed. The CANCEL option is useful if you want to cancel a print dialog that was triggered by a website automatically.
- SAVEAS
- First introduced in iMacros version 12.6
- Specifies the path where the print output file should be saved if the chosen printer creates such a file output as .pdf or .xps files.
Examples
Select the third printer in the list and print the page:
URL GOTO=https://imacros.net ONPRINT P=3 PRINT
Cancel a Print dialog that appears:
ONPRINT P=* BUTTON=CANCEL URL GOTO=javascript:print()
Save the .xps output file (introduced in v. 12.6):
ONPRINT P=4 SAVEAS=c:\temp\testprinter.xps
Remarks
The ONPRINT command to print to a file can only handle printing the top frame of the document on the browser. If a document has more than one frame, a number of other saveas dialogs (as many as sub-frames in the document) will be shown and remain unhandled. While it is possible to handle one of these saveas dialogs with the ONDOWNLOAD command, the subsequent ones will remain unhandled.