Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hummus exception causes Node.js crashing #293

Closed
vvsanil opened this issue Jun 15, 2018 · 3 comments · Fixed by galkahana/PDF-Writer#180
Closed

Hummus exception causes Node.js crashing #293

vvsanil opened this issue Jun 15, 2018 · 3 comments · Fixed by galkahana/PDF-Writer#180

Comments

@vvsanil
Copy link

vvsanil commented Jun 15, 2018

Hi Gal,

We are using Node.js, It is crashing when we trying to process some PDFs. I have attached the sample for reference. We are getting the following error

" Unable to create form xobject from PDF page, parhaps the page index does not fit the total pages count "

After this error, When we try to end the PDF writer then the system crashing. I have tested in both Linux and Windows.

Here is the sample code

var pdfReader = hummus.createReader(src);
var pageCount = pdfReader.getPagesCount();
var pdfWriter = hummus.createWriter(dest, { version: hummus.ePDFVersion13 });
var cpyCxt = pdfWriter.createPDFCopyingContext(pdfReader);
for(var i=0;i<pdfReader.getPagesCount(); i++){
	var formID = cpyCxt.createFormXObjectFromPDFPage(i, hummus.ePDFPageBoxMediaBox);
	.............
	.............
}
pdfWriter.end();
[Sample.pdf](https://github.com/galkahana/HummusJS/files/2104945/Sample.pdf)

Please let me know how to handle this exception?

Thanks,
Anil.

@kilsen
Copy link

kilsen commented Sep 5, 2019

We are experience the same issue -- we are attempting to read a PDF using createREader() (using PDFRStreamForBuffer) and if the PDF is corrupt, the call simply crashes Node.js. Is there a workaround? Is there a hummus method that will peek into a PDF and determine if it is valid or if it is corrupt?

@through-a-haze
Copy link

Same here. Using appendPDFPagesFromPDF with some PDFs (like this one) causes exception in Hummus and crashes Node.js app.

@julianhille
Copy link
Contributor

Same here. Using appendPDFPagesFromPDF with some PDFs (like this one) causes exception in Hummus and crashes Node.js app.

Fixed this issue over in muhammara. julianhille/MuhammaraJS#194

May the others check if that fixes their issues too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants