KingOrmon Posted March 15, 2012 Posted March 15, 2012 Hello, I would like to know if is possible to print a content of PDF file directly using JS. Regards Quote
zilav Posted March 15, 2012 Posted March 15, 2012 Nope. The only way I can imagine is to use some pdf js library to render it inside the browser (Mozilla and Google have those), but they don't fully support any pdf. Quote
zilav Posted March 16, 2012 Posted March 16, 2012 If you still want to try, here is the pdf.js project from Mozilla. It can render pdf to designated canvas element, you'll need to hook some onready event and call window.print() from there. Just some general ideas. Quote
AtoZ Posted March 16, 2012 Posted March 16, 2012 agree zilav, pdf.js is pretty nice its getting close to handle most of the pdf file redering. oh, Forgot http://flexpaper.devaldi.com/ but not sure about it. /Roger Quote
dionel1969 Posted March 17, 2012 Posted March 17, 2012 Hello, I would like to know if is possible to print a content of PDF file directly using JS. Regards Check this: code.google.com/p/jzebra/ Quote
zilav Posted March 17, 2012 Posted March 17, 2012 Check this: code.google.com/p/jzebra/ I strongly advise againt it, java applets technology is dead. Noone is supporting it except Oracle, buy they don't have a word in modern web development, and sooner or later all browsers will stop working with applets. Don't trap yourself in dead technologies. Quote
dionel1969 Posted March 19, 2012 Posted March 19, 2012 I strongly advise againt it, java applets technology is dead. Noone is supporting it except Oracle, buy they don't have a word in modern web development, and sooner or later all browsers will stop working with applets. Don't trap yourself in dead technologies. Thank you for your advise. It is a very good for our community, but this the solution I find to print out directly to printers in any browser and it works very well, not just for FF o Chrome, etc... it works in all of they. At the same time it is "transparent" to my application, so I will be able to change it when I will find a better solution. I suggest him, and it could be use now while there are not another solution, and later change it. Quote
zilav Posted March 19, 2012 Posted March 19, 2012 I think applets have 2-3 more years before they'll be abandoned in browsers (until some miracle happens of course, like Oracle becoming the best friends with Google/Mozilla/Microsoft). But it is not the real problem. You must have java installed for this to work. Your users must install java. So if you have a several hundreds of users, all of them must install java. I think that the web apps should work with a bare browser without any additional plugins. If you are forcing your customers to install additional components for you web app to work correctly, it would be better just to write a normal desktop app. You force them to install something, so why not just force them to install a desktop application with a much larger capabilities than any web app can ever provide. The true beauty of web applications is just that they work in browser, which is built-in in any OS. Quote
szlbz Posted June 2, 2012 Posted June 2, 2012 procedure TUniForm5.UniButton5Click(Sender: TObject); begin //用fr生成PDF frReport1.LoadFromFile(ExtractFileDir(ParamStr(0)) + '\pr.frf'); frReport1.PrepareReport; pdffilename := RandomStr(true, true, true, 8); frReport1.ExportTo(frllPDFExport1, UniServerModule.TempFolderURL + pdffilename + '.pdf'); UniSession.AddJS( 'function bulkpdfPrint(srcFiles)'+ '{'+ ' var pdf = document.getElementById("createPDF");'+ ' if (pdf != undefined && pdf != null)'+ ' {'+//判断pdf对象是否存在,如果存在就删除该对象 ' var parentNode = pdf.parentNode;'+ ' parentNode.removeChild(pdf);'+ ' }'+ ' var p = document.createElement("object");'+ ' p.id = "createPDF";'+ ' p.classid = "CLSID:CA8A9780-280D-11CF-A24D-444553540000";'+ ' p.width = 1;'+ ' p.height = 1;'+ ' p.src = srcFiles;'+ ' document.body.appendChild(p);'+ ' p.printAll();'+ '};'+ 'bulkpdfPrint("'+UniSession.URL+UniServerModule.TempFolderURL + pdffilename + '.pdf'+'");'//打印PDF ); end; Quote
araujoadanr Posted June 8, 2012 Posted June 8, 2012 Please check http://forums.unigui.com/index.php?/topic/1193-create-pdf-and-show/page__view__findpost__p__5034 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.