private static void CheckPdf(string outputPdfPath)
{
var pdf = XPdfForm.FromFile(outputPdfPath);
PdfDocument outputDocument = new PdfDocument();
outputDocument.PageLayout = PdfPageLayout.SinglePage;
var page = outputDocument.AddPage();
using (XGraphics gfx = XGraphics.FromPdfPage(page))
{
XRect sourceRect = new XRect(0, 0, pdf.PixelWidth, pdf.PixelHeight);
// We don't really care about drawing the image of the page here, just forcing the
// reader to process the PDF file enough to crash if it is corrupt.
gfx.DrawImage(pdf, sourceRect);
}
}