KB Article 16073
2019/04/10

Close
X
Contact Tech Support

 Email Tech Support
 (250) 655-1766
 [7:30 - 5:00 PST]
Your Meeting ID will be Provided by a Rep.
Tech Support
Tech Support Home
Software Updates
Knowledge Base Search
Recent KB Articles
Product FAQs
Code Samples
Documentation
Tech Blog
System Requirements
Installation Instructions
Support Testimonials
Contact us to...
Create a Ticket
Request a Free Demo
Suggest a New Feature
Submit Feedback
Upload a Large File
Other Services
Software Training
Professional Services

Printing a portion of the screen from Presto

Product: Presto Type: How to

Sometimes, you may want to print a specific area of the screen, or possibly even certain content retrieved from a database file. An easy way to approach this would be to have a button that retrieves the necessary data, places it into a temporary window, and then calls the JavaScript window.print() function.

Add a button to the screen in the Visual Editor, and then add the following code to its onClick event:

 var mywindow = window.open('', 'PRINT', 'height=400,width=600');
 mywindow.document.write('<html><head><title>Presto Output</title>');
mywindow.document.write('</head><body >');
mywindow.document.write('<h1>Presto Output</h1>');
mywindow.document.write('<pre>');
mywindow.document.write('{screen(1,1,80)}</br>');
mywindow.document.write('{screen(2,1,80)}</br>');
mywindow.document.write('{screen(3,1,80)}</br>');
mywindow.document.write('{screen(4,1,80)}</br>');
mywindow.document.write('{screen(5,1,80)}</br>');
mywindow.document.write('{screen(6,1,80)}</br>');
mywindow.document.write('{screen(7,1,80)}</br>');
mywindow.document.write('{screen(8,1,80)}</br>');
mywindow.document.write('{screen(9,1,80)}</br>');
mywindow.document.write('{screen(10,1,80)}</br>');
mywindow.document.write('{screen(11,1,80)}</br>');
mywindow.document.write('{screen(12,1,80)}</br>');
mywindow.document.write('{screen(13,1,80)}</br>');
mywindow.document.write('{screen(14,1,80)}</br>');
mywindow.document.write('{screen(15,1,80)}</br>');
mywindow.document.write('{screen(16,1,80)}</br>');
mywindow.document.write('{screen(17,1,80)}</br>');
mywindow.document.write('{screen(18,1,80)}</br>');
mywindow.document.write('{screen(19,1,80)}</br>');
mywindow.document.write('{screen(20,1,80)}</br>');
mywindow.document.write('{screen(21,1,80)}</br>');
mywindow.document.write('{screen(22,1,80)}</br>');
mywindow.document.write('{screen(23,1,80)}</br>');
mywindow.document.write('{screen(24,1,80)}</br>');
mywindow.document.write('</pre>');
mywindow.document.write('</body></html>');
 mywindow.document.close();
mywindow.focus();
mywindow.print();
mywindow.close();

This code will retrieve every single line of text on the screen. As this code effectively builds a temporary HTML page, it's possible to remove or add additional lines, styling, or even use the data returned from a Presto.ExecuteSql query.

Below is a screen in Presto, and what it will look like once the button is clicked. Keep in mind that this would be useful if you're looking to customize the look and feel of what is being printed - Otherwise, a normal print from the browser with CTRL+P might still be able to suffice.

 

 

 

Rate This Article

Did this example help you to achieve your goal?
 Yes  No  Don't Know

Enter additional comments below.   If you want to hear back from us, include your contact information.

Email Address:
Comments:
Please enable JavaScript in order to rate this page.