[poppler] Add trimbox support to pdftops

Benjamin Adler benadler at gmx.net
Thu Oct 28 16:40:29 PDT 2010


On 10/28/2010 10:16 PM, Albert Astals Cid wrote:
> A Dijous, 28 d'octubre de 2010, Benjamin Adler va escriure:
>> [...]
>> Please tell me what you think!
>
>   * Use capital first letter for the enum values.

Done.

>   * Don't call the variables cropBox since it seems it contains the "cropBox",
> call them boxToCrop or something like that

I opted for "pageBox" and hope thats ok.

>   * It also would be cool if you detected -cropbox and -crop MediaBox together
> and told the user he is wrong and needs to fix his parameters.

Done.

I still don't know whether it was ok to change Page::textList() from

m_page->parentDoc->doc->displayPageSlice(
	output_dev, m_page->index + 1, 72, 72, rotation,
	false, false, false, -1, -1, -1, -1);

into

m_page->parentDoc->doc->displayPageSlice(
	output_dev, m_page->index + 1, 72, 72, rotation,
	::Page::MediaBox, false, -1, -1, -1, -1);

because I don't really know what the desired behaviour is when 
"!useMediaBox && !crop" is passed.

Also, I created the two methods

   static Page::PageBox getPageBoxFromString(const char *pageBoxName, 
GBool* success) and

   PDFRectangle* getPDFRectangleOfPageBox(const Page::PageBox pageBox),

using the first in the utils and the second in Page itself. The latter 
is not private yet, should it be?

I personally feel that it'd be more beautiful to replace

	Page::getMediaWidth()
	Page::getMediaHeight()
	Page::getCropWidth()
	Page::getCropHeight()

with

	double Page::getPageBoxWidth(Page::PageBox)
	double Page::getPageBoxHeight(Page::PageBox)

and modify callers accordingly. Do you agree?

Should I add my name to the files I changed (mostly Page.cc/h)?

cheers,
ben

P.S: Sorry for making this a two-patch-mess, I need to learn git.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Added-crop-option-to-pdftops-and-pdftoppm-extended-p.patch
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20101029/56142598/attachment-0001.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0002-Some-more-cleanups.patch
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20101029/56142598/attachment.txt>


More information about the poppler mailing list