Я хочу добавить номер страницы каждой страницы в экспорт pdf
<pre> public byte[] GetPDF(string pHTML) { byte[] bPDF = null; MemoryStream ms = new MemoryStream(); TextReader txtReader = new StringReader(pHTML); // we retrieve the total number of pages // 1: create object of a itextsharp document class Document doc = new Document(PageSize.LEGAL_LANDSCAPE, 10, 10, 42, 35); doc.SetPageSize(new Rectangle(850f, 1100f)); // 2: we create a itextsharp pdfwriter that listens to the document and directs a XML-stream to a file PdfWriter oPdfWriter = PdfWriter.GetInstance(doc, ms); // 3: we create a worker parse the document HTMLWorker htmlWorker = new HTMLWorker(doc); // 4: we open document and start the worker on the document doc.Open(); doc.NewPage(); //htmlWorker.StartDocument(); //// 5: parse the html into the document //htmlWorker.Parse(txtReader); List<IElement> elements = HTMLWorker.ParseToList(txtReader, null); foreach (IElement el in elements) { //If the element is a table manually set its header row count if (el is PdfPTable) { ((PdfPTable)el).HeaderRows = 2; } doc.Add(el); } // 6: close the document and the worker htmlWorker.EndDocument(); htmlWorker.Close(); doc.Close(); bPDF = ms.ToArray(); return bPDF; }
Что я уже пробовал:
i want add page number every page in export pdf