![]() Similarly, don't forget to add doc.Add(tbl) statement which places an instance of PdfPTable() in the document. Do not forget to create an instance of PdfWriter() because otherwise we can't write anything in the PDF.You can download the sample PDF file by clicking on the link "Download Sample PDF"! And that's it! Now run the application.PCell.UseAscender = true //Setting property to "true" along with setting to "PdfPCell.ALIGN_MIDDLE" helps to align the text in the cell at vertically middle position. PCell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE PCell.HorizontalAlignment = PdfPCell.ALIGN_LEFT Private void ApplyPrintSettingsToCell(PdfPCell pCell) Return File(byteArray, "application/pdf", "Simple Tense.pdf") PdfPCell cell = new PdfPCell(new Phrase("Simple Present Tense")) Ĭell = new PdfPCell(new Phrase("I write a letter.")) Ĭell = new PdfPCell(new Phrase("Simple Past Tense")) Ĭell = new PdfPCell(new Phrase("I wrote a letter.")) Ĭell = new PdfPCell(new Phrase("Simple Future Tense")) Ĭell = new PdfPCell(new Phrase("I will write a letter.")) Tbl.WidthPercentage = 100.0f //Allow the table to take up the full width available (after applying default margins for A4 sized paper - Because I haven't set any margins explicitly!) Here, Width of 2nd column = 3 * (Width of 1st column) Execute this command : Install-Package iTextSharp -Version ) //Set relative widths of the columns.Tools → NuGet Package Manager → Package Manager Console.Install iTextSharp using package manager console.→ Select “Web” as a type of project under “C#” → Enter name for your web application (PDFDemo) → Click “OK” to navigate to next window → Select “Empty” as a template type with check marked checkbox for “MVC” → Click “OK”) Open Visual Studio and create a new empty MVC application.(I am using VS 2015 Express edition for Web.) ![]() Let's create an MVC application for demonstration purpose.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |