Print form with preferred Printer in Web Client

Forum to discuss the Web client version of Servoy.

Print form with preferred Printer in Web Client

Postby pradiptab » Tue Oct 14, 2014 10:30 am

Hi

I am trying to print a form in Servoy Web client. Seems like none of the things are working for me.

1. Trying to show the Print dialog, to select some printer. But the print dialog to select the printer is never shown.
Code: Select all
controller.print(false, true);


2. How to script to use a preferred printer without showing the Print dialog?
Code: Select all
controller.setPreferredPrinter('Samsung ML-2850 Series PCL6');
controller.print(false, false);

This shows the file save dialog to save the form in pdf.

3. Changing this client property has no impact. Never ever the printer selection dialog pops up.
Code: Select all
application.putClientProperty(APP_UI_PROPERTY.USE_SYSTEM_PRINT_DIALOG, true);


Is there some thing which is missing? Please help.
Pradipta
Mindfire Solutions
SAN Developer | Servoy Certified Developer
pradiptab
 
Posts: 59
Joined: Tue Mar 10, 2009 2:32 pm
Location: India, Orissa, Bhubaneswar

Re: Print form with preferred Printer in Web Client

Postby Harjo » Tue Oct 14, 2014 1:35 pm

You can't control the printer, or print dialog, or default printer from a Servoy webclient. (or any website or other webclient, what so ever)

If you use controller.print function inside a webclient, you should be getting a pdf, by default!
Harjo Kompagnie
Direct ICT / Servoy Hosting / ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
User avatar
Harjo
 
Posts: 4269
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Print form with preferred Printer in Web Client

Postby pradiptab » Tue Oct 14, 2014 2:00 pm

Thanks Harjo for the clarification.

Like in javascript, window.print() opens the print dialog, to print the current html page. There should be some way to print from web client.

If you have any workaround, please share.
Pradipta
Mindfire Solutions
SAN Developer | Servoy Certified Developer
pradiptab
 
Posts: 59
Joined: Tue Mar 10, 2009 2:32 pm
Location: India, Orissa, Bhubaneswar

Re: Print form with preferred Printer in Web Client

Postby Harjo » Tue Oct 14, 2014 3:00 pm

pradiptab wrote:Like in javascript, window.print() opens the print dialog, to print the current html page. There should be some way to print from web client.
If you have any workaround, please share.


Indeed, that's the only thing you can do in a browser, to print the content of the html you see.
The only thing your in control of inside Servoy, is printing to pdf, and serve that as a file, to the browser-client.

There is no workaround...
Harjo Kompagnie
Direct ICT / Servoy Hosting / ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
User avatar
Harjo
 
Posts: 4269
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Print form with preferred Printer in Web Client

Postby david » Tue Oct 14, 2014 6:49 pm

Harjo wrote:There is no workaround...


Well, no "easy" workaround ... 8)

screen-print-preview.png


The trick is to roll pdf.js into web client and pass it a pdf (as byte array). You can't specify a printer via code but the user does get the system print dialog.

Data Sutra has all this built in. API here: http://community.data-sutra.com/project ... PI#DSprint. Note helper methods for getting PDFByteArray's from Servoy form, html, url, file system resource, and media location resource.

Relevant repo starting location: http://community.data-sutra.com/project ... S/wc/ds/js
You do not have the required permissions to view the files attached to this post.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1723
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Print form with preferred Printer in Web Client

Postby Harjo » Tue Oct 14, 2014 8:40 pm

Thats no workaround. Just implementing your own pdf viewer :-)
Harjo Kompagnie
Direct ICT / Servoy Hosting / ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
User avatar
Harjo
 
Posts: 4269
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Print form with preferred Printer in Web Client

Postby david » Wed Oct 15, 2014 2:13 am

Harjo wrote:Thats no workaround. Just implementing your own pdf viewer :-)


Workaround, hack, lobotomize and replace, wire in someone else's stuff — as long as we don't have to build it from scratch!

With Servoy 8 this should still be a solid approach to previewing and printing.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1723
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Print form with preferred Printer in Web Client

Postby pradiptab » Wed Oct 15, 2014 7:32 am

Thanks David for the nice suggestion. Will check the pdf.js API for the viewer.
Pradipta
Mindfire Solutions
SAN Developer | Servoy Certified Developer
pradiptab
 
Posts: 59
Joined: Tue Mar 10, 2009 2:32 pm
Location: India, Orissa, Bhubaneswar


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 2 guests