Details
-
Type:
Bug
-
Status:
Postponed
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 0.1.3
-
Fix Version/s: None
-
Component/s: Zend_Pdf
-
Labels:None
-
Fix Version Priority:Should Have
Description
If an existing PDF document is loaded which contains a page that is rotated, drawing pretty much doesn't work as the end-user would expect. The original report:
drawText renders text rotated 90 degrees counter-clockwise when using a 5.5(w) x 8.5(h) in. document. You can see an example of this at http://dfinc.net/pdf/nstv.pdf .
The problem Aaron is experiencing is that the page he's trying to draw to has been rotated 270 degrees and cropped in the page dictionary:
10 0 obj<</Contents[17 0 R 19 0 R 20 0 R 21 0 R 22 0 R 23 0 R 24 0 R 25 0 R] /Type/Page/Parent 4 0 R/Rotate 270/MediaBox[0 0 612 792] /CropBox[0.0 396.0 612.0 792.0]/Resources 11 0 R>> endobj
Zend_Pdf currently does not handle page rotation, so doesn't do anything special with the rotation entry in the page's dictionary.
The issue is that even though the page is "rotated", it is only rotated at display time; the page's coordinate system is unchanged. This is why the $line_1 y coordinate in the example below must be at just over 9 inches to appear on the page.
The illustration zf33illustration.png attached to this issue shows the actual drawing coordinate system for this page:
As a workaround, the user can rotate the drawing coordinate system with page->rotate($x, $y, $degrees) and then adjust the $x and $y coordinates appropriately, but this is a pain.
I'm not sure what we should actually do here. It would be convenient for the end-user if we 'automagically' rotated and translated the coordinate system if a rotated page is loaded, but there may be cases where such behavior is not desired.
Attachments
Issue Links
| This issue is duplicated by: | ||||
| ZF-129 | drawText flaw with non-standard document size (TRAC#153) |
|
|
|
This is the example of the issue. All that was used to generate this is the $page->drawText method.