Sherzod Posted June 9, 2014 Posted June 9, 2014 Hi All!! A PDF Viewer Panel - No Browser Plugin required, pure JavaScript Source: http://www.sencha.com/forum/showthread.php?237361-A-PDF-Viewer-Panel-No-Browser-Plugin-required-pure-JavaScript Demo: http://SunboX.github.com/ext_ux_pdf_panel/demo/ Github Project: https://github.com/SunboX/ext_ux_pdf_panel How to use: TRY... 1. Download files: http://sunbox.github.io/ext_ux_pdf_panel/lib/pdf.js/compatibility.js --> copy to directory (/files/pdf/) sunbox.github.io/ext_ux_pdf_panel/lib/pdf.js/pdf.js --> copy to directory (/files/pdf/) http://sunbox.github.io/ext_ux_pdf_panel/ux/util/PDF/TextLayerBuilder.css --> copy to directory (/files/pdf/pdf/) http://sunbox.github.io/ext_ux_pdf_panel/ux/panel/PDF.js --> copy to directory (/files/pdf/pdf/) http://sunbox.github.io/ext_ux_pdf_panel/ux/util/PDF/TextLayerBuilder.js --> copy to directory (/files/pdf/pdf/) 2. Add CustomFiles in UniServerModule: files/pdf/compatibility.js files/pdf/pdf.js files/pdf/pdf/PDF.js files/pdf/pdf/TextLayerBuilder.js files/pdf/pdf/TextLayerBuilder.css 3. Paste into a form UniHTMLFrame1 and add UniHTMLFrame1.HTML...: <div id="pdfviewer" align="center"></div> 4. procedure TMainForm.UniButton1Click(Sender: TObject); begin UniSession.AddJS('if (Ext.get("pdfviewerpanel")) {Ext.get("pdfviewerpanel").remove()};'); UniSession.AddJS('Ext.create(''Ext.ux.panel.PDF'', {' + 'id : "pdfviewerpanel", ' + 'title : ''PDF Panel'',' + //'width : ' + IntToStr(UniHTMLFrame1.Width) + ' ,' + //'height : ' + IntToStr(UniHTMLFrame1.Height) + ',' + 'width : 489,' + 'height : 633,' + 'pageScale: 0.75,' + 'src : ''http://cdn.mozilla.net/pdfjs/tracemonkey.pdf'', ' + 'renderTo : "pdfviewer"' + //'renderTo : Ext.getBody()' + '});'); end; Best regards. Quote
stas Posted June 9, 2014 Posted June 9, 2014 Hi Thanks Other method with pdf.js DisplayPdf:=UniServerInstance.NewLocalCacheFile('pdf'); CopyFile(MyPdf,DisplayPdf,False); S:=UniServerInstance.LocalCacheURL; S:=S+ExtractFileName(DisplayPdf); if copy(S,1,1)<>'/' then S:='/'+S; S:=UniServerInstance.FilesFolderURL+'pdf.js/web/viewer.html?file='+S; UniUrlFrame1.url:=S; Quote
stas Posted June 9, 2014 Posted June 9, 2014 Hello Pdf.js very cool product, but FastReport pdf without embedded fonts and russian letters display incorrect. Quote
ganzqgy Posted June 11, 2014 Posted June 11, 2014 Double byte character support is not good.IE does not support Quote
docjones Posted June 11, 2014 Posted June 11, 2014 thanks for sharing, That's perfect for integration into unigui, but I miss some basic things such as being able to print, or that the document is not paginated i Attach a demo sample in xe2, all included. Complile and run in debug mode. (or copy files debug/files to /release/files to run in release mode) PdfViewer.rar Quote
mroustaei Posted April 28, 2018 Posted April 28, 2018 hello docjones i run program and click load then pdf opening download manager do not show pdf into panle 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.