Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Submit your requests and polls about new features

TOPIC:

Annotations 11 years 5 months ago #731

  • ricardo.cadete
  • ricardo.cadete's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 9
  • Thank you received: 0
Hi again,

I am going to need some help here. I could not found a example to explain how to use this new method: AddAnnotEditbox()


So imagine that I want to place a text in coordinates (100px, 80px) of PDF file.
How should I use this method?
page.AddAnnotEditbox(matrix, rect, tsize, 0x00FF0000);

-matrix -> should I worry about this?
-rect - > "left, top, right, bottom in DIB coordinate system." this seems to be easy if DIB means px of PDF file.
-tsize ->"test size in DIB coordinate system" test? What this means?
-color -> this is clear for me

What DIB means?
How should I know the size of the box If this is going to depend on the font to be applied on this box?
How should I apply the font?

Best regards

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

Annotations 11 years 5 months ago #732

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
matrix -- the matrix passed to render function.
rect -- rect in DIB object.
tsize -- text size(sorry)

DIB means the bitmap that you had render out.

the font set by Global.setTextFont in Global.Init()

after you invoke this, page no any change,
because the edit box has no border and background.

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

Last edit: by .

Annotations 11 years 5 months ago #750

  • ricardo.cadete
  • ricardo.cadete's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 9
  • Thank you received: 0
Thank you,
do you think possible to have a example where explains how to place a text in coordinates (100px, 80px)?

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

Last edit: by cruzexx.

Annotations 11 years 5 months ago #755

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
sorry, we write Matrix as int, this is wrong.
we will fix it in next version.
to add edit box you need codes like this:
			bitmap.eraseColor(0xFFFFFFFF);
			Page page = m_doc.GetPage(pageno);
			if( page != null )
			{
				Matrix mat = new Matrix(m_ratio, -m_ratio, 0, m_doc.GetPageHeight(0) * m_ratio);
				page.RenderToBmp(bitmap, mat);
				float rect[] = new float[4];
				rect[0] = 100;
				rect[1] = 80;
				rect[2] = rect[0] + 100;
				rect[3] = rect[1] + 20;
				page.AddAnnotEditbox(mat, rect, 18, 0);
				mat.Destroy();
				page.Close();
				m_doc.Save();
			}

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

Last edit: by .

Annotations 11 years 2 weeks ago #1994

  • erikatomanderson
  • erikatomanderson's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 4
  • Thank you received: 0
Hello, I am trying to test out the free text annotations in the demo app. I'm afraid I don't know where to get the bitmap to use. Do I need to create a bitmap and addAnnotBitmap to the page? Or is there another bitmap that I would use and clear? Thanks for your help.

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

Annotations 11 years 1 week ago #1995

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
no need to create Bitmap object to add FreeText annotation, like this:
	bitmap.eraseColor(0xFFFFFFFF);
	Page page = m_doc.GetPage(pageno);
	if( page != null )
	{
		Matrix mat = new Matrix(m_ratio, -m_ratio, 0, m_doc.GetPageHeight(0) * m_ratio);
		page.ObjsStart(bitmap, mat);
		float rect[] = new float[4];
		rect[0] = 100;
		rect[1] = 80;
		rect[2] = rect[0] + 100;
		rect[3] = rect[1] + 20;
		page.AddAnnotEditbox(mat, rect, 18, 0);
		mat.Destroy();
		page.Close();
		m_doc.Save();
	}

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

Powered by Kunena Forum