I'm generating PDF files using PDFsharp, and I need to overlay the PDF I'm generating with a specific page from another PDF.
I've created this method:
private void ApplyOverlay(XGraphics graph, string overlaypdfPath, int pageNumberInOverlay, XRect coordinates)
{
var xPdf = XPdfForm.FromFile(overlaypdfPath);
if(xPdf.PageCount < pageNumberInOverlay)
throw new Exception("not enough pages");
//Here i need to take from xPdf just the page number -> pageNumberInOverlay
graph.DrawImage(xPdfPageN, coordinates);
}
I don’t know how to select only a specific page.