[ 
https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16323835#comment-16323835
 ] 

chitgoks edited comment on PDFBOX-3353 at 1/12/18 1:58 PM:
-----------------------------------------------------------

[~tilman] i emailed you the pdf since i could not find a sample 270 degree page 
pdf that gets displayed as upright landscape.

i figure my problem is my quad coordinates. for portrait, it works correctly. 
but if 270 degrees and i recalculate the quad coordinates, this is my code

LEGEND
-----------------
pos[0] = x
pos[1] = y
pos[2] = width
pos[3] = height
-----------------

and Util.transformY is a convenience method to convert my top y to lower y.


{code:java}
if (rotation == 270) {
// x,y = 1,2
quad[c++] = Util.transformY(pageSize, pos[1]) - pos[3];
quad[c++] = pageSize.getWidth() - pos[0] - pos[2];
// x,y = 3,4
quad[c++] = Util.transformY(pageSize, pos[1]);
quad[c++] = pageSize.getWidth() - pos[0] - pos[2];
// x,y = 5,6
quad[c++] = Util.transformY(pageSize, pos[1]) - pos[3];
quad[c++] = pageSize.getWidth() - pos[0];
// x,y = 7,8
quad[c++] = Util.transformY(pageSize, pos[1]);
quad[c++] = pageSize.getWidth() - pos[0];
}
{code}



was (Author: chitgoks):
[~tilman] i emailed you the pdf since i could not find a sample 270 degree page 
pdf that gets displayed as upright landscape.

i figure my problem is my quad coordinates. for portrait, it works correctly. 
but if 270 degrees and i recalculate the quad coordinates, this is my code

LEGEND
-----------------
pos[0] = x
pos[1] = y
pos[2] = width
pos[3] = height
-----------------

and Util.transformY is a convenience method to convert my top y to lower y.

if (rotation == 270) {
                        // x,y = 1,2
                        quad[c++] = Util.transformY(pageSize, pos[1]) - pos[3];
                        quad[c++] = pageSize.getWidth() - pos[0] - pos[2];
                        // x,y = 3,4
                        quad[c++] = Util.transformY(pageSize, pos[1]);
                        quad[c++] = pageSize.getWidth() - pos[0] - pos[2];
                        // x,y = 5,6
                        quad[c++] = Util.transformY(pageSize, pos[1]) - pos[3];
                        quad[c++] = pageSize.getWidth() - pos[0];
                        // x,y = 7,8
                        quad[c++] = Util.transformY(pageSize, pos[1]);
                        quad[c++] = pageSize.getWidth() - pos[0];
                    }

> Create appearance streams for annotations
> -----------------------------------------
>
>                 Key: PDFBOX-3353
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3353
>             Project: PDFBox
>          Issue Type: Task
>          Components: PDModel, Rendering
>    Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox
>            Reporter: Tilman Hausherr
>              Labels: Annotations
>         Attachments: 270_hl.png, 270_st.png, 270_ul.png, 
> PDFBOX-3353-highlight-noAP-001796-p1.pdf, PDFBOX-3353-highlight-noAP.pdf, 
> ShowAnnotation-4.java, SquareAnnotations.pdf, 
> line_dimension_appearance_stream-noAP.pdf, 
> line_dimension_appearance_stream.pdf, showAnnotation.java, 
> text_markup_ap_test.pdf
>
>
> Create appearance streams for annotations when missing.
> I'll start by replacing current code for Ink and Link annotations.
> Good example PDFs:
> http://www.pdfill.com/example/pdf_commenting_new.pdf
> https://github.com/mozilla/pdf.js/issues/6810



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to