Page 1 of 1

How to print PDF directly in Servoy ?

PostPosted: Fri May 06, 2016 11:09 am
by ashutoslenka426
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 .

Re: How to print PDF directly in Servoy ?

PostPosted: Fri May 06, 2016 11:42 am
by emera
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

Re: How to print PDF directly in Servoy ?

PostPosted: Fri May 06, 2016 1:02 pm
by lwjwillemsen
You cannot print a pdf file with the pdf_output plugin.

Re: How to print PDF directly in Servoy ?

PostPosted: Fri May 06, 2016 1:42 pm
by emera
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?

Re: How to print PDF directly in Servoy ?

PostPosted: Fri May 06, 2016 1:43 pm
by ashutoslenka426
Hi ,

Thanks for your reply . I want to directly print it in the printer.

Re: How to print PDF directly in Servoy ?

PostPosted: Fri May 06, 2016 2:01 pm
by emera
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.

Re: How to print PDF directly in Servoy ?

PostPosted: Mon May 09, 2016 2:48 pm
by ashutoslenka426
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

Re: How to print PDF directly in Servoy ?

PostPosted: Thu Jun 28, 2018 7:06 am
by joe26
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.