page.AddAnnotEditbox: text is rotated 90 degress - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: page.AddAnnotEditbox: text is rotated 90 degress

page.AddAnnotEditbox: text is rotated 90 degress 2 years 10 months ago #10311

  • max.pfeiffer
  • max.pfeiffer's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Karma: 1
  • Thank you received: 1
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:
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;
			}

Please Log in or Create an account to join the conversation.

page.AddAnnotEditbox: text is rotated 90 degress 2 years 10 months ago #10329

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Karma: 18
  • Thank you received: 65
Hi,
this new beta version fixes the issue: www.radaeepdf.com/download/download-prev...4-radaeepdf-362beta2
The following user(s) said Thank You: max.pfeiffer

Please Log in or Create an account to join the conversation.

page.AddAnnotEditbox: text is rotated 90 degress 2 years 10 months ago #10342

  • max.pfeiffer
  • max.pfeiffer's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Karma: 1
  • Thank you received: 1
I confirm that it fixes that issue. Thanks Davide.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum