The patches work for me with the example-all.pdf test file. I said the same thing about the change from the if-else to the case. Also, in the new patch, if rotate doesn't have one of the four special values, m.init() isn't called. setRotate() in PSOutputDev.h sets rotate without checking, so I don't know how safe it is to depend on the possible values of rotate. I also agree about using ceil(). I think that it is necessary to go to the next highest value. Regards, William
To: [email protected]; [email protected] From: [email protected] Date: Tue, 27 Oct 2015 22:47:27 +1030 Subject: Re: [poppler] Printing of certain PDF files does not work with "fit-to-page" because of wrong BoundingBox values in the PostScript On 25/10/15 02:58, Martin Pahl wrote: > Attached you find an example: > > example.pdf: a box generated with xfig 321mm x 106mm > > example.ps generated with pdftops -paper A4 example.pdf > example.ps:%%PageBoundingBox: 0 0 302 912 > > example-patched.ps generated with pdftops -paper A4 example.pdf, but with the > patched version. > example-patched.ps:%%PageBoundingBox: 158 0 437 842 > > You can view the postscript files with gv and select BBox. It's obvious that > the unpatched PageBoundingBox is totally wrong, because source coordinates > are > used. The PageBoundingBox is bigger then the A4 paper format. It's just the > size of the original box (302 /72 dpi * 25,4mm = 106,5mm; 912/72 dpi * 25,4mm > = 321,73mm). But it must be the box scaled down to A4 and shifted to the > center. > > Hope this example helps. I've reviewed the patch and have the following comments. It would have been a lot easier to review (and probably would have been reviewed earlier) if you avoided the unnecessary changes to convert if-else statements to case statements. Putting code style changes in a separate patch to the bug fix makes reviewing changes much easier. + int(pbbty), + int(width * xScale + pbbtx + 0.5), Using floor() and ceil() would be better and would make the code easier to understand. You appear to be ignoring the value of tx and ty prior to centering calculations. What happens if tx and ty are non zero at this point? I would be more comfortable with the patch if the page bbox calculations used the exact same transformation as is output to PS. I'm attaching a new patch that I think is a lot easier to understand. It uses the same transformation as is output to PS to calculate the bounding box.
_______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
