On Fri, Mar 04, 2011 at 09:47:04AM -0500, Eric Doviak wrote:
> Thanks for your response, Michal.
> 
> >> But occasionally, I receive a PDF file with enormous white margins.
> >> In such cases, I want to crop the pages down to the bounding box
> >> before resizing and rescaling the page.
> >>      
> > Maybe just a terminology but what do you mean by the bounding box? I
> > guess what you actually mean is the media size (aka paper size). You
> > will get this value by page_dict.property( "MediaBox" ) and you can
> > change it by modifying the given rectangle.
> >    
> 
> By "bounding box," I mean the "page bounding box" that Ghostscript 
> returns when you run:
> 
> gs -dSAFER -dNOPAUSE -dBATCH -q -r72 -sDEVICE=bbox -f filename.pdf

I do not know how this is implemented but it looks like it really prints
out the smallest box which contains all displayed objects.

> 
> 
> > Btw. do you want this to be automatical? (determine the text area and
> > crop down to this size + border).
> >
> > This would be really interesting but then you would need to go through
> > all text and graphical operators on the page and call getBBox on them
> > and calculate the area from them.
> >    
> 
> That's what I was afraid of.

I think you do not have to be afraid ;) Just reuse the numbers
calculated by gs.

> How can I obtain a list all text and graphic objects on a given page? 
> How do I call getBBox on them?

I am not familiar with the scripting but operators should be accesible
via content stream object. Jozo might tell you more. Anyway I would
rather use the gs if it implements this feature.

-- 
Michal Hocko

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Pdfedit-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdfedit-support

Reply via email to