Pdf viewer in Web-client which takes bytes

Forum to discuss the Web client version of Servoy.

Pdf viewer in Web-client which takes bytes

Postby nestrocuation » Thu May 12, 2011 5:58 pm

Hey all,

I looked at various post for this and they were pretty helpful but am still not sure which is the best pdf viewer that i could use with servoy in web client .

My basic requirement is i have pdf bytes in my database and i need to just display it to the user in the browser itself so that user cant copy ,print the document and also if could just watermark that document.

I tried using jPedal in webclient but it did not work well , I think so jasper report is one of the options but its an unknown land for me and would appreciate your help on this .

Nirav
nestrocuation
 
Posts: 61
Joined: Tue Jun 08, 2010 11:27 pm

Re: Pdf viewer in Web-client which takes bytes

Postby Westy » Thu May 12, 2011 9:35 pm

Would writing the pdf to disk and then returning its url to the user be of any help? If they view the pdf in a browser they will be able to copy and print it, so this might not meet your requirements. Watermarking can be done with the PDF Pro plugin.

Dean
Westy
 
Posts: 841
Joined: Fri Feb 13, 2004 5:27 am
Location: Lynnfield, Massachusetts USA

Re: Pdf viewer in Web-client which takes bytes

Postby nestrocuation » Thu May 12, 2011 10:34 pm

Hey Dean ,

Thanks a lot for reply .

writing the pdf to disk and then returning its url to the user be of any help

Well thats the worst case scenario - but can u give me some input on how to do this on server side .Since i tried to create a temp file and then put bytes into the temp file and tried to get the url and embedd it into html arear in my form, but it did not work well.

If they view the pdf in a browser they will be able to copy and print it


Well if its watermarked i can pass on the copy requirement and i dont mind them printing the webpage , only thing is they should not be able to print a plain document and in a sense should not be able to save it .Sinceat presently i am just doing write file in which browser ask them whether they want to open or save .


Nirav
nestrocuation
 
Posts: 61
Joined: Tue Jun 08, 2010 11:27 pm

Re: Pdf viewer in Web-client which takes bytes

Postby Westy » Fri May 13, 2011 12:00 am

Code: Select all
var installdir = java.lang.System.getProperty("user.dir");
installdir = utils.stringReplace(installdir,'\\','\/');
var filePath = installdir + '/server/webapps/ROOT/pdf/formname.pdf';
plugins.file.writeFile(plugins.file.convertToJSFile( filePath), thePdfBlob);
application.showURL('/pdf/formname.pdf#zoom=100','_self');

Dean
Westy
 
Posts: 841
Joined: Fri Feb 13, 2004 5:27 am
Location: Lynnfield, Massachusetts USA

Re: Pdf viewer in Web-client which takes bytes

Postby jcompagner » Fri May 13, 2011 3:45 pm

why not just:

plugins.file.writeFile("mynicepdf.pdf", dataproviderOfThebytes, "application/pdf");
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8096
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Pdf viewer in Web-client which takes bytes

Postby Harjo » Fri May 13, 2011 5:19 pm

Johan, the difference is, your method, just gives you a file download.
Westy's method, shows it directly in a browser-window (if you have acrobat reader installed)
Harjo Kompagnie
Direct ICT / Servoy Hosting / ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
User avatar
Harjo
 
Posts: 4289
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Pdf viewer in Web-client which takes bytes

Postby jcompagner » Fri May 13, 2011 5:22 pm

there is no difference, internally the same thing is being done.
also there if you give it a nice name (ends with .pdf) and the right mime type is send, it should just open it inside the browsers (which i really hate by the way, i don't want to have it inside my browsers, i have an 'app' for that...)
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8096
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Pdf viewer in Web-client which takes bytes

Postby Harjo » Fri May 13, 2011 5:25 pm

:lol: :lol: funny. this is webclient, and you don't want to open pdf in a browser!! :roll:
Harjo Kompagnie
Direct ICT / Servoy Hosting / ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
User avatar
Harjo
 
Posts: 4289
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Pdf viewer in Web-client which takes bytes

Postby goldcougar » Sat May 14, 2011 9:51 pm

A few tips...

With the PDF Pro plugin, you can watermark, and restrict the document from being printed.

If you want to hide the PDF url a bit, you could use something like http://docs.google.com/viewer?pli=1 and link into a webservice or jsp page which streams the pdf dynamically. You could add in some extra work to try to create a token like system so that the pdf may only be viewed in your app. however, technically savvy people can probably get around any restrictions you place :)
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Free Training Videos
Servoy Guy- Free Plugins, Tips & Resources
ServoyForge- Open Source Servoy Components
User avatar
goldcougar
Servoy Expert
 
Posts: 662
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: Pdf viewer in Web-client which takes bytes

Postby nestrocuation » Tue May 24, 2011 7:10 pm

Hey guys thanks a lot really appreciating you help ,

If you want to hide the PDF url a bit, you could use something like http://docs.google.com/viewer?pli=1 and link into a webservice or jsp page which streams the pdf dynamically


if i am not mistaken than i could embedd google docs into my servoy form using iframe .Would apprecite if you could provide me some more inputs on that .

PDF Pro plugin


Thanks a lot it helps

create a token like system so that the pdf may only be viewed in your app


Yes i already have that kind of system for my rest calls .

Thanks
Nirav
nestrocuation
 
Posts: 61
Joined: Tue Jun 08, 2010 11:27 pm

Re: Pdf viewer in Web-client which takes bytes

Postby nestrocuation » Fri Jul 15, 2011 12:15 am

Alright I found something Intresting and sharing just incase of it helps u guys

Recipe for Embedded PDF viewer In web-client :idea:

1) Html Area in a form (to send bytes - encode bytes with base 64 and serialize with json plugin and send to applet - i know base 64 makes it big but no need to create temp files )
2) 3 ice pdf jars : core , viewer and applet in servoy-webclient root
3) Optional : Secret Patch of watermarking I kind of made something like pdf pro which takes bytes and return bytes - i will try to send that patch to servoy guy and see if he likes . (So u need that jar in plugins folder)

End Product Dish :
Sweet & Spicy Embedded Pdf Viewer with full text search and optional save and print options and many more features and all in web client .

And hey if u guys are lazy and need my edited version of dish mail me and i will send it you .

From your chef :wink:
Nirav Shingala
nestrocuation
 
Posts: 61
Joined: Tue Jun 08, 2010 11:27 pm


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 2 guests

cron