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

Free Support Forum - aspose.com

Modifying large Pdf (A1-format) is saved as a4-format

Hi,


I have a PDF with A1 page size.
I add a table (Aspose.pdf.table) and save the document.
When I open the document the format is A4.
Pageinfo has wrong values. (PDFNEWNET-35879).

I am using Aspose.pdf version 9.7.

Thank you for any help you can provide.

/Rune

Hi Rune,


Thanks for your inquiry. Please share your sample document and code here, We will investigate it and will guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,
Hi Ahmad,

Here is some sample code:

using (var pdf = new Aspose.Pdf.Document("c:\\temp\\a1.pdf"))
{
var table = new Table
{
Left = 0,
Top = 0,

Border = new BorderInfo(BorderSide.All, 0.1f),
DefaultCellBorder = new BorderInfo(BorderSide.All, 0.1f),
DefaultCellPadding = new MarginInfo(1, 1, 1, 1),
DefaultCellTextState = { FontSize = 5 },
ColumnWidths = "15 80 52"
};

var row = table.Rows.Add();
row.Cells.Add("Utført");
row.Cells.Add("Handling");
row.Cells.Add("Utført av");

pdf.Pages[1].Paragraphs.Add(table);

pdf.Save("c:\\temp\\a1_modified.pdf");
}

Thanks,
BerntRune

Hi Bernt,


Thanks for sharing the source document. Please note your document page have rotation parameter set to 90 degrees. That’s why actual visible page size differs (height and width are “swapped”).

In order to take into consideration page rotation, we have Page.GetPageRect(bool considerRotation) method. If we pass considerRotation parameter as true then it consider rotation angle and return actual rectangle dimensions. Please check following code snippet.


Aspose.Pdf.Document doc = new Aspose.Pdf.Document(myDir + “a1_modified.pdf”);<o:p></o:p>

foreach (Page page in doc.Pages)<o:p></o:p>

{<o:p></o:p>

Aspose.Pdf.Rectangle rect = page.GetPageRect(true);<o:p></o:p>

Console.WriteLine(“Page {0} width is {1} and heigth is {2}, rotation: {3}, size considering rotation: widht {4} : height {5}”, page.Number, page.Rect.Width, page.Rect.Height, page.Rotate.ToString(), rect.Width, rect.Height);<o:p></o:p>

}<o:p></o:p>

<o:p> </o:p>

<o:p>Please feel free to contact us for any further assistance.</o:p>

<o:p>
</o:p>

<o:p>Best Regards,</o:p>

Hi Ahmad,


Thanks for your reply. I still wonder why the pdf is saved/cropped as A4-format after adding the table?
When I reopen the pdf the document is A4 and not A1.
Do I need to set the pagesize after adding the table?

Thanks,
BerntRune

Hi Brent,


Thanks for your feedback. I see both A1.PDF and A1_modified.PDF files with same page size i.e 11.69 x 8.26. I have tested the scenario with Aspose.Pdf for .NET 9.7.0, please download and try latest release of Aspose.Pdf for .NET. If issue persist then please share your output PDF document for further investigation.

We are sorry for the inconvenience caused.

Best Regards,

Hi Ahmad,


My bad. The testfile I provided was already in A4 format. Please try again with the attached file (A1.pdf).
My enclosed image (result.png) shows the result before and after running the code.

Thanks,
BerntRune


Hi Bernt,

Thanks for sharing the source PDF document. While testing the scenario with your shared document, we have managed to reproduce the issue with latest version of Aspose.Pdf for .NET 9.7.0. We have logged a ticket PDFNEWNET-37699 in our issue tracking system for further investigation and resolution. We will notify you as soon as it is resolved.

We are sorry for the inconvenience caused.

Best Regards,

Hi Ahmad,


Thank you for investigating the issue.
I also have a question regarding the rotation of the inserted table.
The table was supposed to be inserted horizontally, but as you can see it is rotated 90 degrees.
How can I control the rotation of the inserted table?

Thanks,
Bernt Rune

Hi Bernt,


Thanks for your inquiry. After initial investigation, I have logged a ticket PDFNEWNET-37708 in our issue tracking system for further investigation and resolution. We will keep you updated about the issue resolution progress via this forum thread.

We are sorry for the inconvenience caused.

Best Regards,

Hi Ahmad,


I’m working on a software solution for my company where Aspose.pdf is a vital component and deadline is creeping up on me. When can I expect these issues to be resolved?

Thanks,
Bernt Rune

Hi Bernt,


Thanks
for your patience.
<o:p></o:p>

As we recently have been able to notice this issue, so development team requires little time to investigate and figure out the reasons of this problem. Nevertheless, as soon as we have made some definite progress towards its resolution, we would be more than happy to update you with the status of correction.

Our humble request is to
please be patient and spare us little time.

The issues you have found earlier (filed as PDFNEWNET-37699) have been fixed in Aspose.Pdf for .NET 9.8.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as PDFNET-37708) have been fixed in Aspose.Pdf for .NET 17.5.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.