I designed a Document Viewer in Vaadin that displays PDF files to the user. I successfully added the PDF to the viewer by specifying the system path. The problem is when I run the Viewer in a remote system, the PDF isn't displayed. So is there any way to load the PDF using the resource like we load the images.
Here is my code:
File pdfFile = new java.io.File ("D:/WorkFiles/PDF Books/newsletter.pdf");
The pdf is loading only from the local system. I have tried adding the pdf in the themes folder, but it doesn't work.
Thanks in advance.
What about the https://vaadin.com/api/com/vaadin/server/StreamResource.html. You can use this for on demand generated PDF files.
Related
I want to know how to open the .docx file or .xls file using react native file viewer in android.I am using RNFetchblob todownload the file.PDF and Image files are getting opened.While am trying to open .docx file or .xls file using react native file viewer am getting the error like no app is found to open this mime type
You need to install a pdf viewer in your emulator or mobile.
Then you can open the docs. See Reference
We are using PhantomJs 2.1.1 on Unix server to convert HTML pages to PDF files. The font we want to use is a proprietary font, hence for UI we are sending the font file along with html content. However, due to some known issues (Issue1, Issue2) PhatomJs does not work properly if the font is not being fetched locally.
By default Unix font are stored at usr/share/fonts/. However, we do not have access to this location, can I provide custom font file location directly to PhantomJs?
I am trying to embed a font in my BIRT pdf export. I am running the report from my webserver in the Tomcat/webapps/birt dir.
I checked the Fontsconfig.xml which points to the dir path
<path="/usr/share/fonts/default/TrueType" />
I have created the dir on my server as usr/share/fonts/default/TrueType and placed the (.ttf) font that I use in the report. I have updated my fonts cache via sudo fc-cache -fv, and I have restarted Tomcat. However, when I export my report to PDF form, the font does not get not used in the pdf.
Am I missing something?
I have a very particular case and I don't know if this is possible to be done.
I'm using NWJS to run a web app as a desktop app. I need to zip/package the source files because my code should not be available to eavesdroppers. This package will be delivered on a flash drive. And this is were my trouble begins.
There are a lot of .pdf file that must be shipped together with the package. The user can browse which pdf he wants to open, and when he clicks it, the pdf is "downloaded" to his pc. The content of the pdf is NOT available on the application. I have a list with the name of each pdf file.
If I zip/package the .pdf together with the source files it becomes a huge .nw file and it takes forever for my application to load. I need to mantain the pdf on a separate folder and they need to be accessible through the source code. This is easy if i run the application directly without packaging it, as nw uses the relative url to it's root, but when I do package nw uses a temp folder for the source files and I can't use relative url to access the pdf folder.
The only approach i can think of is to write a js script to identify where the flash drive was mounted but i don't know if this is possible.
I have to support Windows and Mac for this case.
Searching on NWJS google group i found that the answer was quite simple. These two lines returns the path where the nw bin is running. From there is quite simple to get the pdf folder.
var path = require("path");
pathstr = path.dirname(process.execPath);
I am giving a link to a pdf file but it starts downloading the file instead of opening it
Complains
It could be that you don't have a pdf reader plugin installed on your browser.