Hello, I’m Nilesh

Category: Itextsharp

  • iTextSharp–Add watermark to PDF

    In the last post iTextSharp–Add header/footer to PDF we saw how to create a pdf with a header/footer. To add a watermark to pdf, you need to create a class that implements IPdfPageEvent as shown below code: Now let’s see how to add a watermark using the above class: After using the code above, it […]

  • iTextSharp–Add header/footer to PDF

    It’s a common requirement to have a header/footer on PDF, and it could be achieved using PageEvents in iTextSharp. It depends on the requirement, but in general, the header may contain: And footer may contain the following: Check out the below function that creates a sample PDF having five pages with a header and footer: […]

  • iTextSharp–Print PDF

    To print the HTML page, we use the below code. But the same can not be used to print the PDF as it won’t work. However, iTextSharp provides a way to print the PDF on the client side with the AddJavaScript method of PdfWriter. Check out the below code: It won’t print the PDF directly […]

  • iTextSharp – Add Image from base64 string

    Itexhsharp is a popular third-party component for creating PDFs with the .Net framework. If you’re using Itextsharp for the first time, I would suggest you go through Mike’s series on Itextsharp that helps you get started, and here is the article from the series that shows different ways to add images to Itextsharp. To add an […]