AddAnnotBitmap is annotating a captured image - 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: AddAnnotBitmap is annotating a captured image

AddAnnotBitmap is annotating a captured image 4 years 2 months ago #7084

  • lokeshgrkumar
  • lokeshgrkumar's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
AddAnnotBitmap is annotating a user captured signature on the document with a WHITE background.
I need help to make this background transparent. Only the signature should be opaque.
Is this possible?

has_alpha, true/false still I'm unable to remove the white background

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

Last edit: by manfcas.

AddAnnotBitmap is annotating a captured image 4 years 2 months ago #7092

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 846
  • Karma: 43
  • Thank you received: 12
has alpha only works on bitmap has some transparent color value.
white background has alpha value 255.

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

AddAnnotBitmap is annotating a captured image 4 years 2 months ago #7103

  • lokeshgrkumar
  • lokeshgrkumar's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
String imagePath = ..............................................
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inDither = false;
opt.inPreferredConfig = Bitmap.Config.ARGB_8888;
bitmap = BitmapFactory.decodeFile(imagePath, opt);
bitmap.setHasAlpha(true);
signAdded = page.AddAnnotBitmap(bitmap, true, rect);
This is not working, is there another way I can annot signature without white background


DocGState dgs = m_doc.NewGState();
dgs.SetFillAlpha(0);// set alpha value to 1
dgs.SetStrokeAlpha(255);// set alpha value to 1

I have tried this too. :-(

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

Last edit: by manfcas.

transparent annotation to capture handwriting... 4 years 2 months ago #7109

  • lokeshgrkumar
  • lokeshgrkumar's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
public void addRemarksSignature(String imagePath, float[] rect) {
//setCache is set before call to this method
PDFPos pos = m_view.vGetPos((int) rect[0], (int) rect[1]);
PDFVPage vpage = m_view.vGetPage(pos.pageno);
m_view.vRender(vpage);
Page page = vpage.GetPage();
PageContent content = new PageContent();
content.Create();
content.GSSave();
DocGState dgs = m_doc.NewGState();
dgs.SetFillAlpha(255);// set alpha value to 1
dgs.SetStrokeAlpha(255);// set alpha value to 1
Page.ResGState rgs = page.AddResGState(dgs);
content.GSSet(rgs);
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inDither = false;
opt.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bitmap = BitmapFactory.decodeFile(imagePath, opt);
DocImage dimg = m_doc.NewImage(bitmap, true);
ResImage rimg = page.AddResImage(dimg);
Matrix mat = new Matrix(80, 80, 80, 400);
content.GSSetMatrix(mat);
mat.Destroy();
content.DrawImage(rimg);
content.GSRestore();
page.AddContent(content, true);
bitmap.recycle();
content.Destroy();
m_view.vRender(vpage);
}


This is still generating a white backgound rather than a tranparent background. Please help.

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

transparent annotation to capture handwriting... 4 years 2 months ago #7115

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 846
  • Karma: 43
  • Thank you received: 12
plz try a bitmap object loading from a transprent background PNG file, with RGBA color pace.

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

transparent annotation to capture handwriting... 4 years 2 months ago #7116

  • lokeshgrkumar
  • lokeshgrkumar's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
finally, it worked. Thanks a ton.

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

  • Page:
  • 1
Powered by Kunena Forum