How to print PDF directly in Servoy ?

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

How to print PDF directly in Servoy ?

Postby ashutoslenka426 » Fri May 06, 2016 11:09 am

Hi All,

How can I Print PDF in Servoy directly ? . I am using apache PDF box library . I am successful in it. Is it possible with out using any library ? . The solution should be generic one for all the OS .
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm

Re: How to print PDF directly in Servoy ?

Postby emera » Fri May 06, 2016 11:42 am

Hi,

You can use the pdf_output plugin. You can see it in the developer, Solution Explorer view under "Plugins".
https://wiki.servoy.com/display/public/DOCS/pdf_output

Regards,
Edit
emera
 
Posts: 21
Joined: Tue Jun 17, 2014 8:33 am

Re: How to print PDF directly in Servoy ?

Postby lwjwillemsen » Fri May 06, 2016 1:02 pm

You cannot print a pdf file with the pdf_output plugin.
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 605
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: How to print PDF directly in Servoy ?

Postby emera » Fri May 06, 2016 1:42 pm

The pdf_output plugin and Apache PDFBox are quite similar, they both allow you to create PDF documents or change existing documents.
But what exactly are you trying to do?
emera
 
Posts: 21
Joined: Tue Jun 17, 2014 8:33 am

Re: How to print PDF directly in Servoy ?

Postby ashutoslenka426 » Fri May 06, 2016 1:43 pm

Hi ,

Thanks for your reply . I want to directly print it in the printer.
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm

Re: How to print PDF directly in Servoy ?

Postby emera » Fri May 06, 2016 2:01 pm

Unfortunately this is not possible without using other libraries.
We found an older post https://servoy.com/forum/viewtopic.php?f=22&t=20604 which states it is possible with PDFbox.
emera
 
Posts: 21
Joined: Tue Jun 17, 2014 8:33 am

Re: How to print PDF directly in Servoy ?

Postby ashutoslenka426 » Mon May 09, 2016 2:48 pm

Hi All ,

I am using this .
Code: Select all
desktop = Packages.java.awt.Desktop;
/**@type {java.io.File} */
attachPDF = new Packages.java.io.File(attachPDFJS.getAbsolutePath());
if (desktop.isDesktopSupported())
desktop.getDesktop().print(new Packages.java.io.File(attachPDF));

But this is very inconsistent . Most of the times saying - "There was an error opening this document . This file cannot be found" . I have installed the Adobe reader 11. Please share your thoughts on this
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm

Re: How to print PDF directly in Servoy ?

Postby joe26 » Thu Jun 28, 2018 7:06 am

Located a script that calls PDFbox and the files are open source. You'll have to verify the licensing yourself.

I'm putting it here in case I need to locate the original again.

I found this: https://www.codeproject.com/articles/831588/printing-pdf-silently-in-servoy

To get it to work at 7.4.8, I downloaded a prior version of pdfbox, but it may work with the current version after requiring an install of both
fontbox-1.8.9.jar and pdfbox-1.8.9.jar downloaded from https://pdfbox.apache.org/ into the application_server/beans directory.

I literally struggled with Velocity Report setting up the Report folder set up , an appropriate template file and the css file, along with what is permissible with template variables and incoming data.

Left only to have to silently print the PDF file when in use on a web client, although that test remains to be seen whether I'd done it correctly to print on the server's printer rather than the client's.

The file did open in the PDF viewer from Smart Client for another purpose, while I went round and round with attempting to send a joined foundset instead of a dataset.

btw, the class docs for PDFbox are here https://pdfbox.apache.org/docs/1.8.10/javadocs/index.html?org/apache/pdfbox/pdmodel/PDDocument.html.

Hope this helps someone else.

--Joe.
joe26
 
Posts: 90
Joined: Wed Jun 19, 2013 10:30 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 1 guest