galkahana/HummusJS

Get the page info Object when reading the stream from a buffer

IgorRomanvsky opened this issue · 1 comments

I have a stream that I reading from a buffer by using:
const inputStream = new hummus.PDFRStreamForBuffer(buffer)

How can I get the page original page size and properties Like when Im using :
var pdfReader = hummus.createReader('./TestMaterials/XObjectContent.PDF').getMediaBox()

Solved by doing:

    const pdfWriter = hummus.createWriterToModify(inputStream, outStream);
    const copyingContext = pdfWriter.createPDFCopyingContextForModifiedFile();
    console.log(copyingContext.getSourceDocumentParser().parsePage(0).getMediaBox());