iTextSharp.text.Document.Open C# (CSharp) Метод

Open() публичный Метод

Opens the document.
Once the document is opened, you can't write any Header- or Meta-information anymore. You have to open the document before you can begin to add content to the body of the document.
public Open ( ) : void
Результат void
        public virtual void Open()
        {
            if (! close) {
                open = true;
            }
            foreach (IDocListener listener in listeners) {
                listener.SetPageSize(pageSize);
                listener.SetMargins(marginLeft, marginRight, marginTop, marginBottom);
                listener.Open();
            }
        }

Usage Example

Пример #1
0
        public override void SaveFileAs(string fileName, FileType type)
        {
            // step 1: creation of a document-object
            iTextSharp.text.Document myDocument = new iTextSharp.text.Document(PageSize.A4.Rotate());
            try
            {
                // step 2:
                // Now create a writer that listens to this doucment and writes the document to desired Stream.
                PdfWriter.GetInstance(myDocument, new FileStream(fileName, FileMode.CreateNew));

                // step 3:  Open the document now using
                myDocument.Open();

                // step 4: Now add some contents to the document
                myDocument.Add(new iTextSharp.text.Paragraph(parsedFile.contentRaw));
            }
            catch (iTextSharp.text.DocumentException de)
            {
                Console.Error.WriteLine(de.Message);
            }
            catch (IOException ioe)
            {
                Console.Error.WriteLine(ioe.Message);
            }
            myDocument.Close();
        }
All Usage Examples Of iTextSharp.text.Document::Open