Thanks for the reply, Thomas.
The reason I believe it's a permissions issue, is that the code ran on dev and test servers without issue. The file paths are fine, as the equivalent iTextSharp code works fine when supplied the exact same stream and watermark pdf file.
What's really strange to me is that the output just hangs at a white screen forever. No server timeout, no nothing. If there are no logical reasons for this to happen.... I might give it another go this weekend. This is a production server, so I can't do much to test on it during the week.
Here's the code I came up with. Maybe you could look it over and give me a sanity check?
Code:
Dim oPDFReport As PdfDocument = PdfReader.Open(oStream)
Dim oWatermarkDR As cReportWatermarkDR
For Each oWatermarkDR In colReportWatermarkList
Dim oPDFWatermark As XPdfForm = XPdfForm.FromFile(oWatermarkDR.FilePath)
If oWatermarkDR.PageNum = k_iNull_Numeric Then 'no page specified, watermark all
Dim iPage As Int16
For iPage = 0 To oPDFReport.Pages.Count - 1
Dim oPage As PdfPage = oPDFReport.Pages(iPage)
Dim gfx As XGraphics = XGraphics.FromPdfPage(oPage, XGraphicsPdfPageOptions.Append)
gfx.DrawImage(oPDFWatermark, New XRect(0, 0, oPage.Width, oPage.Height))
Next
Else 'watermark only a specific page
Dim oPage As PdfPage = oPDFReport.Pages(oWatermarkDR.PageNum - 1)
Dim gfx As XGraphics = XGraphics.FromPdfPage(oPage, XGraphicsPdfPageOptions.Append)
gfx.DrawImage(oPDFWatermark, New XRect(0, 0, oPage.Width, oPage.Height))
End If
Next
oPDFReport.Save(oStream, False)