PDFsharp & MigraDoc Forum
https://forum.pdfsharp.net/

How to draw image after crop
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2173
Page 1 of 1

Author:  shahdat85ict [ Sun Oct 21, 2012 4:56 pm ]
Post subject:  How to draw image after crop

Hi

Say, my image width = 100 and height=500
I would like to draw the image in a rectangle where rectangle width = 100 but height = 300
if I use gfx.DrawImage(image, 0, 0, 100, 300); image is stretch in height.
So, Is there any way to crop the image of 100x500 by 100x300?

I have tried by below

XImage img = XImage.FromFile(imgPath);
XRect xSrcRect = new XRect(0,0, 100, 500);
XRect xCropRect = new XRect(0, 0, 100, 300);
gfx.DrawImage(img, xSrcRect, xCropRect, XGraphicsUnit.Point);

But no luck

Thanks
Shahdat

Author:  Thomas Hoevel [ Mon Oct 22, 2012 7:59 am ]
Post subject:  Re: How to draw image after crop

Hi!
PDFsharp does not currently crop images.
Please create a new memory bitmap (100x300 for your example) and copy the area you want to show.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/