Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

page.AddAnnotEditbox: text is rotated 90 degress

More
10 years 7 months ago #10311 by max.pfeiffer
Dear support team,
to reproduce:
  • add a text annotation with page.AddAnnotEditbox
  • Pdf A4 page is in landscape orientation
  • text becomes rotated 90 degrees
When adding the annotation to a A4 page in regular portrait orientation I don't have any rotation issues.

When I call page.AddAnnotBitmap or page.AddAnnotInk on the same page I don't have any rotation issues. In all cases I use vpage.CreateInvertMatrix and mat.TransformRect or mat.TransformInk to calculate the position.

It seems that the library deals differently with text annotations. Could you please point me in the right direction?
I am pretty stuck here.

My code for the funtion is here:
Code:
case MotionEvent.ACTION_UP: { if( m_rects != null ) { PDFVPageSet pset = new PDFVPageSet(len); for( cur = 0; cur < len; cur += 4 ) { PDFPos pos = m_layout.vGetPos((int)m_rects[cur], (int)m_rects[cur + 1]); VPage vpage = m_layout.vGetPage(pos.pageno); Page page = m_doc.GetPage(vpage.GetPageNo()); if( page != null ) { Matrix mat = vpage.CreateInvertMatrix(m_layout.vGetX(), m_layout.vGetY()); float rect[] = new float[4]; if( m_rects[cur] > m_rects[cur + 2] ) { rect[0] = m_rects[cur + 2]; rect[2] = m_rects[cur]; } else { rect[0] = m_rects[cur]; rect[2] = m_rects[cur + 2]; } if( m_rects[cur + 1] > m_rects[cur + 3] ) { rect[1] = m_rects[cur + 3]; rect[3] = m_rects[cur + 1]; } else { rect[1] = m_rects[cur + 1]; rect[3] = m_rects[cur + 3]; } mat.TransformRect(rect); float textSize = 12.0f; float width = Math.abs(rect[0] - rect[2]); float height = Math.abs(rect[1] - rect[3]); if (width > (textSize * 2.0f) && height > (textSize * 1.0f)) { page.ObjsStart(); if (page.AddAnnotEditbox(rect, Color.BLACK, 0, Color.BLACK, textSize, Color.BLACK)) { Page.Annotation newAnnot = page.GetAnnot(page.GetAnnotCount() - 1); editBoxDrawRect = false; invalidate(); showEditText(newAnnot, vpage, page); } else { // Adding annotation failed for some reason editBoxDrawRect = false; invalidate(); page.Close(); } } else { // Box is too small to add text editBoxDrawRect = false; invalidate(); page.Close(); } mat.Destroy(); } } } break; }
More
10 years 6 months ago #10329 by Davide
More
10 years 6 months ago #10342 by max.pfeiffer
I confirm that it fixes that issue. Thanks Davide.
Time to create page: 0.394 seconds
Powered by Kunena Forum