write an zh+en string on a 90 degree page, the orientation is error #4383
Replies: 3 comments
-
It is unclear what you are actually reporting. None of your comments report an error or behavior contrary to what has been documented.
|
Beta Was this translation helpful? Give feedback.
-
I have closed your other issue #4378 which documents how to resolve the "problem" you mention in your comment: By using the page's rotation matrix, you can insert text with desired position / rotation. |
Beta Was this translation helpful? Give feedback.
-
Hello, thank you for your detailed response. What I meant to express is: When the page orientation is displayed as landscape and page.rotation returns 0, the output of write_text appears normal. However, when page.rotation returns 90, the text direction output by write_text is rotated 90 degrees to the right. According to your reply, page.remove_rotation() removes the rotation, and at this point page.rotation returns 0, but the output direction of write_text still has issues. I am an amateur Python enthusiast who occasionally writes code to help solve work-related problems and improve efficiency. As such, my understanding of highly technical documentation is quite superficial. You mentioned that write_text supports rotation parameters, but I could only find its matrix parameter. I am unsure how to use this matrix to correct the coordinates. Attached is the modified code I used to display different results on the same page using different methods. Thank you again for your response.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When the page.rotation is 90 degrees (displayed as landscape orientation), the header/footer text positioning becomes problematic, whereas it works fine when page.rotation is 0 degrees (also landscape orientation by default). The issue manifests as text vertically aligned along the right edge of the page from top to bottom - essentially normal horizontal text rotated 90 degrees clockwise around the right edge as the origin. However, TextWriter's append() and write_text() methods lack a rotate parameter, making it unclear how to correct this orientation.
If using insert_text() with mixed Chinese/English text, English letters and numbers occupy double-width spacing (visually unappealing) and the pre-calculated text width becomes inaccurate, causing truncation. insert_htmlbox() appears to embed fonts regardless of font-family specifications, bloating file sizes from 700KB to over 30MB compared to insert_text().
The goal is to either:
Use insert_text() with fontname="cjk" while maintaining consistent Chinese/English character spacing, OR
Implement TextWriter with proper text positioning that handles page rotation correctly.
attached files:
test1-out.pdf
test-2-landscape.pdf
test2-out.pdf
test-1-portrait.pdf
Beta Was this translation helpful? Give feedback.
All reactions