Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Decrypt PDF on client side and than view with pdf.js

1,427 views
Skip to first unread message

mehmetk...@gmail.com

unread,
Jan 30, 2015, 2:03:37 PM1/30/15
to mozilla-d...@lists.mozilla.org
Hello everyone,

I'm working on a project that all pdf files are encrypted on Web Server.

With XMLHttpRequest I get content of the encrypted pdf file. Then with JavaScript tools I decrypt the file. After all assign the content of file to a javascript variable as decrypted_file. All this is done at client side.

Here is what i want to do;

pdf.js renders and views pdf file that is located on web server or the same directory base.

How could I handle pdf.js to get content from javascript variable not url as "http//yourdomain.com/first-test.pdf or file as "first-test.pdf"?

Any answers are welcome, thank you.

Jeremy Bramwell

unread,
Jan 30, 2015, 3:26:52 PM1/30/15
to mozilla-d...@lists.mozilla.org
It looks like the answer to this stack overflow question has what you need:
http://stackoverflow.com/questions/12092633/pdf-js-rendering-a-pdf-file-using-a-base64-file-source-instead-of-url

You don't state what the exact form of the data is in decrypted_file, but you will need to turn it into a binary Uint8 Array if it isn't already. The code in the link starts with a base64 encoded data URI.
0 new messages