How To Get Byte-array Data From Servlet To Pdf.js
How can I get this: File file = new File(doneDir + '\\' + batchName + '\\' + fileName); byte[] by = new byte[(int) file.length()]; FileInputStream fis = new FileInputStream(file);
Solution 1:
Based on the example, I would say that instead of
var data = (byte array returned from servlet)
PDFJS.getDocument(data).then(function(pdf) {});
I think you should use:
PDFJS.getDocument(servlet_url).then(function(pdf) {
// you can now use *pdf* here
});
A servlet that returns a PDF file should be no different to the client than a PDF file on the server, and the example uses PDFJS.getDocument('helloworld.pdf').then(...
so this function obviously takes a URL.
Post a Comment for "How To Get Byte-array Data From Servlet To Pdf.js"