Free Support Forum - aspose.com

Header not inserted with correct orientation

Hi,

We have a problem with inserting a html in the header of each page of a PDF document that has the Landscape orientation (see HeaderProblem - input.pdf). The PDF will be embedded in a bigger PDF (see HeaderProblem - ouput.pdf).

Here is the code we are using for inserting the html:

//stream is the input stream that contains the PDF
//html is the html we are inserting
var pdfDocument = new PdfDocument(stream);
for (int i = 1; i <= pdfDocument.Pages.Count; i++)
{
var hf = new AsposePdf.HeaderFooter { Margin = new MarginInfo(40, 0, 40, 0) };
var html = new HtmlFragment(html)
{
Margin = new MarginInfo(0, 0, 0, 40)
};
headerData.CurrentPage++;
hf.Paragraphs.Add(html);
pdfDocument.Pages[i].Header = hf;
}

Here is the html:











A: {1}

B: {2}









C

{3}

D

{4}

E

{5}

F

{6}



So the html is basically a table of data that has an image on top left and text in the rest of the cells.

We have a problems with the outcome (see HeaderProblem - ouput.pdf). Aspose.Pdf will insert html with the wrong orientation. So instead of having it horizontal, it will insert it vertically.

Is this an issue you are aware of? Is there a workaround for this?

Thanks!

Hi Panos,

Thanks for your inquiry. I have tested your scenario with shared document using Aspose.Pdf for .NET 11.8.0 and managed to observe the header orientation issue. For further investigation, I have logged an issue in our issue tracking system as PDFNET-41221 and also linked your request to it. We will keep you updated via this thread regarding the issue status.

We are sorry for the inconvenience caused.

<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;mso-fareast-font-family:
Calibri;color:#333333;mso-ansi-language:EN-US;mso-fareast-language:EN-US;
mso-bidi-language:AR-SA”>Best Regards,

Hi,

Thanks for keeping us up to date.

Looking forward for the fix.

Hi Panos,


Thanks for your feedback. Sure, we will notify you as soon as we made some significant progress towards issue resolution.

Best Regards,

Hi,

Are there any developments on this issue?

We tried to add the table directly inside each page using the code

pdfDocument.Pages[0].Paragraphs.Add(table)

but the table is still inserted with wrong orientation
.
Is there any other way to add a table at the top of landscape pages? Or anything we can do to the page to “fix” it so that it behaves properly from that point onward?

Thank you!

@gwert

Thanks for posting your inquiry.

I am afraid that earlier logged issue has not been yet resolved due to other high priority issues in the queue. We have also checked the PDF document again, which was shared by you earlier and noticed that its page was already rotated on 270 degree. Which is possibly the reason of the issue occurrence. I am afraid that we cannot share any workaround yet as investigation of the issue is not yet completed.

We have recorded your concerns to escalate the issue to next level and as soon as we make some significant progress towards its rectification, we will inform you. We highly appreciate your patience and comprehension in this regard.

We are sorry for the inconvenience.

Hi,

Thank you for getting back on this issue.

Will it help to change rotation on those pages?

@gwert

We have also tried by changing the rotation of the pages, but in the shared PDF document, the content has been added with respect to already specified rotation. So if we change rotation, the content of the PDF document also gets rotated.

Hi,

Is there any way we can ‘flatten’ the rotation of all pages?
That is, if a page is rotated 270 then do some changes to the page so that the content stays the same but the rotation is Rotate.None?

Regards.

@gwert

Thanks for your inquiry.

I am afraid that currently there is no way to do that, as the page content will also be rotated if we reset or change the page rotation. However, we will further investigate your this requirement and will share our investigation results with you as soon as we have some. Please spare us little time.

We are sorry for the inconvenience.

Hi,

Thank you for getting back on this one.

I understand that rotating a page will rotate the already rotated content… That is clear to me.
I am only asking if there is a way to alter the page so that the content stays where it is (relative to page’s virtual orientation calculated on width and height) but the final value of Rotate of the page is None.

Best regards.

@gwert

Thanks for writing back.

For now, API is unable to reset page rotation without effecting its content, as we tested it with your PDF document as well. An investigation ticket i.e. PDFNET-44927 has been logged in our system, for your requirement. We will further investigate the feasibility of this feature and let you know once we have some significant feedback. Please spare us little time.

We are sorry for the inconvenience.

Hi,

Can you please share any update on this issue?

Thank you!

@gwert

Thanks for your inquiry.

I am afraid that earlier logged issues are not yet resolved due to high numbers of pending issues in the queue. As issues have been logged under free support model, they will be resolved on first come first sever basis. As soon as we have some definite updates regarding issues resolution, we will let you know. Please spare us little time.

We are sorry for the inconvenience.