On Sun 21 Sep 2014 06:38:42 Werner LEMBERG wrote:
> >> A good starting point may be to implement a C/C++ library function,
> >> to extract the MediaBox properties; that would open the gate to a
> >> possible pdfbb request, which gtroff.exe could process internally.
> > 
> > 
> > Alternatively, we could modify the existing implementation of .psbb,
> > such that it will discriminate on `%!PS-Adobe-´ or `%PDF-´ as
> > initial file content, then DTRT wrt parsing a `%%BoundingBox:´ or
> > `/MediaBox´ record accordingly.
> 
> 
> Good idea!
> 
> 
>     Werner

Yes, it is. Someone on the list has contacted me, with a view to writing the 
code, and I have provided the perl version.

It is a bit more complex than psbb, which is essentially a grep for 
%BoundingBox in the first part of the postscript file. This is because 
MediaBox can appear in multiple object types in a hierarchical fashion. Unlike 
postscript, each page in a pdf document can be a different size. So to be sure 
of the correct MediaBox to use it is necessary to parse the complete document, 
find the page you are interested in (page 1 in the case of PDFPIC) and then 
search for the MediaBox in the page object or any of its ancestors.

Cheers 

Deri


Reply via email to