Hi team,
I am trying to crop image from PDF page, while cropping part of the images is also cropping.
Below the the code I am using.
foreach (Aspose.Pdf.Page page in docPdf.Pages)
{
Aspose.Pdf.Rectangle contextBox = page.CalculateContentBBox();
page.CropBox = contextBox;
page.MediaBox = contextBox;
using (FileStream imageStream =
new FileStream(imagePath, FileMode.Create))
{
Resolution resolution = new Resolution(350);
JpegDevice jpegDevice = new JpegDevice(resolution, 100);
jpegDevice.Process(page, imageStream);
imageStream.Close();
}
}
Attached sample files.samples.zip (2.0 MB)