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

TOPIC:

Image not stretched 9 years 8 months ago #6968

  • maxbax666
  • maxbax666's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 7
  • Thank you received: 0
Hi, when I insert a picture in an A4 page will be stretched.
The code I'm using is:

PageContent content = new PageContent();
content.Create();
content.GSSave();
Matrix mat = new Matrix(A4_width, A4_height, 0, 0);
content.GSSetMatrix(mat);
mat.Destroy();
content.DrawImage(rimg);
content.GSRestore();
page.AddContent(content, true);
content.Destroy();
page.Close();

How do I insert image keeping the proportions with the original size?
Thanks

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

Image not stretched 9 years 8 months ago #6974

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
like this:
float page_width = doc.GetPageWidth();
float page_height = doc.GetPageHeight();

PageContent content = new PageContent();
content.Create();
content.GSSave();
Matrix mat = new Matrix(page_width, page_height, 0, 0);//change to page_width and page_height.
content.GSSetMatrix(mat);
mat.Destroy();
content.DrawImage(rimg);
content.GSRestore();
page.AddContent(content, true);
content.Destroy();
page.Close();

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

  • Page:
  • 1
Powered by Kunena Forum