Skip to content

Commit 1d3f78e

Browse files
authored
fix: "could not find the page-dimensions" error solved restoring the parent mediabox (#181)
Signed-off-by: Michele Dolfi <[email protected]>
1 parent a8975bc commit 1d3f78e

10 files changed

+6717
-1
lines changed

src/v2/pdf_resources/page_dimension.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ namespace pdflib
339339
art_bbox = crop_bbox;
340340
}
341341

342+
// FIXME: cleanup and review the box priorities
342343
if((not initialised) and json_resources.count("/CropBox"))
343344
{
344345
std::stringstream ss;
@@ -349,7 +350,7 @@ namespace pdflib
349350
initialised = true;
350351
}
351352
//else if(not initialised)
352-
else if((not initialised) and json_resources.count("/MediaBox"))
353+
else if((not initialised) and (json_resources.count("/MediaBox") or (qpdf_resources.hasKey("/Parent") and qpdf_resources.getKey("/Parent").hasKey("/MediaBox"))))
353354
{
354355
std::stringstream ss;
355356
ss << "defaulting to media-box";

0 commit comments

Comments
 (0)