pdf-lib icon indicating copy to clipboard operation
pdf-lib copied to clipboard

Library not recognising all pages in a file with mixed page dimesions

Open BharathRavi27 opened this issue 2 years ago • 4 comments

What were you trying to do?

Drawing fields on a PDF document which has mixed page dimensions.

How did you attempt to do it?

Using pdfDoc.getPages();

What actually happened?

The library only recognizes first n number of pages(4 in my case where the document actually has 24 pages). ie, pdfDoc.getPages() returns 4 and not 24. Interestingly, all first 4 pages are of the same dimension. The fifst page is a different dimension.

What did you expect to happen?

To be able to get all the pages in the doc. The library only recognizes first n number of pages(4 in my case where the document actually has 24 pages). ie, pdfDoc.getPages() returns 4 and not 24. Interestingly, all first 4 pages are of the same dimension. The fifst page is a different dimension.

How can we reproduce the issue?

Use a long document with mixed page dimensions.

Version

1.17.1

What environment are you running pdf-lib in?

Node

Checklist

  • [X] My report includes a Short, Self Contained, Correct (Compilable) Example.
  • [ ] I have attached all PDFs, images, and other files needed to run my SSCCE.

Additional Notes

Since this document is classified, I cannot share in public

BharathRavi27 avatar Jan 03 '23 10:01 BharathRavi27

Seeing this as well, though I can reproduce with only 2 pages. Second page is not recognized.

dgavey avatar Sep 13 '23 19:09 dgavey

We still have not resolved this issue. When in the rare case of such documents, we are manually fixing them @dgavey

BharathRavi27 avatar Sep 14 '23 04:09 BharathRavi27

Will it be possible for you to share this file @dgavey ?

BharathRavi27 avatar Sep 14 '23 04:09 BharathRavi27

Came across the same error for another file as well. The PDF has 27 pages in total but the pdfDoc.getPages() method only returns 8 pages.

BharathRavi27 avatar Jan 25 '24 04:01 BharathRavi27