I need to print a single page from a multipage pdf document.
1. How can I find the page
2. How can I tell it to print just that page only.
Thank you.
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile(@"F:\testing\pdf form testing\original document\9223.pdf");
PdfTextFind[] result = null;
foreach (PdfPageBase page in pdf.Pages)
{
result = (page.FindText("Special").Finds);
foreach (PdfTextFind find in result)
{
//find the page number you want
int pageNumber = find.SearchPageIndex;
PrintPage(pdf, pageNumber);
}
}
}
public static void PrintPage(PdfDocument doc, int index)
{
doc.PrintFromPage = index;
doc.PrintToPage = index;
doc.PrintDocument.Print();
}