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

Free Support Forum - aspose.com

Forms in background when saving as PDF

I’m using Aspose 20.7 for .NET to save an Excel document as PDF. But there seems to be a problem with forms which are placed on an image. The forms should be on top of the image (and they are, when using excel to save as PDF), but when using Aspose they are hidden behind the image.
I’ve attached the excel file and two PDFs (one created with Aspose and one created with Excel). The strange thing is, that the problem only occurs on the second page. The other pages are fine. Also tried to bring the forms to the foreground but with no effect.
aspose.zip (6.1 MB)
aspose.zip (6.1 MB)

@csb.dev,

Thanks for the template file and output PDFs (by MS Excel and Aspose.Cells).

Please notice, we were able to reproduce the issue as you mentioned by converting your template file to PDF file format. We found some form shapes are set behind the image when rendering Excel file to PDF. We found the problem on the second page with form controls (e.g textfield, ellipse, etc.) are hidden behind the image. We have logged a ticket with an id “CELLSNET-47539” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@csb.dev,

We evaluated your issue further.

From the screenshot (see the attached screenshot for your reference), you can see that Page 1 and Page 2 splits at the end of Row 26. The image is started from Page 1 and split to Page 2. However, when the image is split to page 2, the relationship between the image and the other shapes is lost.

A workaround is to add a horizontal page break to make the image totally included in the Page 2.(e.g. add a page break between row 24 and row 25, similar to the other page breaks which has been already added.)
Code:

Workbook wb = new Workbook("Wassernetz Sozialtrakt.xlsx");
Console.WriteLine(wb.DefaultStyle.Font);

Worksheet sheet = wb.Worksheets["System 1"];
HorizontalPageBreakCollection hs = sheet.HorizontalPageBreaks;
hs.Add(24);

wb.Save("output.pdf");

Hope, this helps a bit.
paget break.png (210.8 KB)

We managed to resized the image, so that it fits to page 2 and now the PDF looks fine. This workaround is ok us. Thank you very much for your help.

@csb.dev,

Good to know that your issue is sorted out by the suggested workaround/sample code. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.