Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

Image not stretched

More
IP: 192.168.0.71 11 years 7 months ago #6968 by maxbax666
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
More
IP: 192.168.0.71 11 years 7 months ago #6974 by radaee
Replied by radaee on topic Image not stretched
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();
Time to create page: 0.387 seconds
Powered by Kunena Forum