RadaeePDF.com :: Topic: Image not stretched (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: Image not stretched

Image not stretched 3 years 3 months ago #6968

  • maxbax666
  • maxbax666's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 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
The administrator has disabled public write access.

Image not stretched 3 years 3 months ago #6974

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
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();
The administrator has disabled public write access.
Powered by Kunena Forum