



PdfWriter writer = new PdfWriter("C:\\demo.pdf") Must have write permissions to the path folder Finally, we need to close the document object by calling the Close() method. Following is the code snippet to create a paragraph object and add it to the document object. We can achieve this by creating a paragraph object. Header Content is center aligned to the document and I set the font size to 20. Adding a HeaderĪdd a header to the PDF document. I will add a Header, SubHeader, Line Separator, Image, Table, Hyperlink, and finally page numbers to the PDF document. SetTextAlignment: Sets the text alignment, such as Left, Right, Center, and so forth.SetFontSize: Sets the font size of the text.Paragraph: Creates a paragraph, initialized with some text.Document: Creates a document from in-memory PdfDocument.It will open a PDF document in writing mode. PdfDocument: In-memory representation of the PDF document.PdfWriter: To pass the file name and write content to the document.
Itext pdf to image convert install#
Select “Browse” and, in the search box, type itext7 and select itext7 from the searched results and install (see Figure 3).įollowing are the helpful classes and methods to generate the PDF document: Right-click the project name and select “Manage NuGet Packages…”. On the “New Project window”, select the Console App(.NET Framework) and give the project a name, as shown in Figure 1.įigure 1: Selecting the Console App(.NET Framework) Step 2: Install iText 7 Using “Manage NuGet Packages…” In Visual Studio, go to File -> New -> Project. Setting Up the Project Step 1: Create the Console App Using Visual Studio
