Mozilla pdf.js for showing pdf files

Questions, tips and tricks and techniques for scripting in Servoy

Mozilla pdf.js for showing pdf files

Postby deezzub » Fri Jan 24, 2014 4:02 pm

Is it possible to use the Mozilla pdf.js in Servoy for showing PDF files? If yes, what is the best way to integrate it in Servoy?
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: Mozilla pdf.js for showing pdf files

Postby mboegem » Mon Jan 27, 2014 12:36 am

web or smart-client?
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1742
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Mozilla pdf.js for showing pdf files

Postby deezzub » Mon Jan 27, 2014 10:09 am

mboegem wrote:web or smart-client?

Smart Client, but in Web Client it should also work.
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: Mozilla pdf.js for showing pdf files

Postby pbakker » Mon Jan 27, 2014 10:48 am

PDF.js works in svyJFXWebView, albeit slowly. I guess the WebKit version underlying the JavaFX WebView component that is wrapped in svyJFXWebView doesn't have the JavaScript performance optimizations yet to make it fast (same issue as when using PDF.js in some (somewhat) older browsers)

Wrapping PDF.js in such a way that you can easily use it in both the Smart and Web Client is exactly what svyComponent was created for. Better to wait a couple of weeks before digging into that through, because the documentation for svyComponent is not yet available.

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: Mozilla pdf.js for showing pdf files

Postby mboegem » Mon Jan 27, 2014 10:57 am

deezzub wrote:Smart Client, but in Web Client it should also work.


pdf.js is using a HTML5 canvas to draw the pdf.

Because by default Java is not capable of showing this kind of advanced HTML, the smart-client is not able to do this when running with Java 6 .
In that case you need to use the jPedal bean which can preview PDF's.
Smart-clients using Java 7 can benefit of the recently exposed open source module 'svyJFXWebView'. (viewtopic.php?f=68&t=20132),
but will also be able to use the jPedal bean

In web client it should be possible to use the pdf.js by injecting the code.
The only restriction you'll have is the browser, which should be capable of displaying this kind of HTML5 content.
Using the jPedal bean is not possible here.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1742
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Mozilla pdf.js for showing pdf files

Postby deezzub » Fri Jan 31, 2014 5:23 pm

Thanks Paul and Marc, for your informations. I try it. We are looking for a jPedal alternative, because of the error: java.lang.ClassNotFoundException.
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany


Return to Methods

Who is online

Users browsing this forum: No registered users and 6 guests