dib render bitmap - 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: dib render bitmap

dib render bitmap 3 years 1 week ago #9768

  • marcohit
  • marcohit's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 2
  • Thank you received: 0
Hi, it's possible to render a pdf over a colored background using DIB.drawbitmap.
I try to use new function MulAlpha(), but it seem not work.
Many thanks in advance
Marco

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

dib render bitmap 3 years 1 week ago #9788

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Karma: 17
  • Thank you received: 65
Hi,
have you tried this code before rendering?
//Fills the bitmap's pixels with the specified Color.
bitmap.eraseColor(somecolor);

If you don't solve it with the above code, can you please send us the code you are using to render your pdf?

MulAlpha() is useful to put transparent images on the PDF as an overlay.
For more info check this: www.radaeepdf.com/support/knowledge-base...component&kbartid=24

"MulAlpha() :
when display Bitmap object, adjust color value as: R = R * alpha / 255; G = G * alpha / 255; B = B * alpha / 255; for Bitmap all alpha is 0 or all alpha is 255, this method can be ignored to invoke."

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

dib render bitmap 3 years 1 day ago #9852

  • stefano.sartori@hit.it
  • stefano.sartori@hit.it's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 0
Hi Davide, I have already reply to you on the dedicated ticket. I duplicate here my answer.
I have tried the solution of erasecolor, but it doesn't work.
This is the piece of code that we use for render pdf:
Matrix matrix = new Matrix();
matrix.postScale(width / pageBounds.width(), height / pageBounds.height());
matrix.postTranslate(pageSliceBounds.left * width, pageSliceBounds.top * height);
matrix.postScale(1 / pageSliceBounds.width(), 1 / pageSliceBounds.height());

final float[] matrixSource = new float[9];
matrix.getValues(matrixSource);

DIB dib = new DIB();
dib.CreateOrResize(width, height);


float ty = (float) Math.floor(actualHeight * matrixSource[4] - matrixSource[5]);//+1;
com.radaee.pdf.Matrix mat = new com.radaee.pdf.Matrix(matrixSource[0], -matrixSource[4], -matrixSource[2]-0, ty);

RenderPrePare(dib);
Render(dib, mat);
mat.Destroy();

Bitmap bitmap= Bitmap.createBitmap( width, height, Config.ARGB_8888);
bitmap.eraseColor(0xFF0000FF); // try with any color

BMP bmp = new BMP();
bmp.Create(bitmap);

dib.DrawToBmp(bmp, 0, 0);

bmp.Free(bitmap);
dib.Free();


Many thanks.

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

dib render bitmap 3 years 1 day ago #9853

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 846
  • Karma: 43
  • Thank you received: 12
hi that, RenderPrePare erase white to DIB.
so, u have to use Page.RenderToBMP() on Bitmap with background.

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

dib render bitmap 3 years 1 day ago #9855

  • marcohit
  • marcohit's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 2
  • Thank you received: 0
It works like a charm.
Great library, great support.
Many thanks.
:)
Marco

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

  • Page:
  • 1
Powered by Kunena Forum