Image not stretched - 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: Image not stretched

Image not stretched 4 years 3 months ago #6968

  • maxbax666
  • maxbax666's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • 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 4 years 3 months ago #6974

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 846
  • Karma: 43
  • Thank you received: 12
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