An invisible border of pdfptable

The Border Elements of the PdfPTable are defined by the PdfPCell which are added to the table. Each Cell will have its own style/formatting. Here is the API: http://api.itextpdf.com/ Example PdfPTable table = new PdfPTable(2); PdfPCell cellOne = new PdfPCell(new Phrase(“Hello”)); PdfPCell cellTwo = new PdfPCell(new Phrase(“World”)); cellOne.setBorder(Rectangle.NO_BORDER); cellOne.setBackgroundColor(new Color(255,255,45)); cellTwo.setBorder(Rectangle.BOX); table.addCell(cellOne); table.addCell(cellTwo); If you … Read more

How can I convert image url to system.drawing.image

You could use WebClient class to download image and then MemoryStream to read it: C# WebClient wc = new WebClient(); byte[] bytes = wc.DownloadData(“http://localhost/image.gif”); MemoryStream ms = new MemoryStream(bytes); System.Drawing.Image img = System.Drawing.Image.FromStream(ms); VB Dim wc As New WebClient() Dim bytes As Byte() = wc.DownloadData(“http://localhost/image.gif”) Dim ms As New MemoryStream(bytes) Dim img As System.Drawing.Image = … Read more

c# itextsharp PDF creation with watermark on each page

After digging into it I found the best way was to add the watermark to each page as it was created. To do this I created a new class and implemented the IPdfPageEvent interface as follows: class PdfWriterEvents : IPdfPageEvent { string watermarkText = string.Empty; public PdfWriterEvents(string watermark) { watermarkText = watermark; } public void … Read more

Dependency error in jasper-reports from itext

A much simpler solution may be to upgrade to a newer version of jasperreports. Version 6.1.0 has this dependency on iText: <dependency> <groupId>com.lowagie</groupId> <artifactId>itext</artifactId> <version>2.1.7.js2</version> <scope>compile</scope> </dependency> No more “floating” dependency on iText, and it’s a version that’s custom made for jasperreports! See http://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports/6.1.0 for the complete pom.xml.

Add Header and Footer for PDF using iTextsharp

As already answered by @Bruno you need to use pageEvents. Please check out the sample code below: private void CreatePDF() { string fileName = string.Empty; DateTime fileCreationDatetime = DateTime.Now; fileName = string.Format(“{0}.pdf”, fileCreationDatetime.ToString(@”yyyyMMdd”) + “_” + fileCreationDatetime.ToString(@”HHmmss”)); string pdfPath = Server.MapPath(@”~\PDFs\”) + fileName; using (FileStream msReport = new FileStream(pdfPath, FileMode.Create)) { //step 1 using (Document … Read more

Using iText to convert HTML to PDF

I think this is exactly what you were looking for http://today.java.net/pub/a/today/2007/06/26/generating-pdfs-with-flying-saucer-and-itext.html http://code.google.com/p/flying-saucer Flying Saucer’s primary purpose is to render spec-compliant XHTML and CSS 2.1 to the screen as a Swing component. Though it was originally intended for embedding markup into desktop applications (things like the iTunes Music Store), Flying Saucer has been extended work with … Read more

Hiding table border in iTextSharp

Although I upvoted the answer by Martijn, I want to add a clarification. Only cells have borders in iText; tables don’t have a border. Martijn’s suggestion to set the border of the default cell to NO_BORDER is correct: table.DefaultCell.Border = Rectangle.NO_BORDER; But it won’t work for the code snippet provided in the question. The properties … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)