Where do I find the C# examples?

On itextpdf.com, I find the Java version of the examples from the book.
Is there a place where I can find the C# version?

Another Chunk.setRemoteGoto problem

Posted this originally as a comment. Sorry it should have been a fresh topic.


I'm now using 5.3.5 and have found another issue with chunk.setRemoteGoto.

I've noticed that with a small minority of the target files of the goto, although I specify page 1, the viewer takes me to another seemingly random page.

Then I discovered that only the acrobat viewer showed these symptoms; evince, gv and xpdf all took me correctly to page 1.

Why setVerticalAlignment doesn't work here?

Hi Bruno,

I’m having trouble to line up a nested table in the vertical. Each cell in this case is created with a call to getHeaderCell. For instance, getHeaderCell(“E 5”) would create a E over 5, while getHeaderCell(“ 4”) would create an empty space over 4. I thought I would be able to line up the number 4 and 5 in vertical. But the number 4 is slightly lower than the number 5. I tried ALIGN_BOTTOM as well. It didn't work.

Thanks in advance,

public PdfPCell getHeaderCell(String hdString) {
PdfPTable table1 = new PdfPTable(1);

Adding Signature Image and Digital Id to Signature field

I am building code that will allow me to add a signature image (i.e. "Appearance") and a digital id to a signature field. The code works fine - if the signature field is large. If the signature field is not very big, the image (appearance) won't show up. However, when I add the image manually it does. I have looked for days and cannot figure out why this is the case. Below is an example of the code I'm using. Any idea why this doesn't work?

using iTextSharp.text;
using iTextSharp.text.pdf;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Pkcs;
using Org.BouncyCastle.X509;

iTextSharp examples ResourceDirectory, BaseDirectory, ResultDirectory.

This question applies to the iTextSharp C# sample code class "Utility". I am missing some basic knowledge here but could someone enlighten me on where, when or how the variables ResourceDirectory, BaseDirectory, ResultDirectory that appear in the Utility.cs file are set. For example the ResourceDirectory variable is set somewhere to the current context directory. I have not been able to find any other references to these variables outside of Utility class so I am assuming they are system oriented, hidden or I am just not looking in the right place.

Compression via resizing *and* CCITT-BW

Hi there,

I'm trying to reduce the size of a scanned document that has been saved as a pdf.
My sample document has 28 pages and weighs 14652 Kb, 98.9% of which consists
in streams representing the scanned pages.

Getting inspiration from Listing 16.2 (ResizeImage.java), it was not difficult
to adapt for my use case.
The resulting pdf is much smaller (for a factor of 0.5, the pdf weighs 6527 Kb,
i.e. 55.5% of the original document), but I'd like to compress things more given
the nature of the document.
Indeed, since all pages except the front cover are black and white, I thought

cell border color problems

Hi Bruno,

I've been working with trying to set individual table cell border colors, and have encountered what seems to be strange behavior which I hope you could explain. I find that the setBorderColorXXX() functions appear to be ignored unless a matching setBorderWidthXXX() call is made. Other "edge specific" property changes may also make the border color work, but I have not tried that... Ultimately, my goal is to have a table with a dark outer border and faint gray interior gridlines for certain lines / columns.

Here is a sample chunk of code...

tt = new PdfPTable(3);

Possible setRemoteGoto bug in 5.3.4

Using 5.1.3 for several months, I have developed an application for generating a pdf file. It consists of a simple text header followed by a table with 3 columns. The first two columns are plain text; the third is also a text string, but it links to another pdf file.

The outline code for the third column is:-

Chunk chunk = new Chunk(some string, a font);
chunk.setRemoteGoto("/some/pdffile.pdf", 1);
PdfPCell cell = new PdfPCell(new Phrase(chunk));

How to limit memory consumption generating very large PDF tables

We need to generate very large PDF tables in tight memory constraints. I've learnt that PdfWriter starts streaming the document's content as soon as a page is ready. However it looks like even after a page has been streamed the instance of Document still retains some data related to that page. In my tests the instance of Document class takes RAM in the amount proportional to the size of the document content. I was trying to close the document, flush and close the writer, close the stream - nothing makes document object to release RAM.

Are there any ways to make iText not to retain data once a page is written or minimize RAM usage?

Headers and Footers with iTextSharp & Powershell

Prior to iTextSharp 5 Headers and Footers were fairly simple in Powershell.
With having to use Events in iTextSharp5 it became much more difficult.
Does anyone have any examples of doing Headers & Footers in Powershell that they are willing to share( or can they point me to some )?

If this is not the correct forum, can you point me to the correct one?


Syndicate content