1

I'm quite new to Javascript.

I want to make a very simple native PDF viewer using nw.js and pdf.js. It reads a package file and extract a buffer that contains a valid PDF file. Then I convert the buffer into a stream like this:

var stream = require('stream');
var bufferStream = new stream.PassThrough();
bufferStream.end(pdfbuffer); // pdfbuffer is the PDF file's buffer

But I don't know how to make a valid URL for this PDF file so that I can fill it in pdf.js' default viewer code here:

// viewer.js from PDF.JS
var DEFAULT_URL = 'compressed.tracemonkey-pldi-09.pdf';

Or am I thinking of the wrong direction?

1 Answer 1

1

I think you should create a Writable stream first. Then write that stream to a PDF file which you will create too. I'm not sure if you can use a PDF file as a writable stream directly. Sorry if this doesn't really answer the question but take this as a nudge in the right direction.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.