We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cropping not work properly for the first page of pdf

Hi there,

We are using AsposePDF.dll 18.10 (c# .net 4.7.2) to crop the pdfs to html. It works generally fine but for some pdfs cropping cannot work correctly at the first page. (Values of cropbox are ignored.) There is no problem for other pages. You can find the sample pdf below.

7501_1.pdf (5.6 MB)

var original_book = new Aspose.Pdf.Document(@"C:\7501_1.pdf");
original_book.Pages[1].CropBox = new Aspose.Pdf.Rectangle(29, 294, 283, 437);
Document cropped_area = new Document();
cropped_area.Pages.Add(original_book.Pages[1]);
string output_file_route = Path.Combine(@"C:\Deneme", "Output.html");
HtmlSaveOptions opt = new HtmlSaveOptions
{
    CompressSvgGraphicsIfAny = false,
    AntialiasingProcessing = HtmlSaveOptions.AntialiasingProcessingType.TryCorrectResultHtml,
    UseZOrder = true
};
cropped_area.Save(output_file_route, opt);

Thanks for any support.

@eminsanlier

We were able to replicate the issue in our environment while using 21.8 version of the API. Therefore, an issue as PDFNET-50514 has been logged in our issue tracking system for the sake of correction. We will further look into its details and keep you posted with the status of its resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.