diff --git a/src/v2/pdf_resources/page_dimension.h b/src/v2/pdf_resources/page_dimension.h index 8f3f9f5d..238a9ee3 100644 --- a/src/v2/pdf_resources/page_dimension.h +++ b/src/v2/pdf_resources/page_dimension.h @@ -229,7 +229,7 @@ namespace pdflib void pdf_resource::execute(nlohmann::json& json_resources, QPDFObjectHandle qpdf_resources) { - LOG_S(INFO) << __FUNCTION__; + LOG_S(INFO) << __FUNCTION__ << ": " << json_resources.dump(2); if(json_resources.count("/Rotate")) { @@ -337,15 +337,62 @@ namespace pdflib } if((not initialised) and json_resources.count("/CropBox")) - { + { + std::stringstream ss; + ss << "defaulting to crop-box"; + LOG_S(INFO) << ss.str(); + bbox = crop_bbox; initialised = true; } - else if(not initialised) + //else if(not initialised) + else if((not initialised) and json_resources.count("/MediaBox")) { + std::stringstream ss; + ss << "defaulting to media-box"; + LOG_S(INFO) << ss.str(); + + crop_bbox = media_bbox; + bbox = media_bbox; initialised = true; } + else if((not initialised) and json_resources.count("/ArtBox")) + { + std::stringstream ss; + ss << "defaulting to art-box"; + LOG_S(INFO) << ss.str(); + + crop_bbox = art_bbox; + media_bbox = art_bbox; + + bbox = art_bbox; + initialised = true; + } + else if((not initialised) and json_resources.count("/BleedBox")) + { + std::stringstream ss; + ss << "defaulting to bleed-box"; + LOG_S(INFO) << ss.str(); + + crop_bbox = bleed_bbox; + media_bbox = bleed_bbox; + + bbox = bleed_bbox; + initialised = true; + } + else if((not initialised) and json_resources.count("/TrimBox")) + { + std::stringstream ss; + ss << "defaulting to trim-box"; + LOG_S(INFO) << ss.str(); + + crop_bbox = trim_bbox; + media_bbox = trim_bbox; + + bbox = trim_bbox; + initialised = true; + } else { std::stringstream ss; diff --git a/uv.lock b/uv.lock index f28a62f1..b069c51a 100644 --- a/uv.lock +++ b/uv.lock @@ -545,7 +545,7 @@ wheels = [ [[package]] name = "docling-parse" -version = "4.4.0" +version = "4.5.0" source = { editable = "." } dependencies = [ { name = "docling-core" },