iTextSharp.text.html.simpleparser.HTMLWorker.EndDocument C# (CSharp) Method

EndDocument() public method

public EndDocument ( ) : void
return void
        public virtual void EndDocument() {
            foreach (IElement e in stack)
                document.Add(e);
            if (currentParagraph != null)
                document.Add(currentParagraph);
            currentParagraph = null;
        }
        

Usage Example

示例#1
8
        public byte[] GetPDF(string pHTML)
        {
            byte[] bPDF = null;

            MemoryStream ms = new MemoryStream();
            TextReader txtReader = new StringReader(pHTML);

            // 1: create object of a itextsharp document class
            Document doc = new Document(PageSize.A4, 10, 10, 10, 5); //era tudo 25

            // 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();
            htmlWorker.StartDocument();

            // 5: parse the html into the document
            htmlWorker.Parse(txtReader);

            // 6: close the document and the worker
            htmlWorker.EndDocument();
            htmlWorker.Close();
            doc.Close();

            bPDF = ms.ToArray();

            return bPDF;
        }
All Usage Examples Of iTextSharp.text.html.simpleparser.HTMLWorker::EndDocument