My pdf document is returned but with two problems: Orientation is incorrect (it's set to Portrait when it's actually Landscape) and the Height is a negative value.
This is fine if I just return the document to the user as the PDF is readable. The problem is when I try to create the XGraphics as I'm doing it as follows:
This method doesn't accept negative values for the dimensions and therefore throws an exception. If I do Abs on the Height value, then it allows me to do the watermarking but the original pdf content doesn't show up anymore and I can only see the watermark.
Hi, I'm working on a watermarking of a document and I've got a
stream
as an input. I try to open it doing the following:PdfDocument document = PdfReader.Open(stream, PdfDocumentOpenMode.Modify);
My pdf document is returned but with two problems: Orientation is incorrect (it's set to Portrait when it's actually Landscape) and the Height is a negative value.
This is fine if I just return the document to the user as the PDF is readable. The problem is when I try to create the
XGraphics
as I'm doing it as follows:XGraphics gfx = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Append);
This method doesn't accept negative values for the dimensions and therefore throws an exception. If I do
Abs
on the Height value, then it allows me to do the watermarking but the original pdf content doesn't show up anymore and I can only see the watermark.Can somebody help with this issue?
Adding up some details about this particular pdf: