How to secure PDF files from download but allow it to View? - javascript

I want to integrate some kind of web based PDF viewer so that user can not download the PDF files but they can View them. This is for securing the PDF files from downloads. Something like scribd.com
See example here : ref link

I used FlexPaper: flexpaper.devaldi.com
This compile PDF in SWF, so is more protected.

I think you need something like pdftohtml.
It is a tool based on the Xpdf package which translates PDF documents into HTML format.
You could use Flexpaper, too, but it's free of charge only for open source projects...

Related

How can I allow the user to move / download a file from html FileAPI sandbox to his preferred location?

I've been using html File API to create files from data received over the internet. So far its been fine.
Once the file is created in the temporary file system of a users browser, the user should be able to download the file. I am not able to achieve this. The files are quite large, larger than the size memory (RAM). So I can't just add a link and create an object url.

Can Fine-Uploader Parse PDF Pages into Thumbnail Images

I am working on a website that has a need for a file uploader that integrates well with forms and potentially S3. Fine-uploader looks like a great fit for us. We will be, however, adding a PDF splitter/merger so users can drop one or more PDF files and pull specific pages out and send them as one document. I may need to find a separate JS library to render the PDF pages as image/thumbnails for interaction, but wondering/hoping fine-uploader could handle the page thumbnail rendering similarly to how it does so for image file, but giving a thumbnail for each PDF page.
Fine Uploader does not natively preview PDFs. If you'd like to generate previews for PDFs client-side, consider using a library specifically for that purpose. One possible choice is pdf.js. You can use Fine Uploader's API to get a handle on the PDF file (uploader.getFile(id)) and then pass this file off to pdf.js. Note that you may have to convert this file into a typed array first using FileReader.

Use PDF.js offline

Is it possible to use PDF.js without having the website online? I'm trying to do a simple offline website that reads pdf using pdf.js but it won't work without being online.
Anyone could help?
Yes absolutely you can use it offline. Download the latest version here.
Now extract the zip file and put it on a server(use xampp/wamp/lamp or any other localhost) because the worker is not enabled for file:// urls.
To show the pdf files traverse to web/viewer.html from the localhost and it should load its default pdf.
As to the question about how to show your pdf's use: viewer.html?file=relative/path/to/your/pdf
Say for example inside the web folder(the one in which viewer.html is there) of your pdf.js you create a directory say named pdfFiles and in it you add a pdf named say mypdf.pdf in it then to display it use: viewer.html?file=pdfFiles/mypdf.pdf and it will display it.
Look here for more details on how to dynamically assign PDF file paths to the viewer. If you have any other queries let me know. I have used pdf.js offline and it works wonderfully on almost all the browsers I know.

How to view/open .doc file from sd card inside android app

I have requirement to view .doc file inside android app, I have gone through many related post but still not clear what to do.
I have tried :
aspose word api for android I got api for creating .doc file but there is not a specific method to view .doc file.
I gone through apache POI but there is i have to write function for render content.
Embedding .doc inside Webview Does not work for local files.
Olivedoc Library is missing.
Please suggest me if there is any library for .doc file same as pdfViewer for PDF.
Thanks.
Look here. AFIK there is no library for rendering such files in android (Correct me if I'm wrong). You have to create an intent to open your file in an external app, as described in the linked question.
If you want to render the new .docx or OpenOffice .odp files, there are various libraries (search on github).
I know this is not what you want to hear, but there does not seem to be any way to do what you want. (BTW, WebView does work for local files, but cannot render .doc files.)

How to show a document from Alfresco in own application?

I am making a application which gets its data from Alfresco and i want to show a document (which is in Alfresco) on my page with controls like going to the previous and next page.
I found the jQuery Media library, but it only opens PDF files. So my question is, what is the best way of showing .doc, .docx, .ppt, .pptx, etc. files without going to Alfresco itself?
I've tried Prism Viewer and the Google Docs viewer but they both cant open files from Alfresco for some reason.
Thanks!
You should take a look at pdf.js - pdf.js is a browser-side PDF viewer.
If you're using the current HEAD of Alfresco community, then Alfresco transforms your content automatically to PDF and stores the PDF as rendition (as new new Alfresco Share Viewer uses pdf.js internally).
There is a community addon for Alfresco Share 4.2 that uses pdf.js as document viewer & also contains the pdf rendition configs. That should be a good starting point:
https://github.com/share-extras/media-viewers
Or checkout the current HEAD: https://github.com/Alfresco/community-edition
Here is the current thumbnail-service-context.xml where the pdf rendition is defined:
https://github.com/Alfresco/community-edition/blob/master/projects/repository/config/alfresco/thumbnail-service-context.xml#L219

Categories