@@ -229,7 +229,7 @@ namespace pdflib
229229 void pdf_resource<PAGE_DIMENSION>::execute(nlohmann::json& json_resources,
230230 QPDFObjectHandle qpdf_resources)
231231 {
232- LOG_S (INFO) << __FUNCTION__;
232+ LOG_S (INFO) << __FUNCTION__ << " : " << json_resources. dump ( 2 ) ;
233233
234234 if (json_resources.count (" /Rotate" ))
235235 {
@@ -337,15 +337,62 @@ namespace pdflib
337337 }
338338
339339 if ((not initialised) and json_resources.count (" /CropBox" ))
340- {
340+ {
341+ std::stringstream ss;
342+ ss << " defaulting to crop-box" ;
343+ LOG_S (INFO) << ss.str ();
344+
341345 bbox = crop_bbox;
342346 initialised = true ;
343347 }
344- else if (not initialised)
348+ // else if(not initialised)
349+ else if ((not initialised) and json_resources.count (" /MediaBox" ))
345350 {
351+ std::stringstream ss;
352+ ss << " defaulting to media-box" ;
353+ LOG_S (INFO) << ss.str ();
354+
355+ crop_bbox = media_bbox;
356+
346357 bbox = media_bbox;
347358 initialised = true ;
348359 }
360+ else if ((not initialised) and json_resources.count (" /ArtBox" ))
361+ {
362+ std::stringstream ss;
363+ ss << " defaulting to art-box" ;
364+ LOG_S (INFO) << ss.str ();
365+
366+ crop_bbox = art_bbox;
367+ media_bbox = art_bbox;
368+
369+ bbox = art_bbox;
370+ initialised = true ;
371+ }
372+ else if ((not initialised) and json_resources.count (" /BleedBox" ))
373+ {
374+ std::stringstream ss;
375+ ss << " defaulting to bleed-box" ;
376+ LOG_S (INFO) << ss.str ();
377+
378+ crop_bbox = bleed_bbox;
379+ media_bbox = bleed_bbox;
380+
381+ bbox = bleed_bbox;
382+ initialised = true ;
383+ }
384+ else if ((not initialised) and json_resources.count (" /TrimBox" ))
385+ {
386+ std::stringstream ss;
387+ ss << " defaulting to trim-box" ;
388+ LOG_S (INFO) << ss.str ();
389+
390+ crop_bbox = trim_bbox;
391+ media_bbox = trim_bbox;
392+
393+ bbox = trim_bbox;
394+ initialised = true ;
395+ }
349396 else
350397 {
351398 std::stringstream ss;
0 commit comments