Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

Add Plane Text on PDF file 4 years 11 months ago #14353

  • kross001
  • kross001's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
Hi,

I need a small help from your team to add Plane Text on PDF File.
Please help me.

Thanks
Kevin Ross

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

Add Plane Text on PDF file 4 years 11 months ago #14354

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
OK, if you mean the Page Content Stream the codes like:
        PageContent content = new PageContent();
	content.Create();//create content, do not forget.
		//prepare to write texts
		content.GSSave();
		mat = new Matrix( 1, 1, 80, 200 );
		content.GSSetMatrix(mat);
		mat.Destroy();
        //the font name must exists on font list, that initialized in Global.Init();
	DocFont dfont = m_doc.NewFontCID("DroidSansFallback", 3 | 8);//bold-italic and embed in horizontal writing
        if(dfont == null)
        {
            dfont = m_doc.NewFontCID("Roboto-Regular", 3 | 8);
            if(dfont == null)
                dfont = m_doc.NewFontCID("DroidSans", 3 | 8);
        }
		ResFont rfont = page.AddResFont(dfont);

		content.TextBegin();
		content.TextSetFont(rfont, 16);//set font and size
		content.SetFillColor(0x8000);//set fill color to black-green.
		content.SetStrokeColor(0x80);//set stroke color to black-red.
		content.TextSetCharSpace(0);
		content.TextSetWordSpace(0.2f);
		content.TextSetLeading(16);
		content.TextSetRenderMode(2);//fill and stroke
		content.TextSetHScale(120);//set horizontal scale
		content.DrawText("Hello word!\rNice to meet you!");
		content.TextEnd();
		content.GSRestore();
		page.AddContent(content, true);
		content.Destroy();
		page.Close();
if you mean annotation, you can using Page.AddAnnotEditbox() to add an editbox on page,
and then using Annotation.SetEditText() to set text value.

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

  • Page:
  • 1
Powered by Kunena Forum