|
Rank: Newbie Groups: Member
Joined: 2/26/2013 Posts: 5
|
Hi, I'm trying to add a (full screen) overlay over existing PDF files. I have changed several options, using convertHTML and PdfImageContent, and tried all kinds of output- and page settings, but the image is always added in the lower right of the PDF and looks like it rotated automatically.
Code: C#
HtmlToPdfOptions options = new HtmlToPdfOptions();
options.PageSize = PdfPageSizes.A4;
foreach (var page in pdfDoc.Pages)
HtmlToPdf.ConvertHtml("<img src='" + watermarkImageUrl + "' />", page, options);
Brought it down to barebone and it does exactly the same. The image is exactly the size of A4. What am i doing wrong? How would i continue ? Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi, What version do you use? It appears that the original PDF file you use has been rotated. You can send us both the PDF file and the image file and we will be happy to take a look. See here for more details on how to send test files to us: https://www.essentialobjects.com/forum/test_project.aspxThanks!
|
|
Rank: Newbie Groups: Member
Joined: 2/26/2013 Posts: 5
|
2018 version fixes this.
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Great. Thanks for confirming the fix!
|
|
Rank: Newbie Groups: Member
Joined: 2/26/2013 Posts: 5
|
One minor change in the code though. it seems that pdf.Pages is yielding the result (?). Making changes to page causes the collection to change, thus throwing an error. This can be fixed by casting it to a list.
Code: C#
foreach (var page in pdfDoc.Pages.ToList())
// etc
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Yes. If you modify the page collection you will get an exception. Thanks for sharing your solution.
|
|