---
language: "en"
---
# iText 5 Home - iText 5 Documentation

## Documentation

*

  ### [iText 5 Code Examples and Tutorials](https://kb.itextpdf.com/it5kb/examples.md)

  * [Adding a background to a table - iText 5 Documentation](https://kb.itextpdf.com/it5kb/adding-a-background-to-a-table.md)
  * [Adding a cover page to an existing PDF](https://kb.itextpdf.com/it5kb/adding-a-cover-page-to-an-existing-pdf.md)
  * [Adding an image to an existing file](https://kb.itextpdf.com/it5kb/adding-an-image-to-an-existing-file.md)
  * [Adding backgrounds using page events - iText 5 Documentation](https://kb.itextpdf.com/it5kb/adding-backgrounds-using-page-events.md)
  * [Adding fields to an existing form - iText 5 Documentation](https://kb.itextpdf.com/it5kb/adding-fields-to-an-existing-form.md)
  * [178 more pages](https://kb.itextpdf.com/it5kb/examples.md)
*

  ### [iText 5 Release Notes and Version History](https://kb.itextpdf.com/it5kb/releases.md)

  * [iText 5 System Requirements and Compatibility Guide](https://kb.itextpdf.com/it5kb/compatibility-matrix.md)
  * [Release iText 5.0.0](https://kb.itextpdf.com/it5kb/release-itext-5-0-0.md)
  * [Release iText 5.0.1](https://kb.itextpdf.com/it5kb/release-itext-5-0-1.md)
  * [Release iText 5.0.2](https://kb.itextpdf.com/it5kb/release-itext-5-0-2.md)
  * [Release iText 5.0.3](https://kb.itextpdf.com/it5kb/release-itext-5-0-3.md)
  * [41 more pages](https://kb.itextpdf.com/it5kb/releases.md)
*

  ### [iText 5 Installation Guide](https://kb.itextpdf.com/it5kb/installation-guidelines.md)

  * [Installing iText 5 toolbox for Java developers](https://kb.itextpdf.com/it5kb/installing-itext-5-toolbox-for-java-developers.md)
  * [Installing iText 5 toolbox for .NET developers](https://kb.itextpdf.com/it5kb/installing-itext-5-toolbox-for-net-developers.md)
  * [Installing iText 5 XFA Worker for Java and .NET developers](https://kb.itextpdf.com/it5kb/installing-itext-5-xfa-worker-for-java-and-net-dev.md)
  * [Installing iText G for Android](https://kb.itextpdf.com/it5kb/installing-itext-g-for-android.md)
  * [Enabling Automated Volume Counting in iText 5 with JSON Licenses](https://kb.itextpdf.com/it5kb/enabling-automated-volume-counting-in-itext-5-with-json-licenses.md)
*

  ### [Free PDF Development eBooks and Learning Resources](https://kb.itextpdf.com/it5kb/ebooks.md)

  * [Digital signatures for PDF Documents](https://kb.itextpdf.com/it5kb/digital-signatures-for-pdf-documents.md)
  * [The Best iText 5 Questions on Stack Overflow](https://kb.itextpdf.com/it5kb/the-best-itext-5-questions-on-stack-overflow.md)
*

  ### [Frequently Asked Questions - iText 5 PDF Library Help](https://kb.itextpdf.com/it5kb/faq.md)

  * [Can iText 2.1.7 / iTextSharp 4.1.6 or earlier be used commercially?](https://kb.itextpdf.com/it5kb/can-itext-2-1-7-itextsharp-4-1-6-or-earlier-be-use.md)
  * [How to tile a document and add margins to the tiles? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-tile-a-document-and-add-margins-to-the-tile.md)
  * [How to merge documents correctly? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-merge-documents-correctly.md)
  * [How to set the OCG state of an existing PDF? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-set-the-ocg-state-of-an-existing-pdf.md)
  * [How to use the full size of a page? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-use-the-full-size-of-a-page.md)
  * [374 more pages](https://kb.itextpdf.com/it5kb/faq.md)
*

  ### [CVEs Report](https://kb.itextpdf.com/it5kb/cves-report.md)

  * [CVEs - iText 5 Documentation](https://kb.itextpdf.com/it5kb/cves.md)
*

  ### [API Documentation](https://kb.itextpdf.com/it5kb/api-documentation.md)

  * [com](https://kb.itextpdf.com/it5kb/com.md)
  * [itextsharp](https://kb.itextpdf.com/it5kb/itextsharp.md)
  * [versions](https://kb.itextpdf.com/it5kb/versions.md)

---
language: "en"
---
# 101 - a very simple table - iText 5 Documentation

A very simple table example.

## simpletable

### **JAVA**

Java

    /**
     * Example written by Bruno Lowagie and Nishanthi Grashia in answer to the following question:
     * http://stackoverflow.com/questions/24359321/adding-row-to-a-table-in-pdf-using-itext
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class SimpleTable {
        public static final String DEST = "results/tables/simple_table.pdf";

        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new SimpleTable().createPdf(DEST);
        }
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(8);
            for(int aw = 0; aw < 16; aw++){
                table.addCell("hi");
            }
            document.add(table);
            document.close();
        }

    }

## smalltable

### **JAVA**

Java

    /*
     * This example was written in answer to the question
     * http://stackoverflow.com/questions/39203479
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Element;
    import com.itextpdf.text.Font;
    import com.itextpdf.text.Font.FontFamily;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.Barcode128;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    /**
     * @author Bruno Lowagie (iText Software)
     */
    @WrapToTest
    public class SmallTable {
        public static final String DEST = "results/tables/small_table.pdf";

        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new SmallTable().createPdf(DEST);
        }
        public void createPdf(String dest) throws IOException, DocumentException {
            Rectangle small = new Rectangle(290,100);
            Font smallfont = new Font(FontFamily.HELVETICA, 10);
            Document document = new Document(small, 5, 5, 5, 5);
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(2);
            table.setTotalWidth(new float[]{ 160, 120 });
            table.setLockedWidth(true);
            PdfContentByte cb = writer.getDirectContent();
            // first row
            PdfPCell cell = new PdfPCell(new Phrase("Some text here"));
            cell.setFixedHeight(30);
            cell.setBorder(Rectangle.NO_BORDER);
            cell.setColspan(2);
            table.addCell(cell);
            // second row
            cell = new PdfPCell(new Phrase("Some more text", smallfont));
            cell.setFixedHeight(30);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.setBorder(Rectangle.NO_BORDER);
            table.addCell(cell);
            Barcode128 code128 = new Barcode128();
            code128.setCode("14785236987541");
            code128.setCodeType(Barcode128.CODE128);
            Image code128Image = code128.createImageWithBarcode(cb, null, null);
            cell = new PdfPCell(code128Image, true);
            cell.setBorder(Rectangle.NO_BORDER);
            cell.setFixedHeight(30);
            table.addCell(cell);
            // third row
            table.addCell(cell);
            cell = new PdfPCell(new Phrase("and something else here", smallfont));
            cell.setBorder(Rectangle.NO_BORDER);
            cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            table.addCell(cell);
            document.add(table);
            document.close();
        }
    }

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_simple_table.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_small_table.pdf>

---
language: "en"
---
# Absolute positioning of lines and shapes - iText 5 Documentation

You can draw lines and shapes at absolute positions using low-level methods.
[How to create a PDF with a Cartesian grid? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-create-a-pdf-with-a-cartesian-grid.md)

[How to add a shading pattern to a custom shape? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-add-a-shading-pattern-to-a-custom-shape.md)

[Why does the cell background color affect the color of other lines?](https://kb.itextpdf.com/it5kb/why-does-the-cell-background-color-affect-the-co-1.md)

[How do I set parameters back to the default value? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-do-i-set-parameters-back-to-the-default-value.md)

[How to add a border to a PDF page? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-add-a-border-to-a-pdf-page.md)

[Why does the function to concatenate / merge PDFs cause issues in some cases?](https://kb.itextpdf.com/it5kb/why-does-the-function-to-concatenate-merge-pdfs-ca.md)

[How to draw a borderless rounded rectangle? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-draw-a-borderless-rounded-rectangle.md)

[How to fill a rectangle with color? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-fill-a-rectangle-with-color.md)

[How to set the line width of a clipping path? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-set-the-line-width-of-a-clipping-path.md)

[How to add an image to an existing PDF using AffineTransform?](https://kb.itextpdf.com/it5kb/how-to-add-an-image-to-an-existing-pdf-using-affin.md)

[How to draw vertical gradient in iTextSharp? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-draw-vertical-gradient-in-itextsharp.md)

---
language: "en"
---
# Absolute positioning of text - iText 5 Documentation

In this section, we'll discuss problems that can occur when adding text at absolute positions.

[How to adapt the position of the first line in ColumnText?](https://kb.itextpdf.com/it5kb/how-to-adapt-the-position-of-the-first-line-in-col.md)

[How to add an x-offset to a text pattern with every x-step?](https://kb.itextpdf.com/it5kb/how-to-add-an-x-offset-to-a-text-pattern-with-ever.md)

[How to add text inside a rectangle? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-add-text-inside-a-rectangle.md)

[How to continue an ordered list on a second page? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-continue-an-ordered-list-on-a-second-page.md)

[How to divide a page in N parts so we can fill each with a different source?](https://kb.itextpdf.com/it5kb/how-to-divide-a-page-in-n-parts-so-we-can-fill-eac.md)

[How to draw a rectangle around multiline text? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-draw-a-rectangle-around-multiline-text.md)

[How to fit a String inside a rectangle? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-fit-a-string-inside-a-rectangle.md)

[How to reduce redundant code when adding content at absolute positions? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-reduce-redundant-code-when-adding-content-a.md)

[How to rotate a paragraph? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-rotate-a-paragraph.md)

[How to rotate a single line of text? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-rotate-a-single-line-of-text.md)

[How to truncate text within a bounding box? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-truncate-text-within-a-bounding-box.md)

[How to write a Zapfdingbats character at a specific location on a page?](https://kb.itextpdf.com/it5kb/how-to-write-a-zapfdingbats-character-at-a-specifi.md)

[What is causing syntax errors in a page created with iText?](https://kb.itextpdf.com/it5kb/what-is-causing-syntax-errors-in-a-page-created-wi.md)

[Why does ColumnText ignore the horizontal alignment? - iText 5 PDF Library Explained](https://kb.itextpdf.com/it5kb/why-does-columntext-ignore-the-horizontal-alignmen.md)

[Why does using ColumnText result in "The document has no pages" exception?](https://kb.itextpdf.com/it5kb/why-does-using-columntext-result-in-the-document-h.md)

---
language: "en"
---
# AbstractCMap

## AbstractCMap `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf.fonts.cmaps iTextSharp.text.pdf.fonts.cmaps.AbstractCMap\[\[AbstractCMap\]\] class iTextSharp.text.pdf.fonts.cmaps.AbstractCMap abstractStyle; end

### Members

#### Properties

##### Public properties

|   Type   |                       Name                        |  Methods   |
|----------|---------------------------------------------------|------------|
| `string` | [`Name`](https://kb.itextpdf.com/it5kb/abstractcmap.md#name)             | `get, set` |
| `string` | [`Ordering`](https://kb.itextpdf.com/it5kb/abstractcmap.md#ordering)     | `get, set` |
| `string` | [`Registry`](https://kb.itextpdf.com/it5kb/abstractcmap.md#registry)     | `get, set` |
| `int`    | [`Supplement`](https://kb.itextpdf.com/it5kb/abstractcmap.md#supplement) | `get, set` |

#### Methods

##### Internal methods

| Returns |                                                                                 Name                                                                                  |
|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `void`  | [`AddChar`](https://kb.itextpdf.com/it5kb/abstractcmap.md#addchar) ( [`PdfString`](../../PdfString.md) mark, [`PdfObject`](../../PdfObject.md) code)                                         |
| `void`  | [`AddRange`](https://kb.itextpdf.com/it5kb/abstractcmap.md#addrange) ( [`PdfString`](../../PdfString.md) from, [`PdfString`](../../PdfString.md) to, [`PdfObject`](../../PdfObject.md) code) |

##### Public methods

| Returns  |                                                      Name                                                       |
|----------|-----------------------------------------------------------------------------------------------------------------|
| `string` | [`DecodeStringToUnicode`](https://kb.itextpdf.com/it5kb/abstractcmap.md#decodestringtounicode) ( [`PdfString`](../../PdfString.md) ps) |

##### Public Static methods

|    Returns     |                                                   Name                                                   |
|----------------|----------------------------------------------------------------------------------------------------------|
| ```byte``[]``` | [`DecodeStringToByte`](https://kb.itextpdf.com/it5kb/abstractcmap.md#decodestringtobyte) ( [`PdfString`](../../PdfString.md) s) |

### Details

#### Constructors

##### AbstractCMap

protected AbstractCMap()

#### Methods

##### AddChar

internal abstract void AddChar(PdfString mark, PdfObject code)

###### Arguments

|               Type                | Name | Description |
|-----------------------------------|------|-------------|
| [`PdfString`](../../PdfString.md) | mark |             |
| [`PdfObject`](../../PdfObject.md) | code |             |

##### AddRange

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/fonts/cmaps/AbstractCMap.cs#L61)  
internal void AddRange(PdfString from, PdfString to, PdfObject code)

###### Arguments

|               Type                | Name | Description |
|-----------------------------------|------|-------------|
| [`PdfString`](../../PdfString.md) | from |             |
| [`PdfString`](../../PdfString.md) | to   |             |
| [`PdfObject`](../../PdfObject.md) | code |             |

##### DecodeStringToByte

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/fonts/cmaps/AbstractCMap.cs#L61)  
public static byte DecodeStringToByte(PdfString s)

###### Arguments

|               Type                | Name | Description |
|-----------------------------------|------|-------------|
| [`PdfString`](../../PdfString.md) | s    |             |

##### DecodeStringToUnicode

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/fonts/cmaps/AbstractCMap.cs#L61)  
public virtual string DecodeStringToUnicode(PdfString ps)

###### Arguments

|               Type                | Name | Description |
|-----------------------------------|------|-------------|
| [`PdfString`](../../PdfString.md) | ps   |             |

#### Properties

##### Supplement

public virtual int Supplement { get; set; }

##### Name

public virtual string Name { get; set; }

##### Ordering

public virtual string Ordering { get; set; }

##### Registry

public virtual string Registry { get; set; }

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# AccessibleElementId

## AccessibleElementId `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text iTextSharp.text.AccessibleElementId\[\[AccessibleElementId\]\] end subgraph System System.IComparable_1\[\[IComparable\]\] end System.IComparable_1 --\> iTextSharp.text.AccessibleElementId

### Members

#### Methods

##### Public methods

| Returns  |                                                                Name                                                                 |
|----------|-------------------------------------------------------------------------------------------------------------------------------------|
| `int`    | [`CompareTo`](https://kb.itextpdf.com/it5kb/accessibleelementid.md#compareto) ( [`AccessibleElementId`](itextsharp/text/AccessibleElementId.md) elementId) |
| `bool`   | [`Equals`](https://kb.itextpdf.com/it5kb/accessibleelementid.md#equals) (`object` o)                                                                       |
| `int`    | [`GetHashCode`](https://kb.itextpdf.com/it5kb/accessibleelementid.md#gethashcode) ()                                                                       |
| `string` | [`ToString`](https://kb.itextpdf.com/it5kb/accessibleelementid.md#tostring) ()                                                                             |

### Details

#### Inheritance

* `IComparable`\<[`AccessibleElementId`](itextsharp/text/AccessibleElementId.md)\>

#### Constructors

##### AccessibleElementId

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/AccessibleElementId.cs#L52)  
public AccessibleElementId()

#### Methods

##### ToString

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/AccessibleElementId.cs#L52)  
public override string ToString()

##### GetHashCode

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/AccessibleElementId.cs#L52)  
public override int GetHashCode()

##### Equals

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/AccessibleElementId.cs#L52)  
public override bool Equals(object o)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `object` | o    |             |

##### CompareTo

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/AccessibleElementId.cs#L52)  
public virtual int CompareTo(AccessibleElementId elementId)

###### Arguments

|                              Type                               |   Name    | Description |
|-----------------------------------------------------------------|-----------|-------------|
| [`AccessibleElementId`](itextsharp/text/AccessibleElementId.md) | elementId |             |

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# acrofields

---
language: "en"
---
# AcroFields (1)

## AcroFields `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf iTextSharp.text.pdf.AcroFields\[\[AcroFields\]\] end

### Members

#### Properties

##### Public properties

|                           Type                            |                                Name                                 |  Methods   |
|-----------------------------------------------------------|---------------------------------------------------------------------|------------|
| `IDictionary`\<`string`, [`TextField`](./TextField.md) \> | [`FieldCache`](https://kb.itextpdf.com/it5kb/acrofields-1.md#fieldcache)                   | `get, set` |
| `IDictionary`\<`string`, `Item`\>                         | [`Fields`](https://kb.itextpdf.com/it5kb/acrofields-1.md#fields)                           | `get`      |
| `bool`                                                    | [`GenerateAppearances`](https://kb.itextpdf.com/it5kb/acrofields-1.md#generateappearances) | `get, set` |
| `List`\< [`BaseFont`](./BaseFont.md) \>                   | [`SubstitutionFonts`](https://kb.itextpdf.com/it5kb/acrofields-1.md#substitutionfonts)     | `get, set` |
| `int`                                                     | [`TotalRevisions`](https://kb.itextpdf.com/it5kb/acrofields-1.md#totalrevisions)           | `get`      |
| [`XfaForm`](./XfaForm.md)                                 | [`Xfa`](https://kb.itextpdf.com/it5kb/acrofields-1.md#xfa)                                 | `get`      |

#### Methods

##### Public Static methods

|     Returns      |                                   Name                                    |
|------------------|---------------------------------------------------------------------------|
| ```object``[]``` | [`SplitDAelements`](https://kb.itextpdf.com/it5kb/acrofields-1.md#splitdaelements) (`string` da) |

##### Internal methods

|                Returns                |                                                           Name                                                           |
|---------------------------------------|--------------------------------------------------------------------------------------------------------------------------|
| `void`                                | [`Fill`](https://kb.itextpdf.com/it5kb/acrofields-1.md#fill) ()                                                                                 |
| [`PdfAppearance`](./PdfAppearance.md) | [`GetAppearance`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getappearance-12) (`...`)                                                       |
| [`BaseColor`](../BaseColor.md)        | [`GetMKColor`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getmkcolor) ( [`PdfArray`](./PdfArray.md) ar)                                      |
| `bool`                                | [`IsInAP`](https://kb.itextpdf.com/it5kb/acrofields-1.md#isinap) ( [`PdfDictionary`](./PdfDictionary.md) nDic, [`PdfName`](./PdfName.md) check) |

##### Public methods

|                       Returns                       |                                                                             Name                                                                              |
|-----------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `void`                                              | [`AddSubstitutionFont`](https://kb.itextpdf.com/it5kb/acrofields-1.md#addsubstitutionfont) ( [`BaseFont`](./BaseFont.md) font)                                                       |
| `bool`                                              | [`ClearSignatureField`](https://kb.itextpdf.com/it5kb/acrofields-1.md#clearsignaturefield) (`string` name)                                                                           |
| `void`                                              | [`DecodeGenericDictionary`](https://kb.itextpdf.com/it5kb/acrofields-1.md#decodegenericdictionary) ( [`PdfDictionary`](./PdfDictionary.md) merged, [`BaseField`](./BaseField.md) tx) |
| `bool`                                              | [`DoesSignatureFieldExist`](https://kb.itextpdf.com/it5kb/acrofields-1.md#doessignaturefieldexist) (`string` name)                                                                   |
| `void`                                              | [`ExportAsFdf`](https://kb.itextpdf.com/it5kb/acrofields-1.md#exportasfdf) ( [`FdfWriter`](./FdfWriter.md) writer)                                                                   |
| `Stream`                                            | [`ExtractRevision`](https://kb.itextpdf.com/it5kb/acrofields-1.md#extractrevision) (`string` field)                                                                                  |
| ```string``[]```                                    | [`GetAppearanceStates`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getappearancestates) (`string` fieldName)                                                                      |
| `List`\<`string`\>                                  | [`GetBlankSignatureNames`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getblanksignaturenames) ()                                                                                  |
| `string`                                            | [`GetField`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getfield) (`string` name)                                                                                                 |
| `Item`                                              | [`GetFieldItem`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getfielditem) (`string` name)                                                                                         |
| `IList`\<`FieldPosition`\>                          | [`GetFieldPositions`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getfieldpositions) (`string` name)                                                                               |
| `string`                                            | [`GetFieldRichValue`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getfieldrichvalue) (`string` name)                                                                               |
| `int`                                               | [`GetFieldType`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getfieldtype) (`string` fieldName)                                                                                    |
| ```string``[]```                                    | [`GetListOptionDisplay`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getlistoptiondisplay) (`string` fieldName)                                                                    |
| ```string``[]```                                    | [`GetListOptionExport`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getlistoptionexport) (`string` fieldName)                                                                      |
| ```string``[]```                                    | [`GetListSelection`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getlistselection) (`string` name)                                                                                 |
| [`PushbuttonField`](./PushbuttonField.md)           | [`GetNewPushbuttonFromField`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getnewpushbuttonfromfield-12) (`...`)                                                                    |
| [`PdfIndirectReference`](./PdfIndirectReference.md) | [`GetNormalAppearance`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getnormalappearance) (`string` name)                                                                           |
| `int`                                               | [`GetRevision`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getrevision) (`string` field)                                                                                          |
| [`PdfDictionary`](./PdfDictionary.md)               | [`GetSignatureDictionary`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getsignaturedictionary) (`string` name)                                                                     |
| `List`\<`string`\>                                  | [`GetSignatureNames`](https://kb.itextpdf.com/it5kb/acrofields-1.md#getsignaturenames) ()                                                                                            |
| `string`                                            | [`GetTranslatedFieldName`](https://kb.itextpdf.com/it5kb/acrofields-1.md#gettranslatedfieldname) (`string` name)                                                                     |
| `void`                                              | [`MergeXfaData`](https://kb.itextpdf.com/it5kb/acrofields-1.md#mergexfadata) (`XmlNode` n)                                                                                           |
| `bool`                                              | [`RegenerateField`](https://kb.itextpdf.com/it5kb/acrofields-1.md#regeneratefield) (`string` name)                                                                                   |
| `bool`                                              | [`RemoveField`](https://kb.itextpdf.com/it5kb/acrofields-1.md#removefield-12) (`...`)                                                                                                |
| `bool`                                              | [`RemoveFieldsFromPage`](https://kb.itextpdf.com/it5kb/acrofields-1.md#removefieldsfrompage) (`int` page)                                                                            |
| `void`                                              | [`RemoveXfa`](https://kb.itextpdf.com/it5kb/acrofields-1.md#removexfa) ()                                                                                                            |
| `bool`                                              | [`RenameField`](https://kb.itextpdf.com/it5kb/acrofields-1.md#renamefield) (`string` oldName, `string` newName)                                                                      |
| `bool`                                              | [`ReplacePushbuttonField`](https://kb.itextpdf.com/it5kb/acrofields-1.md#replacepushbuttonfield-12) (`...`)                                                                          |
| `void`                                              | [`SetExtraMargin`](https://kb.itextpdf.com/it5kb/acrofields-1.md#setextramargin) (`float` extraMarginLeft, `float` extraMarginTop)                                                   |
| `bool`                                              | [`SetField`](https://kb.itextpdf.com/it5kb/acrofields-1.md#setfield-14) (`...`)                                                                                                      |
| `bool`                                              | [`SetFieldProperty`](https://kb.itextpdf.com/it5kb/acrofields-1.md#setfieldproperty-12) (`...`)                                                                                      |
| `bool`                                              | [`SetFieldRichValue`](https://kb.itextpdf.com/it5kb/acrofields-1.md#setfieldrichvalue) (`string` name, `string` richValue)                                                           |
| `void`                                              | [`SetFields`](https://kb.itextpdf.com/it5kb/acrofields-1.md#setfields-12) (`...`)                                                                                                    |
| `bool`                                              | [`SetListOption`](https://kb.itextpdf.com/it5kb/acrofields-1.md#setlistoption) (`string` fieldName, ```string``[]``` exportValues, ```string``[]``` displayValues)                   |
| `bool`                                              | [`SetListSelection`](https://kb.itextpdf.com/it5kb/acrofields-1.md#setlistselection) (`string` name, ```string``[]``` value)                                                         |
| `bool`                                              | [`SignatureCoversWholeDocument`](https://kb.itextpdf.com/it5kb/acrofields-1.md#signaturecoverswholedocument) (`string` name)                                                         |
| [`PdfPKCS7`](security/PdfPKCS7.md)                  | [`VerifySignature`](https://kb.itextpdf.com/it5kb/acrofields-1.md#verifysignature) (`string` name)                                                                                   |

### Details

#### Nested types

##### Classes

* `Item`

* `FieldPosition`

#### Constructors

##### AcroFields

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
internal AcroFields(PdfReader reader, PdfWriter writer)

###### Arguments

|             Type              |  Name  | Description |
|-------------------------------|--------|-------------|
| [`PdfReader`](./PdfReader.md) | reader |             |
| [`PdfWriter`](./PdfWriter.md) | writer |             |

#### Methods

##### SplitDAelements

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public static object SplitDAelements(string da)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | da   |             |

##### Fill

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
internal void Fill()

##### GetAppearanceStates

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual string GetAppearanceStates(string fieldName)

###### Arguments

|   Type   |   Name    | Description |
|----------|-----------|-------------|
| `string` | fieldName |             |

##### GetListOptionExport

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual string GetListOptionExport(string fieldName)

###### Arguments

|   Type   |   Name    | Description |
|----------|-----------|-------------|
| `string` | fieldName |             |

##### GetListOptionDisplay

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual string GetListOptionDisplay(string fieldName)

###### Arguments

|   Type   |   Name    | Description |
|----------|-----------|-------------|
| `string` | fieldName |             |

##### SetListOption

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool SetListOption(string fieldName, string\[\] exportValues, string\[\] displayValues)

###### Arguments

|       Type       |     Name      | Description |
|------------------|---------------|-------------|
| `string`         | fieldName     |             |
| ```string``[]``` | exportValues  |             |
| ```string``[]``` | displayValues |             |

##### GetFieldType

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual int GetFieldType(string fieldName)

###### Arguments

|   Type   |   Name    | Description |
|----------|-----------|-------------|
| `string` | fieldName |             |

##### ExportAsFdf

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual void ExportAsFdf(FdfWriter writer)

###### Arguments

|             Type              |  Name  | Description |
|-------------------------------|--------|-------------|
| [`FdfWriter`](./FdfWriter.md) | writer |             |

##### RenameField

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool RenameField(string oldName, string newName)

###### Arguments

|   Type   |  Name   | Description |
|----------|---------|-------------|
| `string` | oldName |             |
| `string` | newName |             |

##### DecodeGenericDictionary

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual void DecodeGenericDictionary(PdfDictionary merged, BaseField tx)

###### Arguments

|                 Type                  |  Name  | Description |
|---------------------------------------|--------|-------------|
| [`PdfDictionary`](./PdfDictionary.md) | merged |             |
| [`BaseField`](./BaseField.md)         | tx     |             |

##### GetAppearance \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
internal PdfAppearance GetAppearance(PdfDictionary merged, string\[\] values, string fieldName)

###### Arguments

|                 Type                  |   Name    | Description |
|---------------------------------------|-----------|-------------|
| [`PdfDictionary`](./PdfDictionary.md) | merged    |             |
| ```string``[]```                      | values    |             |
| `string`                              | fieldName |             |

##### GetAppearance \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
internal PdfAppearance GetAppearance(PdfDictionary merged, string text, string fieldName)

###### Arguments

|                 Type                  |   Name    | Description |
|---------------------------------------|-----------|-------------|
| [`PdfDictionary`](./PdfDictionary.md) | merged    |             |
| `string`                              | text      |             |
| `string`                              | fieldName |             |

##### GetMKColor

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
internal BaseColor GetMKColor(PdfArray ar)

###### Arguments

|            Type             | Name | Description |
|-----------------------------|------|-------------|
| [`PdfArray`](./PdfArray.md) | ar   |             |

##### GetFieldRichValue

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual string GetFieldRichValue(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

##### GetField

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual string GetField(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

##### GetListSelection

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual string GetListSelection(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

##### SetFieldProperty \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool SetFieldProperty(string field, string name, object value, int\[\] inst)

###### Arguments

|     Type      | Name  | Description |
|---------------|-------|-------------|
| `string`      | field |             |
| `string`      | name  |             |
| `object`      | value |             |
| ```int``[]``` | inst  |             |

##### SetFieldProperty \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool SetFieldProperty(string field, string name, int value, int\[\] inst)

###### Arguments

|     Type      | Name  | Description |
|---------------|-------|-------------|
| `string`      | field |             |
| `string`      | name  |             |
| `int`         | value |             |
| ```int``[]``` | inst  |             |

##### MergeXfaData

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual void MergeXfaData(XmlNode n)

###### Arguments

|   Type    | Name | Description |
|-----------|------|-------------|
| `XmlNode` | n    |             |

##### SetFields \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual void SetFields(FdfReader fdf)

###### Arguments

|             Type              | Name | Description |
|-------------------------------|------|-------------|
| [`FdfReader`](./FdfReader.md) | fdf  |             |

##### SetFields \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual void SetFields(XfdfReader xfdf)

###### Arguments

|              Type               | Name | Description |
|---------------------------------|------|-------------|
| [`XfdfReader`](./XfdfReader.md) | xfdf |             |

##### RegenerateField

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool RegenerateField(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

##### SetField \[1/4\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool SetField(string name, string value)

###### Arguments

|   Type   | Name  | Description |
|----------|-------|-------------|
| `string` | name  |             |
| `string` | value |             |

##### SetField \[2/4\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool SetField(string name, string value, bool saveAppearance)

###### Arguments

|   Type   |      Name      | Description |
|----------|----------------|-------------|
| `string` | name           |             |
| `string` | value          |             |
| `bool`   | saveAppearance |             |

##### SetFieldRichValue

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool SetFieldRichValue(string name, string richValue)

###### Arguments

|   Type   |   Name    | Description |
|----------|-----------|-------------|
| `string` | name      |             |
| `string` | richValue |             |

##### SetField \[3/4\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool SetField(string name, string value, string display)

###### Arguments

|   Type   |  Name   | Description |
|----------|---------|-------------|
| `string` | name    |             |
| `string` | value   |             |
| `string` | display |             |

##### SetField \[4/4\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool SetField(string name, string value, string display, bool saveAppearance)

###### Arguments

|   Type   |      Name      | Description |
|----------|----------------|-------------|
| `string` | name           |             |
| `string` | value          |             |
| `string` | display        |             |
| `bool`   | saveAppearance |             |

##### SetListSelection

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool SetListSelection(string name, string\[\] value)

###### Arguments

|       Type       | Name  | Description |
|------------------|-------|-------------|
| `string`         | name  |             |
| ```string``[]``` | value |             |

##### IsInAP

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
internal bool IsInAP(PdfDictionary nDic, PdfName check)

###### Arguments

|                 Type                  | Name  | Description |
|---------------------------------------|-------|-------------|
| [`PdfDictionary`](./PdfDictionary.md) | nDic  |             |
| [`PdfName`](./PdfName.md)             | check |             |

##### GetFieldItem

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual Item GetFieldItem(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

##### GetTranslatedFieldName

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual string GetTranslatedFieldName(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

##### GetFieldPositions

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual IList\<FieldPosition\> GetFieldPositions(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

##### RemoveFieldsFromPage

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool RemoveFieldsFromPage(int page)

###### Arguments

| Type  | Name | Description |
|-------|------|-------------|
| `int` | page |             |

##### RemoveField \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool RemoveField(string name, int page)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |
| `int`    | page |             |

##### RemoveField \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool RemoveField(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

##### ClearSignatureField

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool ClearSignatureField(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

##### GetSignatureNames

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual List\<string\> GetSignatureNames()

##### GetBlankSignatureNames

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual List\<string\> GetBlankSignatureNames()

##### GetSignatureDictionary

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual PdfDictionary GetSignatureDictionary(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

##### GetNormalAppearance

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual PdfIndirectReference GetNormalAppearance(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

##### SignatureCoversWholeDocument

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool SignatureCoversWholeDocument(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

##### VerifySignature

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual PdfPKCS7 VerifySignature(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

##### GetRevision

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual int GetRevision(string field)

###### Arguments

|   Type   | Name  | Description |
|----------|-------|-------------|
| `string` | field |             |

##### ExtractRevision

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual Stream ExtractRevision(string field)

###### Arguments

|   Type   | Name  | Description |
|----------|-------|-------------|
| `string` | field |             |

##### SetExtraMargin

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual void SetExtraMargin(float extraMarginLeft, float extraMarginTop)

###### Arguments

|  Type   |      Name       | Description |
|---------|-----------------|-------------|
| `float` | extraMarginLeft |             |
| `float` | extraMarginTop  |             |

##### AddSubstitutionFont

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual void AddSubstitutionFont(BaseFont font)

###### Arguments

|            Type             | Name | Description |
|-----------------------------|------|-------------|
| [`BaseFont`](./BaseFont.md) | font |             |

##### RemoveXfa

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual void RemoveXfa()

##### GetNewPushbuttonFromField \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual PushbuttonField GetNewPushbuttonFromField(string field)

###### Arguments

|   Type   | Name  | Description |
|----------|-------|-------------|
| `string` | field |             |

##### GetNewPushbuttonFromField \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual PushbuttonField GetNewPushbuttonFromField(string field, int order)

###### Arguments

|   Type   | Name  | Description |
|----------|-------|-------------|
| `string` | field |             |
| `int`    | order |             |

##### ReplacePushbuttonField \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool ReplacePushbuttonField(string field, PdfFormField button)

###### Arguments

|                Type                 |  Name  | Description |
|-------------------------------------|--------|-------------|
| `string`                            | field  |             |
| [`PdfFormField`](./PdfFormField.md) | button |             |

##### ReplacePushbuttonField \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool ReplacePushbuttonField(string field, PdfFormField button, int order)

###### Arguments

|                Type                 |  Name  | Description |
|-------------------------------------|--------|-------------|
| `string`                            | field  |             |
| [`PdfFormField`](./PdfFormField.md) | button |             |
| `int`                               | order  |             |

##### DoesSignatureFieldExist

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L106)  
public virtual bool DoesSignatureFieldExist(string name)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | name |             |

#### Properties

##### Fields

public virtual IDictionary\<string, Item\> Fields { get; }

##### GenerateAppearances

public virtual bool GenerateAppearances { get; set; }

##### TotalRevisions

public virtual int TotalRevisions { get; }

##### FieldCache

public virtual IDictionary\<string, TextField\> FieldCache { get; set; }

##### SubstitutionFonts

public virtual List\<BaseFont\> SubstitutionFonts { get; set; }

##### Xfa

public virtual XfaForm Xfa { get; }

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# AcroFieldsSearch

## AcroFieldsSearch `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf.XfaForm iTextSharp.text.pdf.XfaForm.AcroFieldsSearch\[\[AcroFieldsSearch\]\] end subgraph iTextSharp.text.pdf.XfaForm/Xml2Som\[\[Xml2Som\]\] end iTextSharp.text.pdf.XfaForm/Xml2Som --\> iTextSharp.text.pdf.XfaForm.AcroFieldsSearch

### Members

#### Properties

##### Public properties

|                Type                |                                 Name                                  |  Methods   |
|------------------------------------|-----------------------------------------------------------------------|------------|
| `Dictionary`\<`string`, `string`\> | [`AcroShort2LongName`](https://kb.itextpdf.com/it5kb/acrofieldssearch.md#acroshort2longname) | `get, set` |

### Details

#### Inheritance

* `Xml2Som`

#### Constructors

##### AcroFieldsSearch

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/XfaForm.cs#L873)  
public AcroFieldsSearch(ICollection\<string\> items)

###### Arguments

|           Type            | Name  | Description |
|---------------------------|-------|-------------|
| `ICollection`\<`string`\> | items |             |

#### Properties

##### AcroShort2LongName

public virtual Dictionary\<string, string\> AcroShort2LongName { get; set; }

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# Actions and annotations - iText 5 Documentation

[How do I insert a hyperlink to another page in an existing PDF? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-do-i-insert-a-hyperlink-to-another-page-in-an-.md)

[How to add a printable or non-printable bitmap stamp to a PDF?](https://kb.itextpdf.com/it5kb/how-to-add-a-printable-or-non-printable-bitmap-sta.md)

[How to add an "In Reply To" annotation?](https://kb.itextpdf.com/it5kb/how-to-add-an-in-reply-to-annotation.md)

[How to add an onMouseOver javaScript action to a TextField?](https://kb.itextpdf.com/it5kb/how-to-add-an-onmouseover-javascript-action-to-a-t.md)

[How to change the author name for comments? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-change-the-author-name-for-comments.md)

[How to change the color of a circle annotation? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-change-the-color-of-a-circle-annotation.md)

[How to change the properties of an annotation?](https://kb.itextpdf.com/it5kb/how-to-change-the-color-of-a-circle-annotation.md)

[How to create a JavaScript action to open the attachments panel?](https://kb.itextpdf.com/it5kb/how-to-create-a-javascript-action-to-open-the-atta.md)

[How to create a clickable polygon or path? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-create-a-clickable-polygon-or-path.md)

[How to create a link to a specific page number? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-create-a-link-to-a-specific-page-number.md)

[How to create a link to launch an external program? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-create-a-link-to-launch-an-external-program.md)

[How to create a pop-up a window to display images and text? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-create-a-pop-up-a-window-to-display-images-.md)

[How to create hierarchical bookmarks? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-create-hierarchical-bookmarks.md)

[How to define multiple actions for a PushbuttonField?](https://kb.itextpdf.com/it5kb/how-to-define-multiple-actions-for-a-pushbuttonfie.md)

[How to delete attachments in PDF using iText? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-delete-attachments-in-pdf-using-itext.md)

[How to insert a "linked rectangle" with iText?](https://kb.itextpdf.com/it5kb/how-to-insert-a-linked-rectangle-with-itext.md)

[How to modify the size of annotations and make them read-only? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-modify-the-size-of-annotations-and-make-the.md)

[How to open an MS Word attachment by clicking an image?](https://kb.itextpdf.com/it5kb/how-to-open-an-ms-word-attachment-by-clicking-an-i.md)

[How to set the BaseUrl of an existing PDF document?](https://kb.itextpdf.com/it5kb/how-to-set-the-baseurl-of-an-existing-pdf-document.md)

[How to set the zoom level of a PDF using iTextSharp?](https://kb.itextpdf.com/it5kb/how-to-set-the-zoom-level-of-a-pdf-using-itextshar.md)

[How to stamp image on existing PDF and create an anchor? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-stamp-image-on-existing-pdf-and-create-an-a.md)

---
language: "en"
---
# Addendum to Digital signatures for PDF documents - iText 5 Documentation

The [**Digital Signatures for PDF documents**](https://itextpdf.com/sites/default/files/2018-12/digitalsignatures20130304.pdf) eBook has been one of our most popular downloads since it was written. Although many of the principles and concepts remain the same, iText itself has changed a great deal over the years.

The code snippets included in the eBook were accompanied by complete examples which we made available on our website. As these examples were originally written for iText 5/iTextSharp, they have been completely updated and rewritten for the latest versions of iText. This meant significant changes in some cases, and some examples were no longer applicable.

This addendum links to pages with updated Java and .NET (C#) examples for each chapter of the eBook, and the table below notes the name of the example and which chapter the code example corresponds to:  

|                  **Example Name**                   |                                                                       **Description and Notes**                                                                       |
|-----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Chapter 1](https://kb.itextpdf.com/itext/digital-signatures-chapter-1.md) | **Understanding the concept of digital signatures**                                                                                                                   |
| DigestDefault                                       | An example showing how to use the MessageDigest class                                                                                                                 |
| DigestBC                                            | An example demonstrating the use of the Bouncy Castle library                                                                                                         |
| EncryptDecrypt                                      | An example of a simple class to encrypt and decrypt messages                                                                                                          |
|                                                     |                                                                                                                                                                       |
| [Chapter 2](https://kb.itextpdf.com/itext/digital-signatures-chapter-2.md) | **PDF and digital signatures**                                                                                                                                        |
| SignHelloWorld                                      | A simple example of adding a visible signature to a document                                                                                                          |
| SignHelloWorldWithTempFile                          | Signing a document using a temporary file to avoid `OutOfMemoryExceptions` with large PDFs                                                                            |
| SignEmptyField                                      | Signing an empty text field with iText                                                                                                                                |
| CreateEmptyField                                    | Creating an empty text field with iText                                                                                                                               |
| CustomAppearance                                    | Creating a custom appearance for the signature by adding a grey background                                                                                            |
| SignatureAppearance                                 | Creating custom text, custom fonts and using right-to-left writing in a signature                                                                                     |
| SignatureAppearances                                | Adding a custom image                                                                                                                                                 |
| SignatureMetadata                                   | Adding metadata to the signature dictionary                                                                                                                           |
| SignatureTypes                                      | Ordinary (approval) and Certification (author) signatures                                                                                                             |
| SequentialSignatures                                | Sequential signatures in PDFs                                                                                                                                         |
| SignatureWorkflow                                   | An example where multiple signatures are required                                                                                                                     |
| LockFields                                          | Locking fields and documents after signing                                                                                                                            |
|                                                     |                                                                                                                                                                       |
| [Chapter 3](https://kb.itextpdf.com/itext/digital-signatures-chapter-3.md) | **Certificate Authorities, certificate revocation and time stamping**                                                                                                 |
| SignWithCAcert                                      | Signing a document with a PKCS12 file from the CAcert Certificate Authority                                                                                           |
| GetCrlUrl                                           | Getting the Certificate Revocation List (CRL) URLs from a certificate chain                                                                                           |
| SignWithCRLDefaultImp                               | Using the default CrlClient implementation                                                                                                                            |
| SignWithCRLOnline                                   | Getting the CRL online                                                                                                                                                |
| SignWithCRLOffline                                  | Creating a CrlClient using an offline copy of the CRL                                                                                                                 |
| GetOcspUrl                                          | Fetching the Online Certificate Status Protocol (OCSP) URL from a certificate                                                                                         |
| SignWithOCSP                                        | Signing a document with the OCSP                                                                                                                                      |
| GetTsaUrl                                           | Extracting a Time Stamping Authority (TSA) URL from a certificate                                                                                                     |
| SignWithTSA                                         | Signing a document with TSAClientBouncyCastle, an implementation of TSAClient                                                                                         |
| SignWithTSAEvent                                    | Adding an event to a TSAClientBouncyCastle instance                                                                                                                   |
| SignWithToken                                       | Signing a document with a USB token using Microsoft CryptoAPI (MSCAPI) - *currently only available for Java*                                                          |
| SignWithEstimatedSize                               | Estimating the size in bytes of the signature content                                                                                                                 |
|                                                     |                                                                                                                                                                       |
| [Chapter 4](https://kb.itextpdf.com/itext/digital-signatures-chapter-4.md) | **Creating signatures externally**                                                                                                                                    |
| SignWithPKCS11HSM                                   | Signing a document with PKCS#11 using a Hardware Security Module (HSM) -*currently only available for Java*                                                           |
| SignWithPKCS11USB                                   | Signing a document with PKCS#11 using a USB token - c*urrently only available for Java*                                                                               |
| SignWithPKCS11SC                                    | Signing a document with PKCS#11 using a BEID - *currently only available for Java*                                                                                    |
| ClientServerSigning                                 | Signing a document on the client using a signature created on the server                                                                                              |
| ServerClientSigning                                 | Signing a document on the server using a signature created on the client                                                                                              |
| DeferredSigning                                     | Signing a document by creating a blank signature container, creating a signature appearance on the server and getting a hash to send to the client (deferred signing) |
|                                                     |                                                                                                                                                                       |
| [Chapter 5](https://kb.itextpdf.com/itext/digital-signatures-chapter-5.md) | **Validation of signed documents**                                                                                                                                    |
| SignatureIntegrity                                  | Checking the validity of a signature                                                                                                                                  |
| SignatureInfo                                       | Retrieving information from a signature                                                                                                                               |
| CertificateValidation                               | Validating the certificates of a signature                                                                                                                            |

If you need the original iText5/iTextSharp equivalent code examples, you'll find them linked below.

## Code examples for iText5/iTextSharp

[Digital signatures - chapter 1 - iText 5 Documentation](https://kb.itextpdf.com/it5kb/digital-signatures-chapter-1.md)

[Digital signatures - chapter 2 - iText 5 Documentation](https://kb.itextpdf.com/it5kb/digital-signatures-chapter-2.md)

[Digital signatures - chapter 3 - iText 5 Documentation](https://kb.itextpdf.com/it5kb/digital-signatures-chapter-3.md)

[Digital signatures - chapter 4 - iText 5 Documentation](https://kb.itextpdf.com/it5kb/digital-signatures-chapter-4.md)

[Digital signatures - chapter 5 - iText 5 Documentation](https://kb.itextpdf.com/it5kb/digital-signatures-chapter-5.md)

---
language: "en"
---
# Adding a background to a table - iText 5 Documentation

Examples written in answer to questions such as:

* Click [How to set background image in PdfPCell in iText? \| iText 5 PDF Development Guide \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-set-background-image-in-pdfpcell-in-itext.md)

## imagebackground

Java

    /**
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/24162974/how-to-set-background-image-in-pdfpcell-in-itext
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.ExceptionConverter;
    import com.itextpdf.text.Font;
    import com.itextpdf.text.Font.FontFamily;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.GrayColor;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPCellEvent;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class ImageBackground {

        class ImageBackgroundEvent implements PdfPCellEvent {

            protected Image image;
            
            public ImageBackgroundEvent(Image image) {
                this.image = image;
            }
            
            public void cellLayout(PdfPCell cell, Rectangle position,
                    PdfContentByte[] canvases) {
                try {
                    PdfContentByte cb = canvases[PdfPTable.BACKGROUNDCANVAS];
                    image.scaleAbsolute(position);
                    image.setAbsolutePosition(position.getLeft(), position.getBottom());
                    cb.addImage(image);
                } catch (DocumentException e) {
                    throw new ExceptionConverter(e);
                }
            }
            
        }
        
        public static final String DEST = "results/tables/imagebackground.pdf";
        public static final String IMG1 = "resources/images/bruno.jpg";
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new ImageBackground().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(1);
            table.setTotalWidth(400);
            table.setLockedWidth(true);
            PdfPCell cell = new PdfPCell();
            Font font = new Font(FontFamily.HELVETICA, 12, Font.NORMAL, GrayColor.GRAYWHITE);
            Paragraph p = new Paragraph("A cell with an image as background color.", font);
            cell.addElement(p);
            Image image = Image.getInstance(IMG1);
            cell.setCellEvent(new ImageBackgroundEvent(image));
            cell.setFixedHeight(600 * image.getScaledHeight() / image.getScaledWidth());
            table.addCell(cell);
            document.add(table);
            document.close();
        }
    }

## coloredbackground

Java

    /**
     * Example written by Bruno Lowagie and Nishanthi Grashia in answer to the following question:
     * http://stackoverflow.com/questions/27871574/appears-space-between-cells-without-border-itextpdf
     */
    package sandbox.tables;

    import com.itextpdf.text.BaseColor;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Element;
    import com.itextpdf.text.Font;
    import com.itextpdf.text.FontFactory;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class ColoredBackground {
        public static final String DEST = "results/tables/colored_background.pdf";

        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new ColoredBackground().createPdf(DEST);
        }
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table;
            PdfPCell cell;
            Font font = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, BaseColor.WHITE);
            table = new PdfPTable(16);
            for(int aw = 0; aw < 16; aw++){
                cell = new PdfPCell(new Phrase("hi", font));
                cell.setBackgroundColor(BaseColor.BLUE);
                cell.setBorder(Rectangle.NO_BORDER);
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
                table.addCell(cell);
            }
            document.add(table);
            document.close();
        }

    }

## simpletable10

Java

    /**
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/30267169/cannot-display-background-color-when-using-rowspan-with-itext-pdf
     */
    package sandbox.tables;

    import com.itextpdf.text.BaseColor;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class SimpleTable10 {
        public static final String DEST = "results/tables/simple_table10.pdf";

        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new SimpleTable10().createPdf(DEST);
        }
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(5);
            PdfPCell sn = new PdfPCell(new Phrase("S/N"));
            sn.setRowspan(2);
            sn.setBackgroundColor(BaseColor.YELLOW);
            table.addCell(sn);
            PdfPCell name = new PdfPCell(new Phrase("Name"));
            name.setColspan(3);
            name.setBackgroundColor(BaseColor.CYAN);
            table.addCell(name);
            PdfPCell age = new PdfPCell(new Phrase("Age"));
            age.setRowspan(2);
            age.setBackgroundColor(BaseColor.GRAY);
            table.addCell(age);
            PdfPCell surname = new PdfPCell(new Phrase("SURNAME"));
            surname.setBackgroundColor(BaseColor.BLUE);
            table.addCell(surname);
            PdfPCell firstname = new PdfPCell(new Phrase("FIRST NAME"));
            firstname.setBackgroundColor(BaseColor.RED);
            table.addCell(firstname);
            PdfPCell middlename = new PdfPCell(new Phrase("MIDDLE NAME"));
            middlename.setBackgroundColor(BaseColor.GREEN);
            table.addCell(middlename);
            PdfPCell f1 = new PdfPCell(new Phrase("1"));
            f1.setBackgroundColor(BaseColor.PINK);
            table.addCell(f1);
            PdfPCell f2 = new PdfPCell(new Phrase("James"));
            f2.setBackgroundColor(BaseColor.MAGENTA);
            table.addCell(f2);
            PdfPCell f3 = new PdfPCell(new Phrase("Fish"));
            f3.setBackgroundColor(BaseColor.ORANGE);
            table.addCell(f3);
            PdfPCell f4 = new PdfPCell(new Phrase("Stone"));
            f4.setBackgroundColor(BaseColor.DARK_GRAY);
            table.addCell(f4);
            PdfPCell f5 = new PdfPCell(new Phrase("17"));
            f5.setBackgroundColor(BaseColor.LIGHT_GRAY);
            table.addCell(f5);
            document.add(table);
            document.close();
        }

    }

## tiledbackground

Java

    /**
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/23374557/itextsharp-why-cell-background-image-is-rotated-90-degress-clockwise
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.ExceptionConverter;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPCellEvent;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfPatternPainter;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class TiledBackground {

        class TiledImageBackground implements PdfPCellEvent {

            protected Image image;
            
            public TiledImageBackground(Image image) {
                this.image = image;
            }
            
            public void cellLayout(PdfPCell cell, Rectangle position,
                    PdfContentByte[] canvases) {
                try {
                    PdfContentByte cb = canvases[PdfPTable.BACKGROUNDCANVAS];
                    PdfPatternPainter patternPainter = cb.createPattern(image.getScaledWidth(), image.getScaledHeight());
                    image.setAbsolutePosition(0, 0);
                    patternPainter.addImage(image);
                    cb.saveState();
                    cb.setPatternFill(patternPainter);
                    cb.rectangle(position.getLeft(), position.getBottom(), position.getWidth(), position.getHeight());
                    cb.fill();
                    cb.restoreState();
                } catch (DocumentException e) {
                    throw new ExceptionConverter(e);
                }
            }
            
        }
        
        public static final String DEST = "results/tables/tiled_pattern.pdf";
        public static final String IMG1 = "resources/images/ALxRF.png";
        public static final String IMG2 = "resources/images/bulb.gif";
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new TiledBackground().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(2);
            PdfPCell cell = new PdfPCell();
            Image image = Image.getInstance(IMG1);
            cell.setCellEvent(new TiledImageBackground(image));
            cell.setFixedHeight(770);
            table.addCell(cell);
            cell = new PdfPCell();
            image = Image.getInstance(IMG2);
            cell.setCellEvent(new TiledImageBackground(image));
            cell.setFixedHeight(770);
            table.addCell(cell);
            document.add(table);
            document.close();
        }
    }

## Resources

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/bruno.jpg>

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/ALxRF.png>

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/bulb.gif>

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_imagebackground.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_colored_background.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_simple_table10.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_tiled_pattern.pdf>

---
language: "en"
---
# Adding a cover page to an existing PDF

These examples were written in answer to the question Click [How to add a cover page to an existing PDF document? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-add-a-cover-page-to-an-existing-pdf-documen.md)

## addcover1

##GITHUB:https://github.com/itext/i7js-examples/blob/develop/src/main/java/com/itextpdf/samples/sandbox/merge/AddCover1.java##

## addcover2

##GITHUB:https://github.com/itext/i7js-examples/blob/develop/src/main/java/com/itextpdf/samples/sandbox/merge/AddCover2.java##

## Resources

<https://github.com/itext/i5js-sandbox/blob/master/resources/pdfs/hero.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/resources/pdfs/pages.pdf>

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/merge/cmp_pages_with_cover.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/merge/cmp_cover_with_pages.pdf>

---
language: "en"
---
# Adding an image to an existing file

## addimagewithid

Java

    /**
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/40336813/
     */
    package sandbox.stamper;

    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfImage;
    import com.itextpdf.text.pdf.PdfIndirectObject;
    import com.itextpdf.text.pdf.PdfName;
    import com.itextpdf.text.pdf.PdfReader;
    import com.itextpdf.text.pdf.PdfStamper;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;

    /**
     * @author Bruno Lowagie (iText Software)
     */
    public class AddImageWithId {
        public static final String SRC = "resources/pdfs/hello.pdf";
        public static final String DEST = "results/stamper/hello_with_image_id.pdf";
        public static final String IMG = "resources/images/bruno.jpg";
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new AddImageWithId().manipulatePdf(SRC, DEST);
        }

        public void manipulatePdf(String src, String dest) throws IOException, DocumentException {
            PdfReader reader = new PdfReader(src);
            PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
            Image image = Image.getInstance(IMG);
            PdfImage stream = new PdfImage(image, "", null);
            stream.put(new PdfName("ITXT_SpecialId"), new PdfName("123456789"));
            PdfIndirectObject ref = stamper.getWriter().addToBody(stream);
            image.setDirectReference(ref.getIndirectReference());
            image.setAbsolutePosition(36, 400);
            PdfContentByte over = stamper.getOverContent(1);
            over.addImage(image);
            stamper.close();
            reader.close();
        }
        
    }

## Resources

<https://github.com/itext/i5js-sandbox/blob/master/resources/pdfs/hello.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/bruno.jpg>

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/stamper/cmp_hello_with_image_id.pdf>

---
language: "en"
---
# Adding backgrounds using page events - iText 5 Documentation

Examples written in answer to questions such as:

* Click [How to change the color of pages? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-change-the-color-of-pages.md)

* [How to draw a border for PDF pages?](http://stackoverflow.com/questions/25749828/how-to-draw-border-for-whole-pdf-pages-using-itext-library-5-5-2)

## pagebackgrounds

Java

    /**
     * Example written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/30211043/change-the-color-of-pdf-pages-alternatively-using-itext-pdf-in-java
     */
    package sandbox.events;

    import com.itextpdf.text.BaseColor;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfPageEventHelper;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;

    import sandbox.WrapToTest;

    @WrapToTest
    public class PageBackgrounds {
        public static final String DEST = "results/events/page_backgrounds.pdf";
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new PageBackgrounds().createPdf(DEST);
        }
        
        public class Background extends PdfPageEventHelper {
            @Override
            public void onEndPage(PdfWriter writer, Document document) {
                int pagenumber = writer.getPageNumber();
                if (pagenumber % 2 == 1 && pagenumber != 1)
                    return;
                PdfContentByte canvas = writer.getDirectContentUnder();
                Rectangle rect = document.getPageSize();
                canvas.setColorFill(pagenumber < 3 ? BaseColor.BLUE : BaseColor.LIGHT_GRAY);
                canvas.rectangle(rect.getLeft(), rect.getBottom(), rect.getWidth(), rect.getHeight());
                canvas.fill();
            }
        }
        
        public void createPdf(String filename) throws IOException, DocumentException {
            // step 1
            Document document = new Document();
            // step 2
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filename));
            Background event = new Background();
            writer.setPageEvent(event);
            // step 3
            document.open();
            document.add(new Paragraph("Prime Numbers"));
            document.newPage();
            document.add(new Paragraph("An overview"));
            document.newPage();
            // step 4
            List<Integer> factors;
            for (int i = 2; i < 301; i++) {
                factors = getFactors(i);
                if (factors.size() == 1) {
                    document.add(new Paragraph("This is a prime number!"));
                }
                for (int factor : factors) {
                    document.add(new Paragraph("Factor: " + factor));
                }
                document.newPage();
            }
            // step 5
            document.close();
        }
        
        public static List<Integer> getFactors(int n) {
            List<Integer> factors = new ArrayList<Integer>();
            for (int i = 2; i <= n; i++) {
              while (n % i == 0) {
                factors.add(i);
                n /= i;
              }
            }
            return factors;
        }
    }

## pageborder

Java

    /**
     * Example written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/25749828/how-to-draw-border-for-whole-pdf-pages-using-itext-library-5-5-2
     */
    package sandbox.events;

    import com.itextpdf.text.BaseColor;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfPageEventHelper;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;

    import sandbox.WrapToTest;

    @WrapToTest
    public class PageBorder {
        public static final String DEST = "results/events/page_border.pdf";
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new PageBorder().createPdf(DEST);
        }
        
        public class RedBorder extends PdfPageEventHelper {
            @Override
            public void onEndPage(PdfWriter writer, Document document) {
                PdfContentByte canvas = writer.getDirectContent();
                Rectangle rect = document.getPageSize();
                rect.setBorder(Rectangle.BOX); // left, right, top, bottom border
                rect.setBorderWidth(5); // a width of 5 user units
                rect.setBorderColor(BaseColor.RED); // a red border
                rect.setUseVariableBorders(true); // the full width will be visible
                canvas.rectangle(rect);
            }
        }
        
        public void createPdf(String filename) throws IOException, DocumentException {
            // step 1
            Document document = new Document();
            // step 2
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filename));
            RedBorder event = new RedBorder();
            writer.setPageEvent(event);
            // step 3
            document.open();
            // step 4
            List<Integer> factors;
            for (int i = 2; i < 301; i++) {
                factors = getFactors(i);
                if (factors.size() == 1) {
                    document.add(new Paragraph("This is a prime number!"));
                }
                for (int factor : factors) {
                    document.add(new Paragraph("Factor: " + factor));
                }
                document.newPage();
            }
            // step 5
            document.close();
        }
        
        public static List<Integer> getFactors(int n) {
            List<Integer> factors = new ArrayList<Integer>();
            for (int i = 2; i <= n; i++) {
              while (n % i == 0) {
                factors.add(i);
                n /= i;
              }
            }
            return factors;
        }
    }

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/events/cmp_page_backgrounds.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/events/cmp_page_border.pdf>

---
language: "en"
---
# Adding fields to an existing form - iText 5 Documentation

Example to answer Click [How can I add a new AcroForm field to a PDF? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-can-i-add-a-new-acroform-field-to-a-pdf.md)

## addfield

Java

    /**
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/27206327/itext-add-new-acrofields-form-feilds-in-to-a-pdf-using-itext
     */
    package sandbox.acroforms;

    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.GrayColor;
    import com.itextpdf.text.pdf.PdfAction;
    import com.itextpdf.text.pdf.PdfFormField;
    import com.itextpdf.text.pdf.PdfReader;
    import com.itextpdf.text.pdf.PdfStamper;
    import com.itextpdf.text.pdf.PushbuttonField;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class AddField {

        public static final String SRC = "resources/pdfs/form.pdf";
        public static final String DEST = "results/acroforms/field_added.pdf";
        

        public static void main(String[] args) throws DocumentException, IOException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new AddField().manipulatePdf(SRC, DEST);
        }

        public void manipulatePdf(String src, String dest) throws DocumentException, IOException {
            PdfReader reader = new PdfReader(src);
            PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
            PushbuttonField button = new PushbuttonField(
                stamper.getWriter(), new Rectangle(36, 700, 72, 730), "post");
            button.setText("POST");
            button.setBackgroundColor(new GrayColor(0.7f));
            button.setVisibility(PushbuttonField.VISIBLE_BUT_DOES_NOT_PRINT);
            PdfFormField submit = button.getField();
            submit.setAction(PdfAction.createSubmitForm(
                "http://itextpdf.com:8180/book/request", null,
                PdfAction.SUBMIT_HTML_FORMAT | PdfAction.SUBMIT_COORDINATES));
            stamper.addAnnotation(submit, 1);
            stamper.close();
        }
    }

## addfieldandkids

Java

    /**
     * Example written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/28418555/remove-page-reference-from-annotation0
     */
    package sandbox.stamper;

    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.PdfFormField;
    import com.itextpdf.text.pdf.PdfReader;
    import com.itextpdf.text.pdf.PdfStamper;
    import com.itextpdf.text.pdf.PdfWriter;
    import com.itextpdf.text.pdf.TextField;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class AddFieldAndKids {

        public static final String SRC = "resources/pdfs/hello.pdf";
        public static final String DEST = "results/stamper/hello_with_field_kids.pdf";

        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new AddFieldAndKids().manipulatePdf(SRC, DEST);
        }

        public void manipulatePdf(String src, String dest) throws IOException, DocumentException {
            PdfReader reader = new PdfReader(src);
            PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
            PdfWriter writer = stamper.getWriter();
            PdfFormField personal = PdfFormField.createEmpty(writer);
            personal.setFieldName("personal");
            TextField name = new TextField(writer, new Rectangle(36, 760, 144, 790), "name");
            PdfFormField personal_name = name.getTextField();
            personal.addKid(personal_name);
            TextField password = new TextField(writer, new Rectangle(150, 760, 450, 790), "password");
            PdfFormField personal_password = password.getTextField();
            personal.addKid(personal_password);
            stamper.addAnnotation(personal, 1);
            stamper.close();
            reader.close();
        }
    }

## Resources

<https://github.com/itext/i5js-sandbox/blob/master/resources/pdfs/form.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/resources/pdfs/hello.pdf>

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/acroforms/cmp_field_added.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/stamper/cmp_hello_with_field_kids.pdf>

---
language: "en"
---
# Adding images to a table - iText 5 Documentation

This example was written in answer to questions such as:

* Click [How to precisely position an image on top of a PdfPTable?](https://kb.itextpdf.com/it5kb/how-to-precisely-position-an-image-on-top-of-a-pdf.md)

* Click [How to add two images in one cell? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-add-two-images-in-one-cell.md)

## imagesnexttoeachother

Java

    /**
     * Example written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/19700549/itextsharp-images-are-not-coming-next-to-one-another
     * 
     * We create a table with two columns and two cells.
     * This way, we can add two images next to each other.
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;

    import sandbox.WrapToTest;

    @WrapToTest
    public class ImagesNextToEachOther {
        public static final String DEST = "results/tables/images_next_to_each_other.pdf";
        public static final String IMG1 = "resources/images/javaone2013.jpg";
        public static final String IMG2 = "resources/images/berlin2013.jpg";

        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new ImagesNextToEachOther().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(2);
            table.setWidthPercentage(100);
            table.addCell(createImageCell(IMG1));
            table.addCell(createImageCell(IMG2));
            document.add(table);
            document.close();
        }
        
        public static PdfPCell createImageCell(String path) throws DocumentException, IOException {
            Image img = Image.getInstance(path);
            PdfPCell cell = new PdfPCell(img, true);
            return cell;
        }
    }

## icondescriptiontable

Java

    /**
     * This example was written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/23375618/how-to-add-an-icon-to-an-itext-pdfpcell
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class IconDescriptionTable {
        public static final String DEST = "results/tables/icon_description.pdf";
        public static final String IMG = "resources/images/bulb.gif";

        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new IconDescriptionTable().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(2);
            table.setWidths(new int[]{ 1, 9 });
            Image img = Image.getInstance(IMG);
            table.addCell(new PdfPCell(img, true));
            table.addCell(new Phrase("A light bulb icon"));
            document.add(table);
            document.close();
        }
    }

## imagenexttotext

Java

    /**
     * Example written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/25780258/how-to-display-image-and-text-beside-each-other-itext
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Element;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class ImageNextToText {
        public static final String DEST = "results/tables/image_next_to_text.pdf";
        public static final String IMG1 = "resources/images/javaone2013.jpg";

        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new ImageNextToText().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(2);
            table.setWidthPercentage(100);
            table.setWidths(new int[]{1, 2});
            table.addCell(createImageCell(IMG1));
            table.addCell(createTextCell("This picture was taken at Java One.\nIt shows the iText crew at Java One in 2013."));
            document.add(table);
            document.close();
        }
        
        public static PdfPCell createImageCell(String path) throws DocumentException, IOException {
            Image img = Image.getInstance(path);
            PdfPCell cell = new PdfPCell(img, true);
            return cell;
        }
        
        public static PdfPCell createTextCell(String text) throws DocumentException, IOException {
            PdfPCell cell = new PdfPCell();
            Paragraph p = new Paragraph(text);
            p.setAlignment(Element.ALIGN_RIGHT);
            cell.addElement(p);
            cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
            cell.setBorder(Rectangle.NO_BORDER);
            return cell;
        }
    }

## imagesinchunkincell

Java

    /**
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/32130219/itext-list-of-images-in-a-cell
     */
    package sandbox.tables;

    import com.itextpdf.text.Chunk;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    /**
     * @author Bruno Lowagie
     */
    @WrapToTest
    public class ImagesInChunkInCell {
        public static final String IMG = "resources/images/bulb.gif";
        public static final String DEST = "results/tables/list_with_images.pdf";
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new ImagesInChunkInCell().createPdf(DEST);
        }
            
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            Image image = Image.getInstance(IMG);
            image.setScaleToFitHeight(false);
            PdfPTable table = new PdfPTable(1);
            table.setTotalWidth(new float[]{120});
            table.setLockedWidth(true);
            Phrase listOfDots = new Phrase();
            for (int i = 0; i < 40; i++) {
                listOfDots.add(new Chunk(image, 0, 0));
                listOfDots.add(new Chunk(" "));
            }
            table.addCell(listOfDots);
            document.add(table);
            document.close();
        }
    }

## simpletable8

Java

    /**
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/29752875/generate-pdf-from-java-code-that-dynamically-continue-file-template-with-itext
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.pdf.PdfImportedPage;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfReader;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class SimpleTable8 {
        public static final String DEST = "results/tables/simple_table8.pdf";
        
        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new SimpleTable8().createPdf(DEST);
        }
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(3);
            table.setWidthPercentage(100);
            PdfReader reader = new PdfReader("resources/pdfs/header.pdf");
            PdfImportedPage header = writer.getImportedPage(reader, 1);
            PdfPCell cell = new PdfPCell(Image.getInstance(header));
            cell.setColspan(3);
            table.addCell(cell);
            for (int row = 1; row <= 50; row++) {
                for (int column = 1; column <= 3; column++) {
                    table.addCell(String.format("row %s, column %s", row, column));
                }
            }
            reader = new PdfReader("resources/pdfs/footer.pdf");
            PdfImportedPage footer = writer.getImportedPage(reader, 1);
            cell = new PdfPCell(Image.getInstance(footer));
            cell.setColspan(3);
            table.addCell(cell);
            document.add(table);
            document.close();
        }
    }

## positioncontentincell

Java

    /*
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/31169268/cell-background-image-with-text-itextsharp
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Element;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.ColumnText;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPCellEvent;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    /**
     *
     * @author Bruno Lowagie (iText Software)
     */
    @WrapToTest
    public class PositionContentInCell {
        public static final String DEST = "results/tables/position_content_in_cell.pdf";
        public static final String IMG = "resources/images/info.png";
        public enum POSITION { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT };
        
        class ImageEvent implements PdfPCellEvent {
            protected Image img;
            public ImageEvent(Image img) {
                this.img = img;
            }
            public void cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases) {
                img.scaleToFit(position.getWidth(), position.getHeight());
                img.setAbsolutePosition(position.getLeft() + (position.getWidth() - img.getScaledWidth()) / 2,
                        position.getBottom() + (position.getHeight() - img.getScaledHeight()) / 2);
                PdfContentByte canvas = canvases[PdfPTable.BACKGROUNDCANVAS];
                try {
                    canvas.addImage(img);
                } catch (DocumentException ex) {
                    // do nothing
                }
            }
        }
        
        class PositionEvent implements PdfPCellEvent {
            protected Phrase content;
            protected POSITION pos;
            
            public PositionEvent(Phrase content, POSITION pos) {
                this.content = content;
                this.pos = pos;
            }
            
            public void cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases) {
                PdfContentByte canvas = canvases[PdfPTable.TEXTCANVAS];
                float x = 0;
                float y = 0;
                int alignment = 0;
                switch (pos) {
                    case TOP_LEFT:
                        x = position.getLeft(3);
                        y = position.getTop(content.getLeading());
                        alignment = Element.ALIGN_LEFT;
                        break;
                    case TOP_RIGHT:
                        x = position.getRight(3);
                        y = position.getTop(content.getLeading());
                        alignment = Element.ALIGN_RIGHT;
                        break;
                    case BOTTOM_LEFT:
                        x = position.getLeft(3);
                        y = position.getBottom(3);
                        alignment = Element.ALIGN_LEFT;
                        break;
                    case BOTTOM_RIGHT:
                        x = position.getRight(3);
                        y = position.getBottom(3);
                        alignment = Element.ALIGN_RIGHT;
                        break;
                }
                ColumnText.showTextAligned(canvas, alignment, content, x, y, 0);
            }
        }
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new PositionContentInCell().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            // 1. Create a Document which contains a table:
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(2);
            PdfPCell cell1 = new PdfPCell();
            PdfPCell cell2 = new PdfPCell();
            PdfPCell cell3 = new PdfPCell();
            PdfPCell cell4 = new PdfPCell();
            // 2. Inside that table, make each cell with specific height:
            cell1.setFixedHeight(50);
            cell2.setFixedHeight(50);
            cell3.setFixedHeight(50);
            cell4.setFixedHeight(50);
            // 3. Each cell has the same background image
            ImageEvent imgEvent = new ImageEvent(Image.getInstance(IMG));
            cell1.setCellEvent(imgEvent);
            cell2.setCellEvent(imgEvent);
            cell3.setCellEvent(imgEvent);
            cell4.setCellEvent(imgEvent);
            // 4. Add text in front of the image at specific position
            cell1.setCellEvent(new PositionEvent(new Phrase("Top left"), POSITION.TOP_LEFT));
            cell2.setCellEvent(new PositionEvent(new Phrase("Top right"), POSITION.TOP_RIGHT));
            cell3.setCellEvent(new PositionEvent(new Phrase("Bottom left"), POSITION.BOTTOM_LEFT));
            cell4.setCellEvent(new PositionEvent(new Phrase("Bottom right"), POSITION.BOTTOM_RIGHT));
            // Wrap it all up!
            table.addCell(cell1);
            table.addCell(cell2);
            table.addCell(cell3);
            table.addCell(cell4);
            document.add(table);
            document.close();
        }
    }

## positioncontentincell2

Java

    /*
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/31169268/cell-background-image-with-text-itextsharp
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Element;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.ColumnText;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPCellEvent;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    /**
     *
     * @author Bruno Lowagie (iText Software)
     */
    @WrapToTest
    public class PositionContentInCell2 {
        public static final String DEST = "results/tables/position_content_in_cell2.pdf";
        public static final String IMG = "resources/images/info.png";
        
        class ImageEvent implements PdfPCellEvent {
            protected Image img;
            public ImageEvent(Image img) {
                this.img = img;
            }
            public void cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases) {
                img.scaleAbsolute(position.getWidth(), position.getHeight());
                img.setAbsolutePosition(position.getLeft(), position.getBottom());
                PdfContentByte canvas = canvases[PdfPTable.BACKGROUNDCANVAS];
                try {
                    canvas.addImage(img);
                } catch (DocumentException ex) {
                    // do nothing
                }
            }
        }
        
        class PositionEvent implements PdfPCellEvent {
            protected Phrase content;
            protected float wPct;
            protected float hPct;
            protected int alignment;
            
            public PositionEvent(Phrase content, float wPct, float hPct, int alignment) {
                this.content = content;
                this.wPct = wPct;
                this.hPct = hPct;
                this.alignment = alignment;
            }
            
            public void cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases) {
                PdfContentByte canvas = canvases[PdfPTable.TEXTCANVAS];
                float x = position.getLeft() + wPct * position.getWidth();
                float y = position.getBottom() + hPct * (position.getHeight() - content.getLeading());
                ColumnText.showTextAligned(canvas, alignment, content, x, y, 0);
            }
        }
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new PositionContentInCell2().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            // 1. Create a Document which contains a table:
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(2);
            PdfPCell cell1 = new PdfPCell();
            PdfPCell cell2 = new PdfPCell();
            PdfPCell cell3 = new PdfPCell();
            PdfPCell cell4 = new PdfPCell();
            PdfPCell cell5 = new PdfPCell();
            PdfPCell cell6 = new PdfPCell();
            PdfPCell cell7 = new PdfPCell();
            PdfPCell cell8 = new PdfPCell();
            // 2. Inside that table, make each cell with specific height:
            cell1.setFixedHeight(50);
            cell2.setFixedHeight(50);
            cell3.setFixedHeight(50);
            cell4.setFixedHeight(50);
            cell5.setFixedHeight(50);
            cell6.setFixedHeight(50);
            cell7.setFixedHeight(50);
            cell8.setFixedHeight(50);
            // 3. Each cell has the same background image
            ImageEvent imgEvent = new ImageEvent(Image.getInstance(IMG));
            cell1.setCellEvent(imgEvent);
            cell2.setCellEvent(imgEvent);
            cell3.setCellEvent(imgEvent);
            cell4.setCellEvent(imgEvent);
            cell5.setCellEvent(imgEvent);
            cell6.setCellEvent(imgEvent);
            cell7.setCellEvent(imgEvent);
            cell8.setCellEvent(imgEvent);
            // 4. Add text in front of the image at specific position
            cell1.setCellEvent(new PositionEvent(new Phrase(14, "Top left"), 0, 1, Element.ALIGN_LEFT));
            cell2.setCellEvent(new PositionEvent(new Phrase(14, "Top right"), 1, 1, Element.ALIGN_RIGHT));
            cell3.setCellEvent(new PositionEvent(new Phrase(14, "Top center"), 0.5f, 1, Element.ALIGN_CENTER));
            cell4.setCellEvent(new PositionEvent(new Phrase(14, "Bottom center"), 0.5f, 0, Element.ALIGN_CENTER));
            cell5.setCellEvent(new PositionEvent(new Phrase(14, "Middle center"), 0.5f, 0.5f, Element.ALIGN_CENTER));
            cell6.setCellEvent(new PositionEvent(new Phrase(14, "Middle center"), 0.5f, 0.5f, Element.ALIGN_CENTER));
            cell7.setCellEvent(new PositionEvent(new Phrase(14, "Bottom left"), 0, 0, Element.ALIGN_LEFT));
            cell8.setCellEvent(new PositionEvent(new Phrase(14, "Bottom right"), 1, 0, Element.ALIGN_RIGHT));
            // Wrap it all up!
            table.addCell(cell1);
            table.addCell(cell2);
            table.addCell(cell3);
            table.addCell(cell4);
            table.addCell(cell5);
            table.addCell(cell6);
            table.addCell(cell7);
            table.addCell(cell8);
            document.add(table);
            document.close();
        }
    }

## addoverlappingimage

Java

    /**
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/22094289/itext-precisely-position-an-image-on-top-of-a-pdfptable
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.ExceptionConverter;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfPTableEvent;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;

    import sandbox.WrapToTest;

    @WrapToTest
    public class AddOverlappingImage {
        
        public static final String DEST = "results/tables/add_overlapping_image.pdf";

        public class ImageContent implements PdfPTableEvent {
            protected Image content;
            public ImageContent(Image content) {
                this.content = content;
            }
            public void tableLayout(PdfPTable table, float[][] widths,
                    float[] heights, int headerRows, int rowStart,
                    PdfContentByte[] canvases) {
                try {
                    PdfContentByte canvas = canvases[PdfPTable.TEXTCANVAS];
                    float x = widths[3][1] + 10;
                    float y = heights[3] - 10 - content.getScaledHeight();
                    content.setAbsolutePosition(x, y);
                    canvas.addImage(content);
                } catch (DocumentException e) {
                    throw new ExceptionConverter(e);
                }
            }
        }
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new AddOverlappingImage().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(5);
            table.setTableEvent(new ImageContent(Image.getInstance("resources/images/hero.jpg")));
            table.setWidthPercentage(100);
            PdfPCell cell;
            for (int r = 'A'; r <= 'Z'; r++) {
                for (int c = 1; c <= 5; c++) {
                    cell = new PdfPCell();
                    cell.addElement(new Paragraph(String.valueOf((char) r) + String.valueOf(c)));
                    table.addCell(cell);
                }
            }
            document.add(table);
            document.close();
        }
    }

## multipleimagesincell

Java

    /*
     * Example written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/33603296/how-to-add-two-images-in-one-cell-in-itext
     */
    package sandbox.tables;

    import com.itextpdf.text.Chunk;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    /**
     * @author Bruno Lowagie (iText Software)
     */
    @WrapToTest
    public class MultipleImagesInCell {
        
        public static final String DEST = "results/tables/images_in_cell.pdf";
        public static final String IMG1 = "resources/images/brasil.png";
        public static final String IMG2 = "resources/images/dog.bmp";
        public static final String IMG3 = "resources/images/fox.bmp";

        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new MultipleImagesInCell().createPdf(DEST);
        }

        public void createPdf(String dest) throws IOException, DocumentException {
            Image img1 = Image.getInstance(IMG1);
            Image img2 = Image.getInstance(IMG2);
            Image img3 = Image.getInstance(IMG3);
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(1);
            table.setWidthPercentage(50);
            table.addCell("Different images, one after the other vertically:");
            PdfPCell cell = new PdfPCell();
            cell.addElement(img1);
            cell.addElement(img2);
            cell.addElement(img3);
            table.addCell(cell);
            document.add(table);
            document.newPage();
            table = new PdfPTable(1);
            table.addCell("Different images, one after the other vertically, but scaled:");
            cell = new PdfPCell();
            img1.setWidthPercentage(20);
            cell.addElement(img1);
            img2.setWidthPercentage(20);
            cell.addElement(img2);
            img3.setWidthPercentage(20);
            cell.addElement(img3);
            table.addCell(cell);
            table.addCell("Different images, one after the other horizontally:");
            Paragraph p = new Paragraph();
            img1.scalePercent(30);
            p.add(new Chunk(img1, 0, 0, true));
            p.add(new Chunk(img2, 0, 0, true));
            p.add(new Chunk(img3, 0, 0, true));
            cell = new PdfPCell();
            cell.addElement(p);
            table.addCell(cell);
            table.addCell("Text and images (mixed):");
            p = new Paragraph("The quick brown ");
            p.add(new Chunk(img3, 0, 0, true));
            p.add(" jumps over the lazy ");
            p.add(new Chunk(img2, 0, 0, true));
            cell = new PdfPCell();
            cell.addElement(p);
            table.addCell(cell);
            document.add(table);
            document.close();
        }
    }

## multipleimagesintable

Java

    /*
     * Example written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/34303448
     */
    package sandbox.tables;

    import com.itextpdf.text.Chunk;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    /**
     * @author Bruno Lowagie (iText Software)
     */
    @WrapToTest
    public class MultipleImagesInTable {
        
        public static final String DEST = "results/tables/images_in_table_sequence.pdf";
        public static final String IMG1 = "resources/images/brasil.png";
        public static final String IMG2 = "resources/images/dog.bmp";
        public static final String IMG3 = "resources/images/fox.bmp";

        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new MultipleImagesInTable().createPdf(DEST);
        }

        public void createPdf(String dest) throws IOException, DocumentException {
            Image img1 = Image.getInstance(IMG1);
            Image img2 = Image.getInstance(IMG2);
            Image img3 = Image.getInstance(IMG3);
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(1);
            table.setWidthPercentage(20);
            table.addCell(img1);
            table.addCell("Brazil");
            table.addCell(img2);
            table.addCell("Dog");
            table.addCell(img3);
            table.addCell("Fox");
            document.add(table);
            document.close();
        }
    }

## Resources

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/berlin2013.jpg>

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/javaone2013.jpg>

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/bulb.gif>

<https://github.com/itext/i5js-sandbox/blob/master/resources/pdfs/footer.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/resources/pdfs/header.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/info.png>

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/hero.jpg>

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/brasil.png>

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/dog.bmp>

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/fox.bmp>

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_images_next_to_each_other.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_icon_description.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_image_next_to_text.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_list_with_images.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_simple_table8.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_position_content_in_cell.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_position_content_in_cell2.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_add_overlapping_image.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_images_in_cell.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_images_in_table_sequence.pdf>

---
language: "en"
---
# Adding links in a table cell - iText 5 Documentation

## linkintablecell

Java

    /*
     * This example was written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/35288194
     */
    package sandbox.tables;

    import com.itextpdf.text.Chunk;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.PdfAction;
    import com.itextpdf.text.pdf.PdfAnnotation;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPCellEvent;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    /**
     * @author Bruno Lowagie (iText Software)
     */
    @WrapToTest
    public class LinkInTableCell {
        public static final String DEST = "results/tables/link_in_table_cell.pdf";

        class LinkInCell implements PdfPCellEvent {
            protected String url;
            public LinkInCell(String url) {
                this.url = url;
            }
            public void cellLayout(PdfPCell cell, Rectangle position,
                PdfContentByte[] canvases) {
                PdfWriter writer = canvases[0].getPdfWriter();
                PdfAction action = new PdfAction(url);
                PdfAnnotation link = PdfAnnotation.createLink(
                    writer, position, PdfAnnotation.HIGHLIGHT_INVERT, action);
                writer.addAnnotation(link);
            }
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(1);
            // Part of the content is a link:
            Phrase phrase = new Phrase();
            phrase.add("The founders of iText are nominated for a ");
            Chunk chunk = new Chunk("European Business Award!");
            chunk.setAnchor("http://itextpdf.com/blog/european-business-award-kick-ceremony");
            phrase.add(chunk);
            table.addCell(phrase);
            // The complete cell is a link:
            PdfPCell cell = new PdfPCell(new Phrase("Help us win a European Business Award!"));
            cell.setCellEvent(new LinkInCell("http://itextpdf.com/blog/help-us-win-european-business-award"));
            table.addCell(cell);
            document.add(table);
            document.close();
        }
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new LinkInTableCell().createPdf(DEST);
        }
    }

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_link_in_table_cell.pdf>

---
language: "en"
---
# Adding metadata - iText 5 Documentation

These examples were written in answer to questions such as:

* Click [How do I add XMP metadata to each page of an existing PDF?](https://kb.itextpdf.com/it5kb/how-do-i-add-xmp-metadata-to-each-page-of-an-exist.md)

## addxmptopage

Java

    /**
     * Example written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/28427100/how-do-i-add-xmp-metadata-to-each-page-of-an-existing-pdf-using-itextsharp
     */
    package sandbox.stamper;

    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.pdf.PdfDictionary;
    import com.itextpdf.text.pdf.PdfIndirectObject;
    import com.itextpdf.text.pdf.PdfName;
    import com.itextpdf.text.pdf.PdfReader;
    import com.itextpdf.text.pdf.PdfStamper;
    import com.itextpdf.text.pdf.PdfStream;
    import com.itextpdf.text.xml.xmp.XmpWriter;

    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;

    public class AddXmpToPage {

        public static final String SRC = "resources/pdfs/hello.pdf";
        public static final String DEST = "results/stamper/hello_with_page_xmp.pdf";

        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new AddXmpToPage().manipulatePdf(SRC, DEST);
        }

        public void manipulatePdf(String src, String dest) throws IOException, DocumentException {
            PdfReader reader = new PdfReader(src);
            PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
            PdfDictionary page = reader.getPageN(1);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            XmpWriter xmp = new XmpWriter(baos, new PdfDictionary());
            xmp.close();
            PdfIndirectObject ref = stamper.getWriter().addToBody(new PdfStream(baos.toByteArray()));
            page.put(PdfName.METADATA, ref.getIndirectReference());
            stamper.close();
            reader.close();
        }
    }

## changeinfodictionary

Java

    /**
     * Example written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/21607286/unicode-characters-in-document-info-dictionary-keys
     * 
     * A user wants to update a Document Info Dictionary (DID)
     * introducing a custom key with a Unicode character.
     */
    package sandbox.stamper;

    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.pdf.PdfReader;
    import com.itextpdf.text.pdf.PdfStamper;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Map;

    import sandbox.WrapToTest;

    @WrapToTest
    public class ChangeInfoDictionary {

        public static final String SRC = "resources/pdfs/hello.pdf";
        public static final String DEST = "results/stamper/unicode_in_did.pdf";

        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new ChangeInfoDictionary().manipulatePdf(SRC, DEST);
        }

        public void manipulatePdf(String src, String dest) throws IOException, DocumentException {
            PdfReader reader = new PdfReader(src);
            PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
            Map<String, String> info = reader.getInfo();
            info.put("Special Character: \u00e4", "\u00e4");
            StringBuilder sb = new StringBuilder();
            sb.append((char) 0xc3);
            sb.append((char) 0xa4);
            info.put(sb.toString(), "\u00e4");
            stamper.setMoreInfo(info);
            stamper.close();
            reader.close();
        }
    }

## addlanguage

Java

    /**
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/24370273/set-initial-view-pdf-document-properties-using-itextsharp-with-c-sharp
     */
    package sandbox.stamper;

    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.pdf.PdfName;
    import com.itextpdf.text.pdf.PdfReader;
    import com.itextpdf.text.pdf.PdfStamper;
    import com.itextpdf.text.pdf.PdfString;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class AddLanguage {

        public static final String SRC = "resources/pdfs/hello.pdf";
        public static final String DEST = "results/stamper/hello_english.pdf";
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new AddLanguage().manipulatePdf(SRC, DEST);
        }

        public void manipulatePdf(String src, String dest) throws IOException, DocumentException {
            PdfReader reader = new PdfReader(src);
            PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
            stamper.getWriter().getExtraCatalog().put(PdfName.LANG, new PdfString("EN"));
            stamper.close();
            reader.close();
        }

    }

## changeversion

Java

    /**
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/23083220/how-to-set-pdf-version-using-itextsharp
     */
    package sandbox.stamper;

    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.pdf.PdfReader;
    import com.itextpdf.text.pdf.PdfStamper;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class ChangeVersion {

        public static final String SRC = "resources/pdfs/OCR.pdf";
        public static final String DEST = "results/stamper/other_version.pdf";
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new ChangeVersion().manipulatePdf(SRC, DEST);
        }

        public void manipulatePdf(String src, String dest) throws IOException, DocumentException {
            PdfReader reader = new PdfReader(src);
            PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest), '4');
            stamper.close();
            reader.close();
        }

    }

## changemetadata

Java

    /*
     * Example written by Bruno Lowagie in answer to a question on SO
     */
    package sandbox.stamper;

    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.pdf.PdfDate;
    import com.itextpdf.text.pdf.PdfName;
    import com.itextpdf.text.pdf.PdfReader;
    import com.itextpdf.text.pdf.PdfStamper;
    import com.itextpdf.text.xml.xmp.XmpWriter;
    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Map;

    /**
     * @author iText
     */
    public class ChangeMetadata {

        public static final String SRC = "resources/pdfs/state.pdf";
        public static final String DEST = "results/stamper/state_metadata.pdf";

        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new ChangeMetadata().manipulatePdf(SRC, DEST);
        }
           
        public void manipulatePdf(String src, String dest) throws IOException, DocumentException {
            PdfReader reader = new PdfReader(src);
            PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
            Map info = reader.getInfo();
            info.put("Title", "New title");
            info.put("CreationDate", new PdfDate().toString());
            stamper.setMoreInfo(info);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            XmpWriter xmp = new XmpWriter(baos, info);
            xmp.close();
            stamper.setXmpMetadata(baos.toByteArray());
            stamper.close();
            reader.close();
        }
    }

## Resources

<https://github.com/itext/i5js-sandbox/blob/master/resources/pdfs/hello.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/resources/pdfs/OCR.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/resources/pdfs/state.pdf>

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/stamper/cmp_hello_with_page_xmp.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/stamper/cmp_unicode_in_did.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/stamper/cmp_hello_english.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/stamper/cmp_other_version.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/stamper/cmp_state_metadata.pdf>

---
language: "en"
---
# Adding page numbers to an existing PDF - iText 5 Documentation

In this example, we use `ColumnText` to add page numbers to an existing PDF document.

## stamppagexofy

Java

    package sandbox.stamper;

    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Element;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.pdf.ColumnText;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfReader;
    import com.itextpdf.text.pdf.PdfStamper;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;

    import sandbox.WrapToTest;

    @WrapToTest
    public class StampPageXofY {

        public static final String SRC = "resources/pdfs/nameddestinations.pdf";
        public static final String DEST = "results/stamper/pagenumbers.pdf";

        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new StampPageXofY().manipulatePdf(SRC, DEST);
        }

        public void manipulatePdf(String src, String dest) throws IOException, DocumentException {
            PdfReader reader = new PdfReader(src);
            int n = reader.getNumberOfPages();
            PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
            PdfContentByte pagecontent;
            for (int i = 0; i < n; ) {
                pagecontent = stamper.getOverContent(++i);
                ColumnText.showTextAligned(pagecontent, Element.ALIGN_RIGHT,
                        new Phrase(String.format("page %s of %s", i, n)), 559, 806, 0);
            }
            stamper.close();
            reader.close();
        }
    }

## Resources

<https://github.com/itext/i5js-sandbox/blob/master/resources/pdfs/nameddestinations.pdf>

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/stamper/cmp_pagenumbers.pdf>

---
language: "en"
---
# Adding watermarks to images - iText 5 Documentation

These examples were written in answer to the following questions:

* Click [How to add text to an image? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-add-text-to-an-image.md)

* Click [How to draw lines on an image? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-draw-lines-on-an-image.md)

## watermarkedimages1

Java

    /**
     * This code sample was written by Bruno Lowagie in answer to this question:
     * http://stackoverflow.com/questions/26814958/pdf-vertical-postion-method-gives-the-next-page-position-instead-of-current-page
     */
    package sandbox.images;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Element;
    import com.itextpdf.text.Font;
    import com.itextpdf.text.Font.FontFamily;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.pdf.ColumnText;
    import com.itextpdf.text.pdf.GrayColor;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfTemplate;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class WatermarkedImages1 {
        public static final String IMAGE1 = "resources/images/bruno.jpg";
        public static final String IMAGE2 = "resources/images/dog.bmp";
        public static final String IMAGE3 = "resources/images/fox.bmp";
        public static final String IMAGE4 = "resources/images/bruno_ingeborg.jpg";
        public static final Font FONT = new Font(FontFamily.HELVETICA, 12, Font.NORMAL, GrayColor.GRAYWHITE);
        public static final String DEST = "results/images/watermark_template.pdf";
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new WatermarkedImages1().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfContentByte cb = writer.getDirectContentUnder();
            document.add(getWatermarkedImage(cb, Image.getInstance(IMAGE1), "Bruno"));
            document.add(getWatermarkedImage(cb, Image.getInstance(IMAGE2), "Dog"));
            document.add(getWatermarkedImage(cb, Image.getInstance(IMAGE3), "Fox"));
            Image img = Image.getInstance(IMAGE4);
            img.scaleToFit(400, 700);
            document.add(getWatermarkedImage(cb, img, "Bruno and Ingeborg"));
            document.close();
        }
        
        public Image getWatermarkedImage(PdfContentByte cb, Image img, String watermark) throws DocumentException {
            float width = img.getScaledWidth();
            float height = img.getScaledHeight();
            PdfTemplate template = cb.createTemplate(width, height);
            template.addImage(img, width, 0, 0, height, 0, 0);
            ColumnText.showTextAligned(template, Element.ALIGN_CENTER,
                    new Phrase(watermark, FONT), width / 2, height / 2, 30);
            return Image.getInstance(template);
        }
    }

## watermarkedimages2

Java

    /**
     * This code sample was written by Bruno Lowagie in answer to this question:
     * http://stackoverflow.com/questions/26814958/pdf-vertical-postion-method-gives-the-next-page-position-instead-of-current-page
     */
    package sandbox.images;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Element;
    import com.itextpdf.text.Font;
    import com.itextpdf.text.Font.FontFamily;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.ColumnText;
    import com.itextpdf.text.pdf.GrayColor;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPCellEvent;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class WatermarkedImages2 {
        public static final String IMAGE1 = "resources/images/bruno.jpg";
        public static final String IMAGE2 = "resources/images/dog.bmp";
        public static final String IMAGE3 = "resources/images/fox.bmp";
        public static final String IMAGE4 = "resources/images/bruno_ingeborg.jpg";
        public static final Font FONT = new Font(FontFamily.HELVETICA, 12, Font.NORMAL, GrayColor.GRAYWHITE);
        public static final String DEST = "results/images/watermark_table.pdf";
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new WatermarkedImages2().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(1);
            table.setWidthPercentage(100);
            PdfPCell cell;
            cell = new PdfPCell(Image.getInstance(IMAGE1), true);
            cell.setCellEvent(new WatermarkedCell("Bruno"));
            table.addCell(cell);
            cell = new PdfPCell(Image.getInstance(IMAGE2), true);
            cell.setCellEvent(new WatermarkedCell("Dog"));
            table.addCell(cell);
            cell = new PdfPCell(Image.getInstance(IMAGE3), true);
            cell.setCellEvent(new WatermarkedCell("Fox"));
            table.addCell(cell);
            cell = new PdfPCell(Image.getInstance(IMAGE4), true);
            cell.setCellEvent(new WatermarkedCell("Bruno and Ingeborg"));
            table.addCell(cell);
            document.add(table);
            document.close();
        }
        
        class WatermarkedCell implements PdfPCellEvent {
            String watermark;
            
            public WatermarkedCell(String watermark) {
                this.watermark = watermark;
            }
            
            public void cellLayout(PdfPCell cell, Rectangle position,
                PdfContentByte[] canvases) {
                PdfContentByte canvas = canvases[PdfPTable.TEXTCANVAS];
                ColumnText.showTextAligned(canvas, Element.ALIGN_CENTER,
                    new Phrase(watermark, FONT),
                    (position.getLeft() + position.getRight()) / 2,
                    (position.getBottom() + position.getTop()) / 2, 30);
            }
        }
    }

## watermarkedimages3

Java

    /**
     * This code sample was written by Bruno Lowagie in answer to this question:
     * http://stackoverflow.com/questions/28515474/how-to-add-text-on-the-last-page-through-pdfcontentbyte
     */
    package sandbox.images;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Element;
    import com.itextpdf.text.Font;
    import com.itextpdf.text.Font.FontFamily;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.pdf.ColumnText;
    import com.itextpdf.text.pdf.GrayColor;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfTemplate;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class WatermarkedImages3 {
        public static final String IMAGE1 = "resources/images/bruno.jpg";
        public static final Font FONT = new Font(FontFamily.HELVETICA, 12, Font.NORMAL, GrayColor.GRAYWHITE);
        public static final String DEST = "results/images/watermark3.pdf";
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new WatermarkedImages3().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(1);
            for (int i = 0; i < 50; i++) {
                table.addCell("rahlrokks doesn't listen to what people tell him");
            }
            PdfContentByte cb = writer.getDirectContentUnder();
            table.addCell(getWatermarkedImage(cb, Image.getInstance(IMAGE1), "Bruno"));
            document.add(table);
            ColumnText.showTextAligned(cb, Element.ALIGN_CENTER, new Phrase("Bruno knows best"), 260, 400, 45);
            document.close();
        }
        
        public Image getWatermarkedImage(PdfContentByte cb, Image img, String watermark) throws DocumentException {
            float width = img.getScaledWidth();
            float height = img.getScaledHeight();
            PdfTemplate template = cb.createTemplate(width, height);
            template.addImage(img, width, 0, 0, height, 0, 0);
            ColumnText.showTextAligned(template, Element.ALIGN_CENTER,
                    new Phrase(watermark, FONT), width / 2, height / 2, 30);
            return Image.getInstance(template);
        }
    }

## watermarkedimages4

Java

    /**
     * This code sample was written by Bruno Lowagie in answer to this question:
     * http://stackoverflow.com/questions/29561417/draw-lines-on-image-in-pdf-using-itextsharp
     */
    package sandbox.images;

    import com.itextpdf.text.BaseColor;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfTemplate;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class WatermarkedImages4 {
        public static final String IMAGE1 = "resources/images/bruno.jpg";
        public static final String IMAGE2 = "resources/images/dog.bmp";
        public static final String IMAGE3 = "resources/images/fox.bmp";
        public static final String IMAGE4 = "resources/images/bruno_ingeborg.jpg";
        public static final String DEST = "results/images/watermark_image4.pdf";
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new WatermarkedImages4().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfContentByte cb = writer.getDirectContentUnder();
            document.add(getWatermarkedImage(cb, Image.getInstance(IMAGE1)));
            document.add(getWatermarkedImage(cb, Image.getInstance(IMAGE2)));
            document.add(getWatermarkedImage(cb, Image.getInstance(IMAGE3)));
            Image img = Image.getInstance(IMAGE4);
            img.scaleToFit(400, 700);
            document.add(getWatermarkedImage(cb, img));
            document.close();
        }
        
        public Image getWatermarkedImage(PdfContentByte cb, Image img) throws DocumentException {
            float width = img.getScaledWidth();
            float height = img.getScaledHeight();
            PdfTemplate template = cb.createTemplate(width, height);
            template.addImage(img, width, 0, 0, height, 0, 0);
            template.saveState();
            template.setColorStroke(BaseColor.GREEN);
            template.setLineWidth(3);
            template.moveTo(width * .25f, height * .25f);
            template.lineTo(width * .75f, height * .75f);
            template.moveTo(width * .25f, height * .75f);
            template.lineTo(width * .25f, height * .25f);
            template.stroke();
            template.setColorStroke(BaseColor.WHITE);
            template.ellipse(0, 0, width, height);
            template.stroke();
            template.restoreState();
            return Image.getInstance(template);
        }
    }

## watermarkedimages5

Java

    /**
     * This code sample was written by Bruno Lowagie in answer to this question:
     * http://stackoverflow.com/questions/38027783
     */
    package sandbox.images;

    import com.itextpdf.text.BaseColor;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Image;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfTemplate;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class WatermarkedImages5 {
        public static final String IMAGE1 = "resources/images/bruno.jpg";
        public static final String IMAGE2 = "resources/images/dog.bmp";
        public static final String IMAGE3 = "resources/images/fox.bmp";
        public static final String IMAGE4 = "resources/images/bruno_ingeborg.jpg";
        public static final String DEST = "results/images/watermark_image5.pdf";
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new WatermarkedImages5().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfContentByte cb = writer.getDirectContentUnder();
            document.add(getWatermarkedImage(cb, Image.getInstance(IMAGE1)));
            document.add(getWatermarkedImage(cb, Image.getInstance(IMAGE2)));
            document.add(getWatermarkedImage(cb, Image.getInstance(IMAGE3)));
            Image img = Image.getInstance(IMAGE4);
            img.scaleToFit(400, 700);
            document.add(getWatermarkedImage(cb, img));
            document.close();
        }
        
        public Image getWatermarkedImage(PdfContentByte cb, Image img) throws DocumentException {
            float width = img.getScaledWidth();
            float height = img.getScaledHeight();
            PdfTemplate template = cb.createTemplate(width, height);
            template.addImage(img, width, 0, 0, height, 0, 0);
            PdfPTable table = new PdfPTable(2);
            table.setTotalWidth(width);
            table.getDefaultCell().setBorderColor(BaseColor.YELLOW);
            table.addCell("Test1");
            table.addCell("Test2");
            table.addCell("Test3");
            table.addCell("Test4");
            table.writeSelectedRows(0, -1, 0, height, template);
            return Image.getInstance(template);
        }
    }

## Resources

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/bruno.jpg>

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/bruno_ingeborg.jpg>

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/dog.bmp>

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/fox.bmp>

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/images/cmp_watermark_template.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/images/cmp_watermark_table.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/images/cmp_watermark3.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/images/cmp_watermark_image4.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/images/cmp_watermark_image5.pdf>

---
language: "en"
---
# AESCipher

## AESCipher `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf.crypto iTextSharp.text.pdf.crypto.AESCipher\[\[AESCipher\]\] end

### Members

#### Methods

##### Public methods

|    Returns     |                                          Name                                           |
|----------------|-----------------------------------------------------------------------------------------|
| ```byte``[]``` | [`DoFinal`](https://kb.itextpdf.com/it5kb/aescipher.md#dofinal) ()                                             |
| ```byte``[]``` | [`Update`](https://kb.itextpdf.com/it5kb/aescipher.md#update) (```byte``[]``` inp, `int` inpOff, `int` inpLen) |

### Details

#### Constructors

##### AESCipher

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/crypto/AESCipherCBCnoPad.cs#L59)  
public AESCipher(bool forEncryption, byte\[\] key, byte\[\] iv)

###### Arguments

|      Type      |     Name      | Description |
|----------------|---------------|-------------|
| `bool`         | forEncryption |             |
| ```byte``[]``` | key           |             |
| ```byte``[]``` | iv            |             |

#### Methods

##### Update

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/crypto/AESCipherCBCnoPad.cs#L59)  
public virtual byte Update(byte\[\] inp, int inpOff, int inpLen)

###### Arguments

|      Type      |  Name  | Description |
|----------------|--------|-------------|
| ```byte``[]``` | inp    |             |
| `int`          | inpOff |             |
| `int`          | inpLen |             |

##### DoFinal

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/crypto/AESCipherCBCnoPad.cs#L59)  
public virtual byte DoFinal()

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# AESCipherCBCnoPad

## AESCipherCBCnoPad `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf.crypto iTextSharp.text.pdf.crypto.AESCipherCBCnoPad\[\[AESCipherCBCnoPad\]\] end

### Members

#### Methods

##### Public methods

|    Returns     |                                                    Name                                                     |
|----------------|-------------------------------------------------------------------------------------------------------------|
| ```byte``[]``` | [`ProcessBlock`](https://kb.itextpdf.com/it5kb/aesciphercbcnopad.md#processblock) (```byte``[]``` inp, `int` inpOff, `int` inpLen) |

### Details

#### Constructors

##### AESCipherCBCnoPad

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/crypto/AESCipher.cs#L58)  
public AESCipherCBCnoPad(bool forEncryption, byte\[\] key)

###### Arguments

|      Type      |     Name      | Description |
|----------------|---------------|-------------|
| `bool`         | forEncryption |             |
| ```byte``[]``` | key           |             |

#### Methods

##### ProcessBlock

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/crypto/AESCipher.cs#L58)  
public virtual byte ProcessBlock(byte\[\] inp, int inpOff, int inpLen)

###### Arguments

|      Type      |  Name  | Description |
|----------------|--------|-------------|
| ```byte``[]``` | inp    |             |
| `int`          | inpOff |             |
| `int`          | inpLen |             |

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# AffineTransform

## AffineTransform `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.awt.geom iTextSharp.awt.geom.AffineTransform\[\[AffineTransform\]\] end subgraph System System.ICloneable\[\[ICloneable\]\] end System.ICloneable --\> iTextSharp.awt.geom.AffineTransform

### Members

#### Properties

##### Public properties

| Type  |                   Name                   | Methods |
|-------|------------------------------------------|---------|
| `int` | [`Type`](https://kb.itextpdf.com/it5kb/affinetransform.md#type) | `get`   |

#### Methods

##### Public methods

|                           Returns                           |                                                             Name                                                              |
|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| `object`                                                    | [`Clone`](https://kb.itextpdf.com/it5kb/affinetransform.md#clone) ()                                                                                 |
| `void`                                                      | [`Concatenate`](https://kb.itextpdf.com/it5kb/affinetransform.md#concatenate) ( [`AffineTransform`](itextsharp/awt/geom/AffineTransform.md) t)       |
| [`AffineTransform`](itextsharp/awt/geom/AffineTransform.md) | [`CreateInverse`](https://kb.itextpdf.com/it5kb/affinetransform.md#createinverse) ()                                                                 |
| [`Point2D`](./Point2D.md)                                   | [`DeltaTransform`](https://kb.itextpdf.com/it5kb/affinetransform.md#deltatransform-12) (`...`)                                                       |
| `double`                                                    | [`GetDeterminant`](https://kb.itextpdf.com/it5kb/affinetransform.md#getdeterminant) ()                                                               |
| `void`                                                      | [`GetMatrix`](https://kb.itextpdf.com/it5kb/affinetransform.md#getmatrix) (```double``[]``` matrix)                                                  |
| `double`                                                    | [`GetScaleX`](https://kb.itextpdf.com/it5kb/affinetransform.md#getscalex) ()                                                                         |
| `double`                                                    | [`GetScaleY`](https://kb.itextpdf.com/it5kb/affinetransform.md#getscaley) ()                                                                         |
| `double`                                                    | [`GetShearX`](https://kb.itextpdf.com/it5kb/affinetransform.md#getshearx) ()                                                                         |
| `double`                                                    | [`GetShearY`](https://kb.itextpdf.com/it5kb/affinetransform.md#getsheary) ()                                                                         |
| `double`                                                    | [`GetTranslateX`](https://kb.itextpdf.com/it5kb/affinetransform.md#gettranslatex) ()                                                                 |
| `double`                                                    | [`GetTranslateY`](https://kb.itextpdf.com/it5kb/affinetransform.md#gettranslatey) ()                                                                 |
| [`Point2D`](./Point2D.md)                                   | [`InverseTransform`](https://kb.itextpdf.com/it5kb/affinetransform.md#inversetransform-13) (`...`)                                                   |
| `bool`                                                      | [`IsIdentity`](https://kb.itextpdf.com/it5kb/affinetransform.md#isidentity) ()                                                                       |
| `void`                                                      | [`Rotate`](https://kb.itextpdf.com/it5kb/affinetransform.md#rotate-12) (`...`)                                                                       |
| `void`                                                      | [`Scale`](https://kb.itextpdf.com/it5kb/affinetransform.md#scale) (`double` scx, `double` scy)                                                       |
| `void`                                                      | [`SetToIdentity`](https://kb.itextpdf.com/it5kb/affinetransform.md#settoidentity) ()                                                                 |
| `void`                                                      | [`SetToRotation`](https://kb.itextpdf.com/it5kb/affinetransform.md#settorotation-12) (`...`)                                                         |
| `void`                                                      | [`SetToScale`](https://kb.itextpdf.com/it5kb/affinetransform.md#settoscale) (`double` scx, `double` scy)                                             |
| `void`                                                      | [`SetToShear`](https://kb.itextpdf.com/it5kb/affinetransform.md#settoshear) (`double` shx, `double` shy)                                             |
| `void`                                                      | [`SetToTranslation`](https://kb.itextpdf.com/it5kb/affinetransform.md#settotranslation) (`double` mx, `double` my)                                   |
| `void`                                                      | [`SetTransform`](https://kb.itextpdf.com/it5kb/affinetransform.md#settransform-12) (`...`)                                                           |
| `void`                                                      | [`Shear`](https://kb.itextpdf.com/it5kb/affinetransform.md#shear) (`double` shx, `double` shy)                                                       |
| `string`                                                    | [`ToString`](https://kb.itextpdf.com/it5kb/affinetransform.md#tostring) ()                                                                           |
| [`Point2D`](./Point2D.md)                                   | [`Transform`](https://kb.itextpdf.com/it5kb/affinetransform.md#transform-16) (`...`)                                                                 |
| `void`                                                      | [`Translate`](https://kb.itextpdf.com/it5kb/affinetransform.md#translate) (`double` mx, `double` my)                                                 |
| `void`                                                      | [`preConcatenate`](https://kb.itextpdf.com/it5kb/affinetransform.md#preconcatenate) ( [`AffineTransform`](itextsharp/awt/geom/AffineTransform.md) t) |

##### Public Static methods

|                           Returns                           |                                                Name                                                 |
|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
| [`AffineTransform`](itextsharp/awt/geom/AffineTransform.md) | [`GetRotateInstance`](https://kb.itextpdf.com/it5kb/affinetransform.md#getrotateinstance-12) (`...`)                       |
| [`AffineTransform`](itextsharp/awt/geom/AffineTransform.md) | [`GetScaleInstance`](https://kb.itextpdf.com/it5kb/affinetransform.md#getscaleinstance) (`double` scx, `double` scY)       |
| [`AffineTransform`](itextsharp/awt/geom/AffineTransform.md) | [`GetShearInstance`](https://kb.itextpdf.com/it5kb/affinetransform.md#getshearinstance) (`double` shx, `double` shy)       |
| [`AffineTransform`](itextsharp/awt/geom/AffineTransform.md) | [`GetTranslateInstance`](https://kb.itextpdf.com/it5kb/affinetransform.md#gettranslateinstance) (`double` mx, `double` my) |

### Details

#### Inheritance

* `ICloneable`

#### Constructors

##### AffineTransform \[1/6\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public AffineTransform()

##### AffineTransform \[2/6\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public AffineTransform(AffineTransform t)

###### Arguments

|                            Type                             | Name | Description |
|-------------------------------------------------------------|------|-------------|
| [`AffineTransform`](itextsharp/awt/geom/AffineTransform.md) | t    |             |

##### AffineTransform \[3/6\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public AffineTransform(float m00, float m10, float m01, float m11, float m02, float m12)

###### Arguments

|  Type   | Name | Description |
|---------|------|-------------|
| `float` | m00  |             |
| `float` | m10  |             |
| `float` | m01  |             |
| `float` | m11  |             |
| `float` | m02  |             |
| `float` | m12  |             |

##### AffineTransform \[4/6\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public AffineTransform(double m00, double m10, double m01, double m11, double m02, double m12)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `double` | m00  |             |
| `double` | m10  |             |
| `double` | m01  |             |
| `double` | m11  |             |
| `double` | m02  |             |
| `double` | m12  |             |

##### AffineTransform \[5/6\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public AffineTransform(float\[\] matrix)

###### Arguments

|      Type       |  Name  | Description |
|-----------------|--------|-------------|
| ```float``[]``` | matrix |             |

##### AffineTransform \[6/6\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public AffineTransform(double\[\] matrix)

###### Arguments

|       Type       |  Name  | Description |
|------------------|--------|-------------|
| ```double``[]``` | matrix |             |

#### Methods

##### GetScaleX

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual double GetScaleX()

##### GetScaleY

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual double GetScaleY()

##### GetShearX

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual double GetShearX()

##### GetShearY

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual double GetShearY()

##### GetTranslateX

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual double GetTranslateX()

##### GetTranslateY

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual double GetTranslateY()

##### IsIdentity

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual bool IsIdentity()

##### GetMatrix

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void GetMatrix(double\[\] matrix)

###### Arguments

|       Type       |  Name  | Description |
|------------------|--------|-------------|
| ```double``[]``` | matrix |             |

##### GetDeterminant

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual double GetDeterminant()

##### SetTransform \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void SetTransform(double m00, double m10, double m01, double m11, double m02, double m12)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `double` | m00  |             |
| `double` | m10  |             |
| `double` | m01  |             |
| `double` | m11  |             |
| `double` | m02  |             |
| `double` | m12  |             |

##### SetTransform \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void SetTransform(AffineTransform t)

###### Arguments

|                            Type                             | Name | Description |
|-------------------------------------------------------------|------|-------------|
| [`AffineTransform`](itextsharp/awt/geom/AffineTransform.md) | t    |             |

##### SetToIdentity

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void SetToIdentity()

##### SetToTranslation

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void SetToTranslation(double mx, double my)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `double` | mx   |             |
| `double` | my   |             |

##### SetToScale

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void SetToScale(double scx, double scy)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `double` | scx  |             |
| `double` | scy  |             |

##### SetToShear

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void SetToShear(double shx, double shy)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `double` | shx  |             |
| `double` | shy  |             |

##### SetToRotation \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void SetToRotation(double angle)

###### Arguments

|   Type   | Name  | Description |
|----------|-------|-------------|
| `double` | angle |             |

##### SetToRotation \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void SetToRotation(double angle, double px, double py)

###### Arguments

|   Type   | Name  | Description |
|----------|-------|-------------|
| `double` | angle |             |
| `double` | px    |             |
| `double` | py    |             |

##### GetTranslateInstance

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public static AffineTransform GetTranslateInstance(double mx, double my)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `double` | mx   |             |
| `double` | my   |             |

##### GetScaleInstance

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public static AffineTransform GetScaleInstance(double scx, double scY)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `double` | scx  |             |
| `double` | scY  |             |

##### GetShearInstance

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public static AffineTransform GetShearInstance(double shx, double shy)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `double` | shx  |             |
| `double` | shy  |             |

##### GetRotateInstance \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public static AffineTransform GetRotateInstance(double angle)

###### Arguments

|   Type   | Name  | Description |
|----------|-------|-------------|
| `double` | angle |             |

##### GetRotateInstance \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public static AffineTransform GetRotateInstance(double angle, double x, double y)

###### Arguments

|   Type   | Name  | Description |
|----------|-------|-------------|
| `double` | angle |             |
| `double` | x     |             |
| `double` | y     |             |

##### Translate

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void Translate(double mx, double my)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `double` | mx   |             |
| `double` | my   |             |

##### Scale

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void Scale(double scx, double scy)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `double` | scx  |             |
| `double` | scy  |             |

##### Shear

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void Shear(double shx, double shy)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `double` | shx  |             |
| `double` | shy  |             |

##### Rotate \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void Rotate(double angle)

###### Arguments

|   Type   | Name  | Description |
|----------|-------|-------------|
| `double` | angle |             |

##### Rotate \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void Rotate(double angle, double px, double py)

###### Arguments

|   Type   | Name  | Description |
|----------|-------|-------------|
| `double` | angle |             |
| `double` | px    |             |
| `double` | py    |             |

##### Concatenate

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void Concatenate(AffineTransform t)

###### Arguments

|                            Type                             | Name | Description |
|-------------------------------------------------------------|------|-------------|
| [`AffineTransform`](itextsharp/awt/geom/AffineTransform.md) | t    |             |

##### preConcatenate

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void preConcatenate(AffineTransform t)

###### Arguments

|                            Type                             | Name | Description |
|-------------------------------------------------------------|------|-------------|
| [`AffineTransform`](itextsharp/awt/geom/AffineTransform.md) | t    |             |

##### CreateInverse

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual AffineTransform CreateInverse()

##### Transform \[1/6\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual Point2D Transform(Point2D src, Point2D dst)

###### Arguments

|           Type            | Name | Description |
|---------------------------|------|-------------|
| [`Point2D`](./Point2D.md) | src  |             |
| [`Point2D`](./Point2D.md) | dst  |             |

##### Transform \[2/6\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void Transform(Point2D\[\] src, int srcOff, Point2D\[\] dst, int dstOff, int length)

###### Arguments

|              Type              |  Name  | Description |
|--------------------------------|--------|-------------|
| [`Point2D`](./Point2D.md) `[]` | src    |             |
| `int`                          | srcOff |             |
| [`Point2D`](./Point2D.md) `[]` | dst    |             |
| `int`                          | dstOff |             |
| `int`                          | length |             |

##### Transform \[3/6\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void Transform(double\[\] src, int srcOff, double\[\] dst, int dstOff, int length)

###### Arguments

|       Type       |  Name  | Description |
|------------------|--------|-------------|
| ```double``[]``` | src    |             |
| `int`            | srcOff |             |
| ```double``[]``` | dst    |             |
| `int`            | dstOff |             |
| `int`            | length |             |

##### Transform \[4/6\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void Transform(float\[\] src, int srcOff, float\[\] dst, int dstOff, int length)

###### Arguments

|      Type       |  Name  | Description |
|-----------------|--------|-------------|
| ```float``[]``` | src    |             |
| `int`           | srcOff |             |
| ```float``[]``` | dst    |             |
| `int`           | dstOff |             |
| `int`           | length |             |

##### Transform \[5/6\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void Transform(float\[\] src, int srcOff, double\[\] dst, int dstOff, int length)

###### Arguments

|       Type       |  Name  | Description |
|------------------|--------|-------------|
| ```float``[]```  | src    |             |
| `int`            | srcOff |             |
| ```double``[]``` | dst    |             |
| `int`            | dstOff |             |
| `int`            | length |             |

##### Transform \[6/6\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void Transform(double\[\] src, int srcOff, float\[\] dst, int dstOff, int length)

###### Arguments

|       Type       |  Name  | Description |
|------------------|--------|-------------|
| ```double``[]``` | src    |             |
| `int`            | srcOff |             |
| ```float``[]```  | dst    |             |
| `int`            | dstOff |             |
| `int`            | length |             |

##### DeltaTransform \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual Point2D DeltaTransform(Point2D src, Point2D dst)

###### Arguments

|           Type            | Name | Description |
|---------------------------|------|-------------|
| [`Point2D`](./Point2D.md) | src  |             |
| [`Point2D`](./Point2D.md) | dst  |             |

##### DeltaTransform \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void DeltaTransform(double\[\] src, int srcOff, double\[\] dst, int dstOff, int length)

###### Arguments

|       Type       |  Name  | Description |
|------------------|--------|-------------|
| ```double``[]``` | src    |             |
| `int`            | srcOff |             |
| ```double``[]``` | dst    |             |
| `int`            | dstOff |             |
| `int`            | length |             |

##### InverseTransform \[1/3\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual Point2D InverseTransform(Point2D src, Point2D dst)

###### Arguments

|           Type            | Name | Description |
|---------------------------|------|-------------|
| [`Point2D`](./Point2D.md) | src  |             |
| [`Point2D`](./Point2D.md) | dst  |             |

##### InverseTransform \[2/3\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void InverseTransform(double\[\] src, int srcOff, double\[\] dst, int dstOff, int length)

###### Arguments

|       Type       |  Name  | Description |
|------------------|--------|-------------|
| ```double``[]``` | src    |             |
| `int`            | srcOff |             |
| ```double``[]``` | dst    |             |
| `int`            | dstOff |             |
| `int`            | length |             |

##### InverseTransform \[3/3\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual void InverseTransform(float\[\] src, int srcOff, float\[\] dst, int dstOff, int length)

###### Arguments

|      Type       |  Name  | Description |
|-----------------|--------|-------------|
| ```float``[]``` | src    |             |
| `int`           | srcOff |             |
| ```float``[]``` | dst    |             |
| `int`           | dstOff |             |
| `int`           | length |             |

##### Clone

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public virtual object Clone()

##### ToString

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/awt/geom/AffineTransform.cs#L85)  
public override string ToString()

#### Properties

##### Type

public virtual int Type { get; }

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# AliasOptions

## AliasOptions `Public class`

### Description

Options for XMPSchemaRegistryImpl#registerAlias.  
@since 20.02.2006

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.xmp.options iTextSharp.xmp.options.AliasOptions\[\[AliasOptions\]\] iTextSharp.xmp.options.XmpOptions\[\[XmpOptions\]\] class iTextSharp.xmp.options.XmpOptions abstractStyle; end iTextSharp.xmp.options.XmpOptions --\> iTextSharp.xmp.options.AliasOptions

### Members

#### Properties

##### Public properties

|  Type  |                           Name                            |  Methods   |
|--------|-----------------------------------------------------------|------------|
| `bool` | [`Array`](https://kb.itextpdf.com/it5kb/aliasoptions.md#array)                   | `get, set` |
| `bool` | [`ArrayAltText`](https://kb.itextpdf.com/it5kb/aliasoptions.md#arrayalttext)     | `get, set` |
| `bool` | [`ArrayAlternate`](https://kb.itextpdf.com/it5kb/aliasoptions.md#arrayalternate) | `get, set` |
| `bool` | [`ArrayOrdered`](https://kb.itextpdf.com/it5kb/aliasoptions.md#arrayordered)     | `get, set` |
| `bool` | [`Simple`](https://kb.itextpdf.com/it5kb/aliasoptions.md#simple)                 | `get`      |

##### Protected internal properties

|  Type  |                         Name                          | Methods |
|--------|-------------------------------------------------------|---------|
| `uint` | [`ValidOptions`](https://kb.itextpdf.com/it5kb/aliasoptions.md#validoptions) | `get`   |

#### Methods

##### Public methods

|                  Returns                  |                                Name                                |
|-------------------------------------------|--------------------------------------------------------------------|
| [`PropertyOptions`](./PropertyOptions.md) | [`ToPropertyOptions`](https://kb.itextpdf.com/it5kb/aliasoptions.md#topropertyoptions) () |

##### Protected internal methods

| Returns  |                                     Name                                      |
|----------|-------------------------------------------------------------------------------|
| `string` | [`DefineOptionName`](https://kb.itextpdf.com/it5kb/aliasoptions.md#defineoptionname) (`uint` option) |

### Details

#### Summary

Options for XMPSchemaRegistryImpl#registerAlias.  
@since 20.02.2006

#### Inheritance

* [`XmpOptions`](./XmpOptions.md)

#### Constructors

##### AliasOptions \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/xmp/options/AliasOptions.cs#L64)  
public AliasOptions()

##### AliasOptions \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/xmp/options/AliasOptions.cs#L64)  
public AliasOptions(uint options)

###### Arguments

|  Type  |  Name   |       Description        |
|--------|---------|--------------------------|
| `uint` | options | the options to init with |

###### Exceptions

|                Name                |          Description          |
|------------------------------------|-------------------------------|
| [XmpException](../XmpException.md) | If options are not consistant |

#### Methods

##### ToPropertyOptions

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/xmp/options/AliasOptions.cs#L64)  
public PropertyOptions ToPropertyOptions()

###### Returns

returns a s object

###### Exceptions

|                Name                |            Description             |
|------------------------------------|------------------------------------|
| [XmpException](../XmpException.md) | If the options are not consistant. |

##### DefineOptionName

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/xmp/options/AliasOptions.cs#L64)  
protected internal override string DefineOptionName(uint option)

###### Arguments

|  Type  |  Name  | Description |
|--------|--------|-------------|
| `uint` | option |             |

#### Properties

##### Simple

public bool Simple { get; }

##### Array

public bool Array { get; set; }

##### ArrayOrdered

public bool ArrayOrdered { get; set; }

##### ArrayAlternate

public bool ArrayAlternate { get; set; }

##### ArrayAltText

public bool ArrayAltText { get; set; }

##### ValidOptions

protected internal override uint ValidOptions { get; }

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# Alignment

## Alignment `Public enum`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.TabStop iTextSharp.text.TabStop.Alignment\[\[Alignment\]\] end

### Details

#### Fields

##### LEFT

##### RIGHT

##### CENTER

##### ANCHOR

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# Alignment, indentation, leading and spacing in cells - iText 5 Documentation

Examples written in answer to questions such as:

* Click [How to maintain a paragraph's indentation inside a table cell?](https://kb.itextpdf.com/it5kb/how-to-maintain-a-paragraph-s-indentation-inside-a.md)

* Click [How to define spacing and leading in PdfPCell objects?](https://kb.itextpdf.com/it5kb/how-to-define-spacing-and-leading-in-pdfpcell-obje.md)

## simpletable4

Java

    /**
     * Example written by Bruno Lowagie and Nishanthi Grashia in answer to the following question:
     * http://stackoverflow.com/questions/28073190/itext-maintain-identing-if-paragraph-takes-new-line-in-pdfpcell
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class SimpleTable4 {
        public static final String DEST = "results/tables/simple_table4.pdf";

        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new SimpleTable4().createPdf(DEST);
        }
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(1);
            Paragraph wrong = new Paragraph("This is wrong, because an object that was originally a paragraph is reduced to a phrase due to the fact that it's put into a cell that uses text mode.");
            wrong.setIndentationLeft(20);
            PdfPCell wrongCell = new PdfPCell(wrong);
            table.addCell(wrongCell);
            Paragraph right = new Paragraph("This is right, because we create a paragraph with an indentation to the left and as we are adding the paragraph in composite mode, all the properties of the paragraph are preserved.");
            right.setIndentationLeft(20);
            PdfPCell rightCell = new PdfPCell();
            rightCell.addElement(right);
            table.addCell(rightCell);
            document.add(table);
            document.close();
        }

    }

## leadingincell

Java

    /**
     * Example written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/20145742/spacing-leading-pdfpcells-elements
     * 
     * Cell in composite mode, containing different paragraphs with a different leading.
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;

    import sandbox.WrapToTest;

    @WrapToTest
    public class LeadingInCell {

        public static final String DEST = "results/tables/leading_in_cell.pdf";

        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new LeadingInCell().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(1);
            PdfPCell cell = new PdfPCell();
            Paragraph p;
            p = new Paragraph(16, "paragraph 1: leading 16");
            cell.addElement(p);
            p = new Paragraph(32, "paragraph 2: leading 32");
            cell.addElement(p);
            p = new Paragraph(10, "paragraph 3: leading 10");
            cell.addElement(p);
            p = new Paragraph(18, "paragraph 4: leading 18");
            cell.addElement(p);
            p = new Paragraph(40, "paragraph 5: leading 40");
            cell.addElement(p);
            table.addCell(cell);
            document.add(table);
            document.close();
        }
    }

## centeredtextincell

Java

    /**
     * Example written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/19703715/centered-text-in-itext-pdf-table-cell
     * 
     * We create a table with a single column and a single cell.
     * We add some content that needs to be centered vertically.
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Element;
    import com.itextpdf.text.Font;
    import com.itextpdf.text.Font.FontFamily;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;

    import sandbox.WrapToTest;

    @WrapToTest
    public class CenteredTextInCell {

        public static final String DEST = "results/tables/centered_text.pdf";
        
        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new CenteredTextInCell().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            Font font = new Font(FontFamily.HELVETICA, 12, Font.BOLD);
            Paragraph para = new Paragraph("Test", font);
            para.setLeading(0, 1);
            PdfPTable table = new PdfPTable(1);
            table.setWidthPercentage(100);
            PdfPCell cell = new PdfPCell();
            cell.setMinimumHeight(50);
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            cell.addElement(para);
            table.addCell(cell);
            document.add(table);
            document.close();
        }
    }

## indenttable

Java

    /**
     * Example written by Bruno Lowagie in answer to a question by a customer.
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Element;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.pdf.PdfContentByte;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class IndentTable {
        public static final String DEST = "results/tables/indented_table.pdf";

        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new IndentTable().createPdf(DEST);
        }
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfContentByte cb = writer.getDirectContent();
            cb.moveTo(36, 842);
            cb.lineTo(36, 0);
            cb.stroke();
            PdfPTable table = new PdfPTable(8);
            table.setHorizontalAlignment(Element.ALIGN_LEFT);
            table.setTotalWidth(150);
            table.setLockedWidth(true);
            for(int aw = 0; aw < 16; aw++){
                table.addCell("hi");
            }
            Paragraph p = new Paragraph();
            p.setIndentationLeft(36);
            p.add(table);
            document.add(p);
            document.close();
        }

    }

## indentationincell

Java

    /**
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/27873550/how-to-indent-text-inside-a-pdfpcell
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Element;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.pdf.PdfPCell;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class IndentationInCell {
        public static final String DEST = "results/tables/indentation_in_cell.pdf";

        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new IndentationInCell().createPdf(DEST);
        }
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(1);
            PdfPCell cell;
            cell = new PdfPCell(new Phrase("TO:\n\n   name"));
            table.addCell(cell);
            cell = new PdfPCell(new Phrase("TO:\n\n\u00a0\u00a0\u00a0name"));
            table.addCell(cell);
            cell = new PdfPCell();
            cell.addElement(new Paragraph("TO:"));
            Paragraph p = new Paragraph("name");
            p.setIndentationLeft(10);
            cell.addElement(p);
            table.addCell(cell);
            cell = new PdfPCell();
            cell.addElement(new Paragraph("TO:"));
            p = new Paragraph("name");
            p.setAlignment(Element.ALIGN_RIGHT);
            cell.addElement(p);
            table.addCell(cell);
            document.add(table);
            document.close();
        }

    }

## tablewithtab

Java

    /**
     * This example is written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/32593183/itextsharp-is-it-possible-to-set-a-different-alignment-in-the-same-cell-for-te
     */
    package sandbox.tables;

    import com.itextpdf.text.Chunk;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Phrase;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;
    import com.itextpdf.text.pdf.draw.VerticalPositionMark;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    /**
     * @author iText
     */
    @WrapToTest
    public class TableWithTab {
        public static final String DEST = "results/tables/table_with_tab.pdf";
        
        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new TableWithTab().createPdf(DEST);
        }
        
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            Chunk glue = new Chunk(new VerticalPositionMark());
            PdfPTable table = new PdfPTable(1);
            Phrase p = new Phrase();
            p.add("Left");
            p.add(glue);
            p.add("Right");
            table.addCell(p);
            document.add(table);
            document.close();
        }
        
    }

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_simple_table4.pdfcmp_simple_table4.pdf><https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_leading_in_cell.pdfcmp_leading_in_cell.pdf><https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_centered_text.pdfcmp_centered_text.pdf><https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_indented_table.pdfcmp_indented_table.pdf><https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_indentation_in_cell.pdfcmp_indentation_in_cell.pdf><https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_table_with_tab.pdfcmp_table_with_tab.pdf>

---
language: "en"
---
# Alternatives to using a PdfPTable - iText 5 Documentation

Examples written in answer to the question Click [How to format a String resulting in a two-column display?](https://kb.itextpdf.com/it5kb/how-to-format-a-string-resulting-in-a-two-column-d.md)

## simpletable13

Java

    /**
     * Example written by Bruno Lowagie in answer to the following question:
     * http://stackoverflow.com/questions/34480476
     */
    package sandbox.tables;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Element;
    import com.itextpdf.text.Rectangle;
    import com.itextpdf.text.pdf.PdfPTable;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import sandbox.WrapToTest;

    @WrapToTest
    public class SimpleTable13 {
        public static final String DEST = "results/tables/simple_table13.pdf";
        public static final String[][] DATA = {
            {"John Edward Jr.", "AAA"},
            {"Pascal Einstein W. Alfi", "BBB"},
            {"St. John", "CCC"}
        };

        public static void main(String[] args) throws IOException,
                DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new SimpleTable13().createPdf(DEST);
        }
        public void createPdf(String dest) throws IOException, DocumentException {
            Document document = new Document();
            PdfWriter.getInstance(document, new FileOutputStream(dest));
            document.open();
            PdfPTable table = new PdfPTable(2);
            table.setWidthPercentage(50);
            table.setHorizontalAlignment(Element.ALIGN_LEFT);
            table.setWidths(new int[]{5, 1});
            table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
            table.addCell("Name: " + DATA[0][0]);
            table.addCell(DATA[0][1]);
            table.addCell("Surname: " + DATA[1][0]);
            table.addCell(DATA[1][1]);
            table.addCell("School: " + DATA[2][0]);
            table.addCell(DATA[1][1]);
            document.add(table);
            document.close();
        }
    }

## tabletab

Java

    /**
     * Example written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/34480476
     */
    package sandbox.objects;

    import com.itextpdf.text.Chunk;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.TabSettings;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;

    import sandbox.WrapToTest;

    @WrapToTest
    public class TableTab {

        public static final String DEST = "results/objects/tab_table.pdf";
        public static final String[][] DATA = {
            {"John Edward Jr.", "AAA"},
            {"Pascal Einstein W. Alfi", "BBB"},
            {"St. John", "CCC"}
        };

        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new TableTab().createPdf(DEST);
        }

        public void createPdf(String dest) throws FileNotFoundException, DocumentException {
            Document document = new Document();

            PdfWriter.getInstance(document, new FileOutputStream(dest));

            document.open();

            document.add(createParagraphWithTab("Name: ", DATA[0][0], DATA[0][1]));
            document.add(createParagraphWithTab("Surname: ", DATA[1][0], DATA[1][1]));
            document.add(createParagraphWithTab("School: ", DATA[2][0], DATA[2][1]));

            document.close();
        }

        public Paragraph createParagraphWithTab(String key, String value1, String value2) {
            Paragraph p = new Paragraph();
            p.setTabSettings(new TabSettings(200f));
            p.add(key);
            p.add(value1);
            p.add(Chunk.TABBING);
            p.add(value2);
            return p;
        }
    }

## tablespace

Java

    /**
     * Example written by Bruno Lowagie in answer to:
     * http://stackoverflow.com/questions/34480476
     */
    package sandbox.objects;

    import com.itextpdf.text.Document;
    import com.itextpdf.text.DocumentException;
    import com.itextpdf.text.Font;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.pdf.BaseFont;
    import com.itextpdf.text.pdf.PdfWriter;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;

    import sandbox.WrapToTest;

    @WrapToTest
    public class TableSpace {

        public static final String DEST = "results/objects/spaces_table.pdf";
        public static final String FONT = "resources/fonts/PTM55FT.ttf";
        public static final String[][] DATA = {
            {"John Edward Jr.", "AAA"},
            {"Pascal Einstein W. Alfi", "BBB"},
            {"St. John", "CCC"}
        };

        public static void main(String[] args) throws IOException, DocumentException {
            File file = new File(DEST);
            file.getParentFile().mkdirs();
            new TableSpace().createPdf(DEST);
        }

        public void createPdf(String dest) throws DocumentException, IOException {
            Document document = new Document();

            PdfWriter.getInstance(document, new FileOutputStream(dest));

            document.open();

            BaseFont bf = BaseFont.createFont(FONT, BaseFont.CP1250, BaseFont.EMBEDDED);
            Font font = new Font(bf, 12);
            
            document.add(createParagraphWithSpaces(font, String.format("%s: %s", "Name", DATA[0][0]), DATA[0][1]));
            document.add(createParagraphWithSpaces(font, String.format("%s: %s", "Surname", DATA[1][0]), DATA[1][1]));
            document.add(createParagraphWithSpaces(font, String.format("%s: %s", "School", DATA[2][0]), DATA[2][1]));

            document.close();
        }

        public Paragraph createParagraphWithSpaces(Font font, String value1, String value2) {
            Paragraph p = new Paragraph();
            p.setFont(font);
            p.add(String.format("%-35s", value1));
            p.add(value2);
            return p;
        }
    }

## Resources

<https://github.com/itext/i5js-sandbox/blob/master/resources/fonts/PTM55FT.ttf>

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/tables/cmp_simple_table13.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/objects/cmp_tab_table.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/objects/cmp_spaces_table.pdf>

---
language: "en"
---
# Anchor

## Anchor `Public class`

### Description

An Anchor can be a reference or a destination of a reference.

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text iTextSharp.text.Anchor\[\[Anchor\]\] iTextSharp.text.Phrase\[\[Phrase\]\] end iTextSharp.text.Phrase --\> iTextSharp.text.Anchor

### Members

#### Properties

##### Public properties

|                Type                |                                   Name                                   |  Methods   |
|------------------------------------|--------------------------------------------------------------------------|------------|
| `IList`\< [`Chunk`](./Chunk.md) \> | [`Chunks`](https://kb.itextpdf.com/it5kb/anchor.md#chunks) Gets all the chunks in this element. | `get`      |
| `string`                           | [`Name`](https://kb.itextpdf.com/it5kb/anchor.md#name) Name of this Anchor.                     | `get, set` |
| `string`                           | [`Reference`](https://kb.itextpdf.com/it5kb/anchor.md#reference) reference of this Anchor.      | `get, set` |
| `int`                              | [`Type`](https://kb.itextpdf.com/it5kb/anchor.md#type) Gets the type of the text element.       | `get`      |
| `Uri`                              | [`Url`](https://kb.itextpdf.com/it5kb/anchor.md#url) reference of this Anchor.                  | `get`      |

#### Methods

##### Public methods

| Returns |                                                                                                   Name                                                                                                    |
|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `bool`  | [`Process`](https://kb.itextpdf.com/it5kb/anchor.md#process) ( [`IElementListener`](./IElementListener.md) listener) Processes the element by adding it (or the different parts) to an [IElementListener](./IElementListener.md) |

##### Protected methods

| Returns |                                                          Name                                                           |
|---------|-------------------------------------------------------------------------------------------------------------------------|
| `bool`  | [`ApplyAnchor`](https://kb.itextpdf.com/it5kb/anchor.md#applyanchor) ( [`Chunk`](./Chunk.md) chunk, `bool` notGotoOK, `bool` localDestination) |

### Details

#### Summary

An Anchor can be a reference or a destination of a reference.

#### Remarks

An Anchor is a special kind of [Phrase](./Phrase.md) . It is constructed in the same way.

#### Inheritance

* [`Phrase`](./Phrase.md)

#### Constructors

##### Anchor \[1/9\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Anchor.cs#L69)  
public Anchor()

###### Summary

Constructs an Anchor without specifying a leading.

##### Anchor \[2/9\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Anchor.cs#L69)  
public Anchor(float leading)

###### Arguments

|  Type   |  Name   | Description |
|---------|---------|-------------|
| `float` | leading | the leading |

###### Summary

Constructs an Anchor with a certain leading.

##### Anchor \[3/9\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Anchor.cs#L69)  
public Anchor(Chunk chunk)

###### Arguments

|         Type          | Name  | Description |
|-----------------------|-------|-------------|
| [`Chunk`](./Chunk.md) | chunk | a Chunk     |

###### Summary

Constructs an Anchor with a certain Chunk.

##### Anchor \[4/9\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Anchor.cs#L69)  
public Anchor(string str)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | str  | a string    |

###### Summary

Constructs an Anchor with a certain string.

##### Anchor \[5/9\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Anchor.cs#L69)  
public Anchor(string str, Font font)

###### Arguments

|        Type         | Name | Description |
|---------------------|------|-------------|
| `string`            | str  | a string    |
| [`Font`](./Font.md) | font | a Font      |

###### Summary

Constructs an Anchor with a certain string and a certain Font.

##### Anchor \[6/9\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Anchor.cs#L69)  
public Anchor(float leading, Chunk chunk)

###### Arguments

|         Type          |  Name   | Description |
|-----------------------|---------|-------------|
| `float`               | leading | the leading |
| [`Chunk`](./Chunk.md) | chunk   | a Chunk     |

###### Summary

Constructs an Anchor with a certain Chunk and a certain leading.

##### Anchor \[7/9\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Anchor.cs#L69)  
public Anchor(float leading, string str)

###### Arguments

|   Type   |  Name   | Description |
|----------|---------|-------------|
| `float`  | leading | the leading |
| `string` | str     | a string    |

###### Summary

Constructs an Anchor with a certain leading and a certain string.

##### Anchor \[8/9\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Anchor.cs#L69)  
public Anchor(float leading, string str, Font font)

###### Arguments

|        Type         |  Name   | Description |
|---------------------|---------|-------------|
| `float`             | leading | the leading |
| `string`            | str     | a string    |
| [`Font`](./Font.md) | font    | a Font      |

###### Summary

Constructs an Anchor with a certain leading, a certain string and a certain Font.

##### Anchor \[9/9\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Anchor.cs#L69)  
public Anchor(Phrase phrase)

###### Arguments

|          Type           |  Name  | Description |
|-------------------------|--------|-------------|
| [`Phrase`](./Phrase.md) | phrase |             |

#### Methods

##### Process

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Anchor.cs#L69)  
public override bool Process(IElementListener listener)

###### Arguments

|                    Type                     |   Name   |     Description     |
|---------------------------------------------|----------|---------------------|
| [`IElementListener`](./IElementListener.md) | listener | an IElementListener |

###### Summary

Processes the element by adding it (or the different parts) to an [IElementListener](./IElementListener.md)

###### Returns

true if the element was processed successfully

##### ApplyAnchor

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Anchor.cs#L69)  
protected virtual bool ApplyAnchor(Chunk chunk, bool notGotoOK, bool localDestination)

###### Arguments

|         Type          |       Name       | Description |
|-----------------------|------------------|-------------|
| [`Chunk`](./Chunk.md) | chunk            |             |
| `bool`                | notGotoOK        |             |
| `bool`                | localDestination |             |

#### Properties

##### Chunks

public override IList\<Chunk\> Chunks { get; }

###### Summary

Gets all the chunks in this element.

###### Value

an ArrayList

##### Type

public override int Type { get; }

###### Summary

Gets the type of the text element.

###### Value

a type

##### Name

public virtual string Name { get; set; }

###### Summary

Name of this Anchor.

##### Reference

public virtual string Reference { get; set; }

###### Summary

reference of this Anchor.

##### Url

public virtual Uri Url { get; }

###### Summary

reference of this Anchor.

###### Value

an Uri

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# Annotation

## Annotation `Public class`

### Description

An Annotation is a little note that can be added to a page on a document.

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text iTextSharp.text.Annotation\[\[Annotation\]\] iTextSharp.text.IElement\[\[IElement\]\] class iTextSharp.text.IElement interfaceStyle; end iTextSharp.text.IElement --\> iTextSharp.text.Annotation

### Members

#### Properties

##### Public properties

|                Type                |                                             Name                                             | Methods |
|------------------------------------|----------------------------------------------------------------------------------------------|---------|
| `int`                              | [`AnnotationType`](https://kb.itextpdf.com/it5kb/annotation.md#annotationtype) Returns the type of this Annotation. | `get`   |
| `Dictionary`\<`string`, `object`\> | [`Attributes`](https://kb.itextpdf.com/it5kb/annotation.md#attributes) Gets the content of this Annotation.         | `get`   |
| `IList`\< [`Chunk`](./Chunk.md) \> | [`Chunks`](https://kb.itextpdf.com/it5kb/annotation.md#chunks) Gets all the chunks in this element.                 | `get`   |
| `string`                           | [`Content`](https://kb.itextpdf.com/it5kb/annotation.md#content) Gets the content of this Annotation.               | `get`   |
| `string`                           | [`Title`](https://kb.itextpdf.com/it5kb/annotation.md#title) Returns the title of this Annotation.                  | `get`   |
| `int`                              | [`Type`](https://kb.itextpdf.com/it5kb/annotation.md#type) Gets the type of the text element                        | `get`   |

#### Methods

##### Public methods

| Returns  |                                                                                         Name                                                                                          |
|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `float`  | [`GetLlx`](https://kb.itextpdf.com/it5kb/annotation.md#getllx-12) (`...`) Returns the lower left x-value.                                                                                                    |
| `float`  | [`GetLly`](https://kb.itextpdf.com/it5kb/annotation.md#getlly-12) (`...`) Returns the lower left y-value.                                                                                                    |
| `float`  | [`GetUrx`](https://kb.itextpdf.com/it5kb/annotation.md#geturx-12) (`...`) Returns the uppper right x-value.                                                                                                  |
| `float`  | [`GetUry`](https://kb.itextpdf.com/it5kb/annotation.md#getury-12) (`...`) Returns the uppper right y-value.                                                                                                  |
| `bool`   | [`IsContent`](https://kb.itextpdf.com/it5kb/annotation.md#iscontent) ()                                                                                                                                      |
| `bool`   | [`IsNestable`](https://kb.itextpdf.com/it5kb/annotation.md#isnestable) ()                                                                                                                                    |
| `bool`   | [`Process`](https://kb.itextpdf.com/it5kb/annotation.md#process) ( [`IElementListener`](./IElementListener.md) listener) Processes the element by adding it (or the different parts) to an IElementListener. |
| `void`   | [`SetDimensions`](https://kb.itextpdf.com/it5kb/annotation.md#setdimensions) (`float` llx, `float` lly, `float` urx, `float` ury) Sets the dimensions of this annotation.                                    |
| `string` | [`ToString`](https://kb.itextpdf.com/it5kb/annotation.md#tostring) ()                                                                                                                                        |

### Details

#### Summary

An Annotation is a little note that can be added to a page on a document.

#### Inheritance

* [`IElement`](./IElement.md)

#### Constructors

##### Annotation \[1/10\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public Annotation(Annotation an)

###### Arguments

|                     Type                      | Name | Description |
|-----------------------------------------------|------|-------------|
| [`Annotation`](itextsharp/text/Annotation.md) | an   |             |

##### Annotation \[2/10\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public Annotation(string title, string text)

###### Arguments

|   Type   | Name  |          Description          |
|----------|-------|-------------------------------|
| `string` | title | the title of the annotation   |
| `string` | text  | the content of the annotation |

###### Summary

Constructs an Annotation with a certain title and some text.

##### Annotation \[3/10\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public Annotation(string title, string text, float llx, float lly, float urx, float ury)

###### Arguments

|   Type   | Name  |          Description          |
|----------|-------|-------------------------------|
| `string` | title | the title of the annotation   |
| `string` | text  | the content of the annotation |
| `float`  | llx   | the lower left x-value        |
| `float`  | lly   | the lower left y-value        |
| `float`  | urx   | the upper right x-value       |
| `float`  | ury   | the upper right y-value       |

###### Summary

Constructs an Annotation with a certain title and some text.

##### Annotation \[4/10\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public Annotation(float llx, float lly, float urx, float ury, Uri url)

###### Arguments

|  Type   | Name |       Description       |
|---------|------|-------------------------|
| `float` | llx  | the lower left x-value  |
| `float` | lly  | the lower left y-value  |
| `float` | urx  | the upper right x-value |
| `float` | ury  | the upper right y-value |
| `Uri`   | url  | the external reference  |

###### Summary

Constructs an Annotation.

##### Annotation \[5/10\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public Annotation(float llx, float lly, float urx, float ury, string url)

###### Arguments

|   Type   | Name |       Description       |
|----------|------|-------------------------|
| `float`  | llx  | the lower left x-value  |
| `float`  | lly  | the lower left y-value  |
| `float`  | urx  | the upper right x-value |
| `float`  | ury  | the upper right y-value |
| `string` | url  | the external reference  |

###### Summary

Constructs an Annotation.

##### Annotation \[6/10\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public Annotation(float llx, float lly, float urx, float ury, string file, string dest)

###### Arguments

|   Type   | Name |         Description          |
|----------|------|------------------------------|
| `float`  | llx  | the lower left x-value       |
| `float`  | lly  | the lower left y-value       |
| `float`  | urx  | the upper right x-value      |
| `float`  | ury  | the upper right y-value      |
| `string` | file | an external PDF file         |
| `string` | dest | the destination in this file |

###### Summary

Constructs an Annotation.

##### Annotation \[7/10\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public Annotation(float llx, float lly, float urx, float ury, string moviePath, string mimeType, bool showOnDisplay)

###### Arguments

|   Type   |     Name      |             Description             |
|----------|---------------|-------------------------------------|
| `float`  | llx           | the lower left x-value              |
| `float`  | lly           | the lower left y-value              |
| `float`  | urx           | the upper right x-value             |
| `float`  | ury           | the upper right y-value             |
| `string` | moviePath     | path to the media clip file         |
| `string` | mimeType      | mime type of the media              |
| `bool`   | showOnDisplay | if true play on display of the page |

###### Summary

Creates a Screen anotation to embed media clips

##### Annotation \[8/10\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public Annotation(float llx, float lly, float urx, float ury, string file, int page)

###### Arguments

|   Type   | Name |        Description         |
|----------|------|----------------------------|
| `float`  | llx  | the lower left x-value     |
| `float`  | lly  | the lower left y-value     |
| `float`  | urx  | the upper right x-value    |
| `float`  | ury  | the upper right y-value    |
| `string` | file | an external PDF file       |
| `int`    | page | a page number in this file |

###### Summary

Constructs an Annotation.

##### Annotation \[9/10\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public Annotation(float llx, float lly, float urx, float ury, int named)

###### Arguments

|  Type   | Name  |           Description            |
|---------|-------|----------------------------------|
| `float` | llx   | the lower left x-value           |
| `float` | lly   | the lower left y-value           |
| `float` | urx   | the upper right x-value          |
| `float` | ury   | the upper right y-value          |
| `int`   | named | a named destination in this file |

###### Summary

Constructs an Annotation.

##### Annotation \[10/10\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public Annotation(float llx, float lly, float urx, float ury, string application, string parameters, string operation, string defaultdir)

###### Arguments

|   Type   |    Name     |                   Description                    |
|----------|-------------|--------------------------------------------------|
| `float`  | llx         | the lower left x-value                           |
| `float`  | lly         | the lower left y-value                           |
| `float`  | urx         | the upper right x-value                          |
| `float`  | ury         | the upper right y-value                          |
| `string` | application | an external application                          |
| `string` | parameters  | parameters to pass to this application           |
| `string` | operation   | the operation to pass to this application        |
| `string` | defaultdir  | the default directory to run this application in |

###### Summary

Constructs an Annotation.

#### Methods

##### Process

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public virtual bool Process(IElementListener listener)

###### Arguments

|                    Type                     |   Name   |     Description     |
|---------------------------------------------|----------|---------------------|
| [`IElementListener`](./IElementListener.md) | listener | an IElementListener |

###### Summary

Processes the element by adding it (or the different parts) to an IElementListener.

###### Returns

true if the element was process successfully

##### SetDimensions

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public virtual void SetDimensions(float llx, float lly, float urx, float ury)

###### Arguments

|  Type   | Name |       Description       |
|---------|------|-------------------------|
| `float` | llx  | the lower left x-value  |
| `float` | lly  | the lower left y-value  |
| `float` | urx  | the upper right x-value |
| `float` | ury  | the upper right y-value |

###### Summary

Sets the dimensions of this annotation.

##### GetLlx \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public virtual float GetLlx()

###### Summary

Returns the lower left x-value.

###### Returns

a value

##### GetLly \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public virtual float GetLly()

###### Summary

Returns the lower left y-value.

###### Returns

a value

##### GetUrx \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public virtual float GetUrx()

###### Summary

Returns the uppper right x-value.

###### Returns

a value

##### GetUry \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public virtual float GetUry()

###### Summary

Returns the uppper right y-value.

###### Returns

a value

##### GetLlx \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public virtual float GetLlx(float def)

###### Arguments

|  Type   | Name |    Description    |
|---------|------|-------------------|
| `float` | def  | the default value |

###### Summary

Returns the lower left x-value.

###### Returns

a value

##### GetLly \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public virtual float GetLly(float def)

###### Arguments

|  Type   | Name |    Description    |
|---------|------|-------------------|
| `float` | def  | the default value |

###### Summary

Returns the lower left y-value.

###### Returns

a value

##### GetUrx \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public virtual float GetUrx(float def)

###### Arguments

|  Type   | Name |    Description    |
|---------|------|-------------------|
| `float` | def  | the default value |

###### Summary

Returns the upper right x-value.

###### Returns

a value

##### GetUry \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public virtual float GetUry(float def)

###### Arguments

|  Type   | Name |    Description    |
|---------|------|-------------------|
| `float` | def  | the default value |

###### Summary

Returns the upper right y-value.

###### Returns

a value

##### IsContent

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public virtual bool IsContent()

##### IsNestable

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public virtual bool IsNestable()

##### ToString

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/Annotation.cs#L113)  
public override string ToString()

#### Properties

##### Type

public virtual int Type { get; }

###### Summary

Gets the type of the text element

##### Chunks

public virtual IList\<Chunk\> Chunks { get; }

###### Summary

Gets all the chunks in this element.

###### Value

an ArrayList

##### AnnotationType

public virtual int AnnotationType { get; }

###### Summary

Returns the type of this Annotation.

###### Value

a type

##### Title

public virtual string Title { get; }

###### Summary

Returns the title of this Annotation.

###### Value

a name

##### Content

public virtual string Content { get; }

###### Summary

Gets the content of this Annotation.

###### Value

a reference

##### Attributes

public virtual Dictionary\<string, object\> Attributes { get; }

###### Summary

Gets the content of this Annotation.

###### Value

a reference

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# api

---
language: "en"
---
# API Documentation

---
language: "en"
---
# ArabicLigaturizer

## ArabicLigaturizer `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf iTextSharp.text.pdf.ArabicLigaturizer\[\[ArabicLigaturizer\]\] end

### Members

#### Methods

##### Internal Static methods

| Returns |                                                                                           Name                                                                                            |
|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int`   | [`Arabic_shape`](https://kb.itextpdf.com/it5kb/arabicligaturizer.md#arabicshape) (```char``[]``` src, `int` srcoffset, `int` srclength, ```char``[]``` dest, `int` destoffset, `int` destlength, `int` level)    |
| `void`  | [`Doublelig`](https://kb.itextpdf.com/it5kb/arabicligaturizer.md#doublelig) (`StringBuilder` str, `int` level)                                                                                                   |
| `void`  | [`ProcessNumbers`](https://kb.itextpdf.com/it5kb/arabicligaturizer.md#processnumbers) (```char``[]``` text, `int` offset, `int` length, `int` options)                                                           |
| `void`  | [`Shape`](https://kb.itextpdf.com/it5kb/arabicligaturizer.md#shape) (```char``[]``` text, `StringBuilder` str, `int` level)                                                                                      |
| `void`  | [`ShapeToArabicDigitsWithContext`](https://kb.itextpdf.com/it5kb/arabicligaturizer.md#shapetoarabicdigitswithcontext) (```char``[]``` dest, `int` start, `int` length, `char` digitBase, `bool` lastStrongWasAL) |

##### Public Static methods

| Returns |                                                   Name                                                    |
|---------|-----------------------------------------------------------------------------------------------------------|
| `bool`  | [`TryGetReverseMapping`](https://kb.itextpdf.com/it5kb/arabicligaturizer.md#trygetreversemapping) (`char` key, out `char` value) |

##### Public methods

| Returns  |                             Name                              |
|----------|---------------------------------------------------------------|
| `bool`   | [`IsRTL`](https://kb.itextpdf.com/it5kb/arabicligaturizer.md#isrtl) ()               |
| `string` | [`Process`](https://kb.itextpdf.com/it5kb/arabicligaturizer.md#process) (`string` s) |

### Details

#### Constructors

##### ArabicLigaturizer \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/languages/ArabicLigaturizer.cs#L65)  
public ArabicLigaturizer()

##### ArabicLigaturizer \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/languages/ArabicLigaturizer.cs#L65)  
public ArabicLigaturizer(int runDirection, int options)

###### Arguments

| Type  |     Name     | Description |
|-------|--------------|-------------|
| `int` | runDirection |             |
| `int` | options      |             |

#### Methods

##### Doublelig

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/languages/ArabicLigaturizer.cs#L65)  
internal static void Doublelig(StringBuilder str, int level)

###### Arguments

|      Type       | Name  | Description |
|-----------------|-------|-------------|
| `StringBuilder` | str   |             |
| `int`           | level |             |

##### Shape

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/languages/ArabicLigaturizer.cs#L65)  
internal static void Shape(char\[\] text, StringBuilder str, int level)

###### Arguments

|      Type       | Name  | Description |
|-----------------|-------|-------------|
| ```char``[]```  | text  |             |
| `StringBuilder` | str   |             |
| `int`           | level |             |

##### Arabic_shape

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/languages/ArabicLigaturizer.cs#L65)  
internal static int Arabic_shape(char\[\] src, int srcoffset, int srclength, char\[\] dest, int destoffset, int destlength, int level)

###### Arguments

|      Type      |    Name    | Description |
|----------------|------------|-------------|
| ```char``[]``` | src        |             |
| `int`          | srcoffset  |             |
| `int`          | srclength  |             |
| ```char``[]``` | dest       |             |
| `int`          | destoffset |             |
| `int`          | destlength |             |
| `int`          | level      |             |

##### ProcessNumbers

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/languages/ArabicLigaturizer.cs#L65)  
internal static void ProcessNumbers(char\[\] text, int offset, int length, int options)

###### Arguments

|      Type      |  Name   | Description |
|----------------|---------|-------------|
| ```char``[]``` | text    |             |
| `int`          | offset  |             |
| `int`          | length  |             |
| `int`          | options |             |

##### ShapeToArabicDigitsWithContext

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/languages/ArabicLigaturizer.cs#L65)  
internal static void ShapeToArabicDigitsWithContext(char\[\] dest, int start, int length, char digitBase, bool lastStrongWasAL)

###### Arguments

|      Type      |      Name       | Description |
|----------------|-----------------|-------------|
| ```char``[]``` | dest            |             |
| `int`          | start           |             |
| `int`          | length          |             |
| `char`         | digitBase       |             |
| `bool`         | lastStrongWasAL |             |

##### TryGetReverseMapping

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/languages/ArabicLigaturizer.cs#L65)  
public static bool TryGetReverseMapping(char key, out char value)

###### Arguments

|     Type     | Name  | Description |
|--------------|-------|-------------|
| `char`       | key   |             |
| `out` `char` | value |             |

##### Process

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/languages/ArabicLigaturizer.cs#L65)  
public virtual string Process(string s)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | s    |             |

##### IsRTL

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/languages/ArabicLigaturizer.cs#L65)  
public virtual bool IsRTL()

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# ARCFOUREncryption

## ARCFOUREncryption `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf.crypto iTextSharp.text.pdf.crypto.ARCFOUREncryption\[\[ARCFOUREncryption\]\] end

### Members

#### Methods

##### Public methods

| Returns |                                      Name                                       |
|---------|---------------------------------------------------------------------------------|
| `void`  | [`EncryptARCFOUR`](https://kb.itextpdf.com/it5kb/arcfourencryption.md#encryptarcfour-14) (`...`)       |
| `void`  | [`PrepareARCFOURKey`](https://kb.itextpdf.com/it5kb/arcfourencryption.md#preparearcfourkey-12) (`...`) |

### Details

#### Constructors

##### ARCFOUREncryption

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/crypto/ARCFOUREncryption.cs#L48)  
public ARCFOUREncryption()

#### Methods

##### PrepareARCFOURKey \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/crypto/ARCFOUREncryption.cs#L48)  
public virtual void PrepareARCFOURKey(byte\[\] key)

###### Arguments

|      Type      | Name | Description |
|----------------|------|-------------|
| ```byte``[]``` | key  |             |

##### PrepareARCFOURKey \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/crypto/ARCFOUREncryption.cs#L48)  
public virtual void PrepareARCFOURKey(byte\[\] key, int off, int len)

###### Arguments

|      Type      | Name | Description |
|----------------|------|-------------|
| ```byte``[]``` | key  |             |
| `int`          | off  |             |
| `int`          | len  |             |

##### EncryptARCFOUR \[1/4\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/crypto/ARCFOUREncryption.cs#L48)  
public virtual void EncryptARCFOUR(byte\[\] dataIn, int off, int len, byte\[\] dataOut, int offOut)

###### Arguments

|      Type      |  Name   | Description |
|----------------|---------|-------------|
| ```byte``[]``` | dataIn  |             |
| `int`          | off     |             |
| `int`          | len     |             |
| ```byte``[]``` | dataOut |             |
| `int`          | offOut  |             |

##### EncryptARCFOUR \[2/4\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/crypto/ARCFOUREncryption.cs#L48)  
public virtual void EncryptARCFOUR(byte\[\] data, int off, int len)

###### Arguments

|      Type      | Name | Description |
|----------------|------|-------------|
| ```byte``[]``` | data |             |
| `int`          | off  |             |
| `int`          | len  |             |

##### EncryptARCFOUR \[3/4\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/crypto/ARCFOUREncryption.cs#L48)  
public virtual void EncryptARCFOUR(byte\[\] dataIn, byte\[\] dataOut)

###### Arguments

|      Type      |  Name   | Description |
|----------------|---------|-------------|
| ```byte``[]``` | dataIn  |             |
| ```byte``[]``` | dataOut |             |

##### EncryptARCFOUR \[4/4\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/crypto/ARCFOUREncryption.cs#L48)  
public virtual void EncryptARCFOUR(byte\[\] data)

###### Arguments

|      Type      | Name | Description |
|----------------|------|-------------|
| ```byte``[]``` | data |             |

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# Argument not specified in iTextSharp - iText 5 Documentation

❓  
**I am getting the errors that** `cell.setPadding, cell.setHorizontalAlignment`**,** `cell.setBorder`**all are not member of** ` iTextsharp.Text.pdf.PdfPCell`**.**

As per suggestion by Bruno Lowagie, I am using the following code:
C#

    Dim table As New PdfPTable(3)
    table.setWidthPercentage(100)
    table.addCell(getCell("Text to the left", PdfPCell.ALIGN_LEFT))
    table.addCell(getCell("Text in the middle", PdfPCell.ALIGN_CENTER))
    table.addCell(getCell("Text to the right", PdfPCell.ALIGN_RIGHT))
    document.add(table)

    Public Function getCell(ByVal text As String, ByVal alignment As Integer) As PdfPCell
    Dim cell As New PdfPCell(New Phrase(text))
    cell.setPadding(0)
    cell.setHorizontalAlignment(alignment)
    cell.setBorder(PdfPCell.NO_BORDER)
    Return cell
    End Function

But I am getting the errors that `cell.setPadding`, `cell.setHorizontalAlignment`, `cell.setBorder` all are not member of `iTextsharp.Text.pdf.PdfPCell`. Also `table.setWidthPercentage(100)` shows the error *argument not specified parameter*.

**Posted on StackOverflow on** [**Apr 11, 2015**](https://stackoverflow.com/questions/29575793/how-to-format-paragraph-string-to-show-content-left-right-or-middle-of-pdf-docu)**by** [**Sunil Bhagwat**](https://stackoverflow.com/users/4754977/sunil-bhagwat)

I adapted your example like this:
C#

    Dim table As New PdfPTable(3)
    table.WidthPercentage = 100
    table.AddCell(GetCell("Text to the left", PdfPCell.ALIGN_LEFT))
    table.AddCell(GetCell("Text in the middle", PdfPCell.ALIGN_CENTER))
    table.AddCell(GetCell("Text to the right", PdfPCell.ALIGN_RIGHT))
    document.Add(table)

    Public Function GetCell(ByVal text As String, ByVal alignment As Integer)
        As PdfPCell
        Dim cell As New PdfPCell(New Phrase(text))
        cell.Padding = 0
        cell.HorizontalAlignment = alignment
        cell.Border = PdfPCell.NO_BORDER
        Return cell
    End Function

This is commonly known:

* Methods in Java start with lower case; methods in .NET start with upper case, so when people ask you to use Java code as pseudo code and to convert Java to .NET, you need to change methods such as `add()` and `addCell()` into `Add()` and `AddCell()`.

* Member-variables in Java are changed and consulted using getters and setters; variables in .NET are changed and consulted using methods that look like properties. This means the you need to change lines such as `cell.setBorder(border);` and `border = cell.getBorder();` into `cell.Border = border` and `border = cell.Border`.

iText and iTextSharp are kept in sync, which means that, using the two rules explained above, a developer won't have any problem to convert iText code into iTextSharp code.

---
language: "en"
---
# ArrayRandomAccessSource

## ArrayRandomAccessSource `Internal class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.io iTextSharp.text.io.ArrayRandomAccessSource\[\[ArrayRandomAccessSource\]\] iTextSharp.text.io.IRandomAccessSource\[\[IRandomAccessSource\]\] class iTextSharp.text.io.IRandomAccessSource interfaceStyle; end subgraph System System.IDisposable\[\[IDisposable\]\] end iTextSharp.text.io.IRandomAccessSource --\> iTextSharp.text.io.ArrayRandomAccessSource System.IDisposable --\> iTextSharp.text.io.IRandomAccessSource

### Members

#### Properties

##### Public properties

|  Type  |                         Name                         | Methods |
|--------|------------------------------------------------------|---------|
| `long` | [`Length`](https://kb.itextpdf.com/it5kb/arrayrandomaccesssource.md#length) | `get`   |

#### Methods

##### Public methods

| Returns |                           Name                            |
|---------|-----------------------------------------------------------|
| `void`  | [`Close`](https://kb.itextpdf.com/it5kb/arrayrandomaccesssource.md#close) ()     |
| `void`  | [`Dispose`](https://kb.itextpdf.com/it5kb/arrayrandomaccesssource.md#dispose) () |
| `int`   | [`Get`](https://kb.itextpdf.com/it5kb/arrayrandomaccesssource.md#get-12) (`...`) |

### Details

#### Inheritance

* [`IRandomAccessSource`](./IRandomAccessSource.md)
* `IDisposable`

#### Constructors

##### ArrayRandomAccessSource

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/io/ArrayRandomAccessSource.cs#L53)  
public ArrayRandomAccessSource(byte\[\] array)

###### Arguments

|      Type      | Name  | Description |
|----------------|-------|-------------|
| ```byte``[]``` | array |             |

#### Methods

##### Get \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/io/ArrayRandomAccessSource.cs#L53)  
public virtual int Get(long offset)

###### Arguments

|  Type  |  Name  | Description |
|--------|--------|-------------|
| `long` | offset |             |

##### Get \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/io/ArrayRandomAccessSource.cs#L53)  
public virtual int Get(long offset, byte\[\] bytes, int off, int len)

###### Arguments

|      Type      |  Name  | Description |
|----------------|--------|-------------|
| `long`         | offset |             |
| ```byte``[]``` | bytes  |             |
| `int`          | off    |             |
| `int`          | len    |             |

##### Close

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/io/ArrayRandomAccessSource.cs#L53)  
public virtual void Close()

##### Dispose

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/io/ArrayRandomAccessSource.cs#L53)  
public virtual void Dispose()

#### Properties

##### Length

public virtual long Length { get; }

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# ArtifactType

## ArtifactType `Public enum`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf.PdfArtifact iTextSharp.text.pdf.PdfArtifact.ArtifactType\[\[ArtifactType\]\] end

### Details

#### Fields

##### PAGINATION

##### LAYOUT

##### PAGE

##### BACKGROUND

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# AsymmetricAlgorithmSignature

## AsymmetricAlgorithmSignature `Public class`

### Description

This class allows you to sign with either an RSACryptoServiceProvider/DSACryptoServiceProvider from a X509Certificate2, or from manually created RSACryptoServiceProvider/DSACryptoServiceProvider. Depending on the certificate's CSP, sometimes you will not be able to sign with SHA-256/SHA-512 hash algorithm with RSACryptoServiceProvider taken directly from the certificate. This class allows you to use a workaround in this case and sign with certificate's private key and SHA-256/SHA-512 anyway.  
An example of a workaround for CSP that does not support SHA-256/SHA-512: ...

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf.security iTextSharp.text.pdf.security.AsymmetricAlgorithmSignature\[\[AsymmetricAlgorithmSignature\]\] iTextSharp.text.pdf.security.IExternalSignature\[\[IExternalSignature\]\] class iTextSharp.text.pdf.security.IExternalSignature interfaceStyle; end iTextSharp.text.pdf.security.IExternalSignature --\> iTextSharp.text.pdf.security.AsymmetricAlgorithmSignature

### Members

#### Methods

##### Public methods

|    Returns     |                                             Name                                             |
|----------------|----------------------------------------------------------------------------------------------|
| `string`       | [`GetEncryptionAlgorithm`](https://kb.itextpdf.com/it5kb/asymmetricalgorithmsignature.md#getencryptionalgorithm) () |
| `string`       | [`GetHashAlgorithm`](https://kb.itextpdf.com/it5kb/asymmetricalgorithmsignature.md#gethashalgorithm) ()             |
| ```byte``[]``` | [`Sign`](https://kb.itextpdf.com/it5kb/asymmetricalgorithmsignature.md#sign) (```byte``[]``` message)               |

### Details

#### Summary

This class allows you to sign with either an RSACryptoServiceProvider/DSACryptoServiceProvider from a X509Certificate2, or from manually created RSACryptoServiceProvider/DSACryptoServiceProvider. Depending on the certificate's CSP, sometimes you will not be able to sign with SHA-256/SHA-512 hash algorithm with RSACryptoServiceProvider taken directly from the certificate. This class allows you to use a workaround in this case and sign with certificate's private key and SHA-256/SHA-512 anyway.  
An example of a workaround for CSP that does not support SHA-256/SHA-512:  
if (certificate.PrivateKey is RSACryptoServiceProvider) { RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)certificate.PrivateKey; // Modified by J. Arturo // Workaround for SHA-256 and SHA-512 if (rsa.CspKeyContainerInfo.ProviderName == "Microsoft Strong Cryptographic Provider" \|\| rsa.CspKeyContainerInfo.ProviderName == "Microsoft Enhanced Cryptographic Provider v1.0" \|\| rsa.CspKeyContainerInfo.ProviderName == "Microsoft Base Cryptographic Provider v1.0") { string providerName = "Microsoft Enhanced RSA and AES Cryptographic Provider"; int providerType = 24; Type CspKeyContainerInfo_Type = typeof(CspKeyContainerInfo); FieldInfo CspKeyContainerInfo_m_parameters = CspKeyContainerInfo_Type.GetField("m_parameters", BindingFlags.NonPublic \| BindingFlags.Instance); CspParameters parameters = (CspParameters)CspKeyContainerInfo_m_parameters.GetValue(rsa.CspKeyContainerInfo); var cspparams = new CspParameters(providerType, providerName, rsa.CspKeyContainerInfo.KeyContainerName); cspparams.Flags = parameters.Flags; using (var rsaKey = new RSACryptoServiceProvider(cspparams)) { // use rsaKey now } } else { // Use rsa directly } }

#### Inheritance

* [`IExternalSignature`](./IExternalSignature.md)

#### Constructors

##### AsymmetricAlgorithmSignature \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/security/AsymmetricAlgorithmSignature.cs#L103)  
public AsymmetricAlgorithmSignature(RSACryptoServiceProvider algorithm, string hashAlgorithm)

###### Arguments

|            Type            |     Name      | Description |
|----------------------------|---------------|-------------|
| `RSACryptoServiceProvider` | algorithm     |             |
| `string`                   | hashAlgorithm |             |

##### AsymmetricAlgorithmSignature \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/security/AsymmetricAlgorithmSignature.cs#L103)  
public AsymmetricAlgorithmSignature(DSACryptoServiceProvider algorithm)

###### Arguments

|            Type            |   Name    | Description |
|----------------------------|-----------|-------------|
| `DSACryptoServiceProvider` | algorithm |             |

#### Methods

##### Sign

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/security/AsymmetricAlgorithmSignature.cs#L103)  
public virtual byte Sign(byte\[\] message)

###### Arguments

|      Type      |  Name   | Description |
|----------------|---------|-------------|
| ```byte``[]``` | message |             |

##### GetHashAlgorithm

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/security/AsymmetricAlgorithmSignature.cs#L103)  
public virtual string GetHashAlgorithm()

##### GetEncryptionAlgorithm

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/security/AsymmetricAlgorithmSignature.cs#L103)  
public virtual string GetEncryptionAlgorithm()

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# awt

---
language: "en"
---
# Background images

These images were written in answer to questions such as:

* Click [How to change a background Image into a watermark by altering the opacity? \| iText 5 PDF Development Guide](https://kb.itextpdf.com/it5kb/how-to-change-a-background-image-into-a-watermark-.md)

## backgroundimage

##GITHUB:https://github.com/itext/i7js-examples/blob/develop/src/main/java/com/itextpdf/samples/sandbox/images/BackgroundImage.java##

## backgroundtransparent

##GITHUB:https://github.com/itext/i7js-examples/blob/develop/src/main/java/com/itextpdf/samples/sandbox/images/BackgroundTransparent.java##

## Resources

<https://github.com/itext/i5js-sandbox/blob/master/resources/images/berlin2013.jpg>

## Results

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/images/cmp_background_image.pdf>

<https://github.com/itext/i5js-sandbox/blob/master/cmpfiles/images/cmp_background_transparent.pdf>

---
language: "en"
---
# BadElementException

## BadElementException `Public class`

### Description

Signals an attempt to create an Element that hasn't got the right form.

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text iTextSharp.text.BadElementException\[\[BadElementException\]\] iTextSharp.text.DocumentException\[\[DocumentException\]\] end iTextSharp.text.DocumentException --\> iTextSharp.text.BadElementException

### Details

#### Summary

Signals an attempt to create an Element that hasn't got the right form.

#### Inheritance

* [`DocumentException`](./DocumentException.md)

#### Constructors

##### BadElementException \[1/3\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/BadElementException.cs#L55)  
public BadElementException()

##### BadElementException \[2/3\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/BadElementException.cs#L55)  
public BadElementException(string message)

###### Arguments

|   Type   |  Name   | Description |
|----------|---------|-------------|
| `string` | message |             |

##### BadElementException \[3/3\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/BadElementException.cs#L55)  
protected BadElementException(SerializationInfo info, StreamingContext context)

###### Arguments

|        Type         |  Name   | Description |
|---------------------|---------|-------------|
| `SerializationInfo` | info    |             |
| `StreamingContext`  | context |             |

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# BadPasswordException

## BadPasswordException `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.exceptions iTextSharp.text.exceptions.BadPasswordException\[\[BadPasswordException\]\] end subgraph System.IO System.IO.IOException\[\[IOException\]\] end System.IO.IOException --\> iTextSharp.text.exceptions.BadPasswordException

### Details

#### Inheritance

* `IOException`

#### Constructors

##### BadPasswordException \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/exceptions/BadPasswordException.cs#L59)  
public BadPasswordException(string message)

###### Arguments

|   Type   |  Name   | Description |
|----------|---------|-------------|
| `string` | message |             |

##### BadPasswordException \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/exceptions/BadPasswordException.cs#L59)  
protected BadPasswordException(SerializationInfo info, StreamingContext context)

###### Arguments

|        Type         |  Name   | Description |
|---------------------|---------|-------------|
| `SerializationInfo` | info    |             |
| `StreamingContext`  | context |             |

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# BadPdfFormatException

## BadPdfFormatException `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf iTextSharp.text.pdf.BadPdfFormatException\[\[BadPdfFormatException\]\] end subgraph System System.Exception\[\[Exception\]\] end System.Exception --\> iTextSharp.text.pdf.BadPdfFormatException

### Details

#### Inheritance

* `Exception`

#### Constructors

##### BadPdfFormatException \[1/3\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/BadPdfFormatException.cs#L62)  
public BadPdfFormatException()

##### BadPdfFormatException \[2/3\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/BadPdfFormatException.cs#L62)  
public BadPdfFormatException(string message)

###### Arguments

|   Type   |  Name   | Description |
|----------|---------|-------------|
| `string` | message |             |

##### BadPdfFormatException \[3/3\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/BadPdfFormatException.cs#L62)  
protected BadPdfFormatException(SerializationInfo info, StreamingContext context)

###### Arguments

|        Type         |  Name   | Description |
|---------------------|---------|-------------|
| `SerializationInfo` | info    |             |
| `StreamingContext`  | context |             |

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# Barcode

## Barcode `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf iTextSharp.text.pdf.Barcode\[\[Barcode\]\] class iTextSharp.text.pdf.Barcode abstractStyle; end

### Members

#### Properties

##### Public properties

|              Type              |                           Name                           |  Methods   |
|--------------------------------|----------------------------------------------------------|------------|
| `string`                       | [`AltText`](https://kb.itextpdf.com/it5kb/barcode.md#alttext)                   | `get, set` |
| `float`                        | [`BarHeight`](https://kb.itextpdf.com/it5kb/barcode.md#barheight)               | `get, set` |
| [`Rectangle`](../Rectangle.md) | [`BarcodeSize`](https://kb.itextpdf.com/it5kb/barcode.md#barcodesize)           | `get`      |
| `float`                        | [`Baseline`](https://kb.itextpdf.com/it5kb/barcode.md#baseline)                 | `get, set` |
| `bool`                         | [`ChecksumText`](https://kb.itextpdf.com/it5kb/barcode.md#checksumtext)         | `get, set` |
| `string`                       | [`Code`](https://kb.itextpdf.com/it5kb/barcode.md#code)                         | `get, set` |
| `int`                          | [`CodeType`](https://kb.itextpdf.com/it5kb/barcode.md#codetype)                 | `get, set` |
| `bool`                         | [`Extended`](https://kb.itextpdf.com/it5kb/barcode.md#extended)                 | `get, set` |
| [`BaseFont`](./BaseFont.md)    | [`Font`](https://kb.itextpdf.com/it5kb/barcode.md#font)                         | `get, set` |
| `bool`                         | [`GenerateChecksum`](https://kb.itextpdf.com/it5kb/barcode.md#generatechecksum) | `get, set` |
| `bool`                         | [`GuardBars`](https://kb.itextpdf.com/it5kb/barcode.md#guardbars)               | `get, set` |
| `float`                        | [`InkSpreading`](https://kb.itextpdf.com/it5kb/barcode.md#inkspreading)         | `get, set` |
| `float`                        | [`N`](https://kb.itextpdf.com/it5kb/barcode.md#n)                               | `get, set` |
| `float`                        | [`Size`](https://kb.itextpdf.com/it5kb/barcode.md#size)                         | `get, set` |
| `bool`                         | [`StartStopText`](https://kb.itextpdf.com/it5kb/barcode.md#startstoptext)       | `get, set` |
| `int`                          | [`TextAlignment`](https://kb.itextpdf.com/it5kb/barcode.md#textalignment)       | `get, set` |
| `float`                        | [`X`](https://kb.itextpdf.com/it5kb/barcode.md#x)                               | `get, set` |

#### Methods

##### Public methods

|              Returns              |                                                                                                    Name                                                                                                     |
|-----------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Image`                           | [`CreateDrawingImage`](https://kb.itextpdf.com/it5kb/barcode.md#createdrawingimage) (`Color` foreground, `Color` background)                                                                                                       |
| [`Image`](../Image.md)            | [`CreateImageWithBarcode`](https://kb.itextpdf.com/it5kb/barcode.md#createimagewithbarcode) ( [`PdfContentByte`](./PdfContentByte.md) cb, [`BaseColor`](../BaseColor.md) barColor, [`BaseColor`](../BaseColor.md) textColor)       |
| [`PdfTemplate`](./PdfTemplate.md) | [`CreateTemplateWithBarcode`](https://kb.itextpdf.com/it5kb/barcode.md#createtemplatewithbarcode) ( [`PdfContentByte`](./PdfContentByte.md) cb, [`BaseColor`](../BaseColor.md) barColor, [`BaseColor`](../BaseColor.md) textColor) |
| [`Rectangle`](../Rectangle.md)    | [`PlaceBarcode`](https://kb.itextpdf.com/it5kb/barcode.md#placebarcode) ( [`PdfContentByte`](./PdfContentByte.md) cb, [`BaseColor`](../BaseColor.md) barColor, [`BaseColor`](../BaseColor.md) textColor)                           |

### Details

#### Constructors

##### Barcode

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode.cs#L144)  
protected Barcode()

#### Methods

##### PlaceBarcode

public abstract Rectangle PlaceBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)

###### Arguments

|                  Type                   |   Name    | Description |
|-----------------------------------------|-----------|-------------|
| [`PdfContentByte`](./PdfContentByte.md) | cb        |             |
| [`BaseColor`](../BaseColor.md)          | barColor  |             |
| [`BaseColor`](../BaseColor.md)          | textColor |             |

##### CreateTemplateWithBarcode

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode.cs#L144)  
public virtual PdfTemplate CreateTemplateWithBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)

###### Arguments

|                  Type                   |   Name    | Description |
|-----------------------------------------|-----------|-------------|
| [`PdfContentByte`](./PdfContentByte.md) | cb        |             |
| [`BaseColor`](../BaseColor.md)          | barColor  |             |
| [`BaseColor`](../BaseColor.md)          | textColor |             |

##### CreateImageWithBarcode

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode.cs#L144)  
public virtual Image CreateImageWithBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)

###### Arguments

|                  Type                   |   Name    | Description |
|-----------------------------------------|-----------|-------------|
| [`PdfContentByte`](./PdfContentByte.md) | cb        |             |
| [`BaseColor`](../BaseColor.md)          | barColor  |             |
| [`BaseColor`](../BaseColor.md)          | textColor |             |

##### CreateDrawingImage

public abstract Image CreateDrawingImage(Color foreground, Color background)

###### Arguments

|  Type   |    Name    | Description |
|---------|------------|-------------|
| `Color` | foreground |             |
| `Color` | background |             |

#### Properties

##### X

public virtual float X { get; set; }

##### N

public virtual float N { get; set; }

##### Font

public virtual BaseFont Font { get; set; }

##### Size

public virtual float Size { get; set; }

##### Baseline

public virtual float Baseline { get; set; }

##### BarHeight

public virtual float BarHeight { get; set; }

##### TextAlignment

public virtual int TextAlignment { get; set; }

##### GenerateChecksum

public virtual bool GenerateChecksum { get; set; }

##### ChecksumText

public virtual bool ChecksumText { get; set; }

##### StartStopText

public virtual bool StartStopText { get; set; }

##### Extended

public virtual bool Extended { get; set; }

##### Code

public virtual string Code { get; set; }

##### GuardBars

public virtual bool GuardBars { get; set; }

##### CodeType

public virtual int CodeType { get; set; }

##### BarcodeSize

public abstract Rectangle BarcodeSize { get; }

##### InkSpreading

public virtual float InkSpreading { get; set; }

##### AltText

public virtual string AltText { get; set; }

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# barcode128

---
language: "en"
---
# Barcode128 (1)

## Barcode128 `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf iTextSharp.text.pdf.Barcode128\[\[Barcode128\]\] iTextSharp.text.pdf.Barcode\[\[Barcode\]\] class iTextSharp.text.pdf.Barcode abstractStyle; end iTextSharp.text.pdf.Barcode --\> iTextSharp.text.pdf.Barcode128

### Members

#### Properties

##### Public properties

|              Type              |                        Name                         |  Methods   |
|--------------------------------|-----------------------------------------------------|------------|
| [`Rectangle`](../Rectangle.md) | [`BarcodeSize`](https://kb.itextpdf.com/it5kb/barcode128-1.md#barcodesize) | `get`      |
| `string`                       | [`Code`](https://kb.itextpdf.com/it5kb/barcode128-1.md#code)               | `set`      |
| `Barcode128CodeSet`            | [`CodeSet`](https://kb.itextpdf.com/it5kb/barcode128-1.md#codeset)         | `get, set` |

#### Methods

##### Public Static methods

|    Returns     |                                           Name                                            |
|----------------|-------------------------------------------------------------------------------------------|
| ```byte``[]``` | [`GetBarsCode128Raw`](https://kb.itextpdf.com/it5kb/barcode128-1.md#getbarscode128raw) (`string` text)           |
| `string`       | [`GetHumanReadableUCCEAN`](https://kb.itextpdf.com/it5kb/barcode128-1.md#gethumanreadableuccean) (`string` code) |
| `string`       | [`GetRawText`](https://kb.itextpdf.com/it5kb/barcode128-1.md#getrawtext-12) (`...`)                              |
| `char`         | [`GetStartSymbol`](https://kb.itextpdf.com/it5kb/barcode128-1.md#getstartsymbol) (`Barcode128CodeSet` codeSet)   |
| `string`       | [`RemoveFNC1`](https://kb.itextpdf.com/it5kb/barcode128-1.md#removefnc1) (`string` code)                         |

##### Internal Static methods

| Returns  |                                                        Name                                                         |
|----------|---------------------------------------------------------------------------------------------------------------------|
| `string` | [`GetPackedRawDigits`](https://kb.itextpdf.com/it5kb/barcode128-1.md#getpackedrawdigits) (`string` text, `int` textIndex, `int` numDigits) |
| `bool`   | [`IsNextDigits`](https://kb.itextpdf.com/it5kb/barcode128-1.md#isnextdigits) (`string` text, `int` textIndex, `int` numDigits)             |

##### Public methods

|            Returns             |                                                                                          Name                                                                                          |
|--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Image`                        | [`CreateDrawingImage`](https://kb.itextpdf.com/it5kb/barcode128-1.md#createdrawingimage) (`Color` foreground, `Color` background)                                                                             |
| [`Rectangle`](../Rectangle.md) | [`PlaceBarcode`](https://kb.itextpdf.com/it5kb/barcode128-1.md#placebarcode) ( [`PdfContentByte`](./PdfContentByte.md) cb, [`BaseColor`](../BaseColor.md) barColor, [`BaseColor`](../BaseColor.md) textColor) |

### Details

#### Inheritance

* [`Barcode`](./Barcode.md)

#### Nested types

##### Enums

* `Barcode128CodeSet`

#### Constructors

##### Barcode128

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode128.cs#L257)  
public Barcode128()

#### Methods

##### GetStartSymbol

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode128.cs#L257)  
public static char GetStartSymbol(Barcode128CodeSet codeSet)

###### Arguments

|        Type         |  Name   | Description |
|---------------------|---------|-------------|
| `Barcode128CodeSet` | codeSet |             |

##### RemoveFNC1

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode128.cs#L257)  
public static string RemoveFNC1(string code)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | code |             |

##### GetHumanReadableUCCEAN

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode128.cs#L257)  
public static string GetHumanReadableUCCEAN(string code)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | code |             |

##### IsNextDigits

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode128.cs#L257)  
internal static bool IsNextDigits(string text, int textIndex, int numDigits)

###### Arguments

|   Type   |   Name    | Description |
|----------|-----------|-------------|
| `string` | text      |             |
| `int`    | textIndex |             |
| `int`    | numDigits |             |

##### GetPackedRawDigits

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode128.cs#L257)  
internal static string GetPackedRawDigits(string text, int textIndex, int numDigits)

###### Arguments

|   Type   |   Name    | Description |
|----------|-----------|-------------|
| `string` | text      |             |
| `int`    | textIndex |             |
| `int`    | numDigits |             |

##### GetRawText \[1/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode128.cs#L257)  
public static string GetRawText(string text, bool ucc, Barcode128CodeSet codeSet)

###### Arguments

|        Type         |  Name   | Description |
|---------------------|---------|-------------|
| `string`            | text    |             |
| `bool`              | ucc     |             |
| `Barcode128CodeSet` | codeSet |             |

##### GetRawText \[2/2\]

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode128.cs#L257)  
public static string GetRawText(string text, bool ucc)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | text |             |
| `bool`   | ucc  |             |

##### GetBarsCode128Raw

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode128.cs#L257)  
public static byte GetBarsCode128Raw(string text)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | text |             |

##### PlaceBarcode

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode128.cs#L257)  
public override Rectangle PlaceBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)

###### Arguments

|                  Type                   |   Name    | Description |
|-----------------------------------------|-----------|-------------|
| [`PdfContentByte`](./PdfContentByte.md) | cb        |             |
| [`BaseColor`](../BaseColor.md)          | barColor  |             |
| [`BaseColor`](../BaseColor.md)          | textColor |             |

##### CreateDrawingImage

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode128.cs#L257)  
public override Image CreateDrawingImage(Color foreground, Color background)

###### Arguments

|  Type   |    Name    | Description |
|---------|------------|-------------|
| `Color` | foreground |             |
| `Color` | background |             |

#### Properties

##### CodeSet

public virtual Barcode128CodeSet CodeSet { get; set; }

##### BarcodeSize

public override Rectangle BarcodeSize { get; }

##### Code

public override string Code { set; }

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# Barcode128CodeSet

## Barcode128CodeSet `Public enum`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf.Barcode128 iTextSharp.text.pdf.Barcode128.Barcode128CodeSet\[\[Barcode128CodeSet\]\] end

### Details

#### Fields

##### A

##### B

##### C

##### AUTO

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# Barcode39

## Barcode39 `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf iTextSharp.text.pdf.Barcode39\[\[Barcode39\]\] iTextSharp.text.pdf.Barcode\[\[Barcode\]\] class iTextSharp.text.pdf.Barcode abstractStyle; end iTextSharp.text.pdf.Barcode --\> iTextSharp.text.pdf.Barcode39

### Members

#### Properties

##### Public properties

|              Type              |                       Name                       | Methods |
|--------------------------------|--------------------------------------------------|---------|
| [`Rectangle`](../Rectangle.md) | [`BarcodeSize`](https://kb.itextpdf.com/it5kb/barcode39.md#barcodesize) | `get`   |

#### Methods

##### Public Static methods

|    Returns     |                                 Name                                 |
|----------------|----------------------------------------------------------------------|
| ```byte``[]``` | [`GetBarsCode39`](https://kb.itextpdf.com/it5kb/barcode39.md#getbarscode39) (`string` text) |
| `string`       | [`GetCode39Ex`](https://kb.itextpdf.com/it5kb/barcode39.md#getcode39ex) (`string` text)     |

##### Internal Static methods

| Returns |                               Name                               |
|---------|------------------------------------------------------------------|
| `char`  | [`GetChecksum`](https://kb.itextpdf.com/it5kb/barcode39.md#getchecksum) (`string` text) |

##### Public methods

|            Returns             |                                                                                        Name                                                                                         |
|--------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Image`                        | [`CreateDrawingImage`](https://kb.itextpdf.com/it5kb/barcode39.md#createdrawingimage) (`Color` foreground, `Color` background)                                                                             |
| [`Rectangle`](../Rectangle.md) | [`PlaceBarcode`](https://kb.itextpdf.com/it5kb/barcode39.md#placebarcode) ( [`PdfContentByte`](./PdfContentByte.md) cb, [`BaseColor`](../BaseColor.md) barColor, [`BaseColor`](../BaseColor.md) textColor) |

### Details

#### Inheritance

* [`Barcode`](./Barcode.md)

#### Constructors

##### Barcode39

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode39.cs#L133)  
public Barcode39()

#### Methods

##### GetBarsCode39

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode39.cs#L133)  
public static byte GetBarsCode39(string text)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | text |             |

##### GetCode39Ex

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode39.cs#L133)  
public static string GetCode39Ex(string text)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | text |             |

##### GetChecksum

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode39.cs#L133)  
internal static char GetChecksum(string text)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | text |             |

##### PlaceBarcode

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode39.cs#L133)  
public override Rectangle PlaceBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)

###### Arguments

|                  Type                   |   Name    | Description |
|-----------------------------------------|-----------|-------------|
| [`PdfContentByte`](./PdfContentByte.md) | cb        |             |
| [`BaseColor`](../BaseColor.md)          | barColor  |             |
| [`BaseColor`](../BaseColor.md)          | textColor |             |

##### CreateDrawingImage

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/Barcode39.cs#L133)  
public override Image CreateDrawingImage(Color foreground, Color background)

###### Arguments

|  Type   |    Name    | Description |
|---------|------------|-------------|
| `Color` | foreground |             |
| `Color` | background |             |

#### Properties

##### BarcodeSize

public override Rectangle BarcodeSize { get; }

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# BarcodeCodabar

## BarcodeCodabar `Public class`

### Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text.pdf iTextSharp.text.pdf.BarcodeCodabar\[\[BarcodeCodabar\]\] iTextSharp.text.pdf.Barcode\[\[Barcode\]\] class iTextSharp.text.pdf.Barcode abstractStyle; end iTextSharp.text.pdf.Barcode --\> iTextSharp.text.pdf.BarcodeCodabar

### Members

#### Properties

##### Public properties

|              Type              |                         Name                          | Methods |
|--------------------------------|-------------------------------------------------------|---------|
| [`Rectangle`](../Rectangle.md) | [`BarcodeSize`](https://kb.itextpdf.com/it5kb/barcodecodabar.md#barcodesize) | `get`   |

#### Methods

##### Public Static methods

|    Returns     |                                       Name                                        |
|----------------|-----------------------------------------------------------------------------------|
| `string`       | [`CalculateChecksum`](https://kb.itextpdf.com/it5kb/barcodecodabar.md#calculatechecksum) (`string` code) |
| ```byte``[]``` | [`GetBarsCodabar`](https://kb.itextpdf.com/it5kb/barcodecodabar.md#getbarscodabar) (`string` text)       |

##### Public methods

|            Returns             |                                                                                           Name                                                                                           |
|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Image`                        | [`CreateDrawingImage`](https://kb.itextpdf.com/it5kb/barcodecodabar.md#createdrawingimage) (`Color` foreground, `Color` background)                                                                             |
| [`Rectangle`](../Rectangle.md) | [`PlaceBarcode`](https://kb.itextpdf.com/it5kb/barcodecodabar.md#placebarcode) ( [`PdfContentByte`](./PdfContentByte.md) cb, [`BaseColor`](../BaseColor.md) barColor, [`BaseColor`](../BaseColor.md) textColor) |

### Details

#### Inheritance

* [`Barcode`](./Barcode.md)

#### Constructors

##### BarcodeCodabar

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/BarcodeCodabar.cs#L98)  
public BarcodeCodabar()

#### Methods

##### GetBarsCodabar

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/BarcodeCodabar.cs#L98)  
public static byte GetBarsCodabar(string text)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | text |             |

##### CalculateChecksum

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/BarcodeCodabar.cs#L98)  
public static string CalculateChecksum(string code)

###### Arguments

|   Type   | Name | Description |
|----------|------|-------------|
| `string` | code |             |

##### PlaceBarcode

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/BarcodeCodabar.cs#L98)  
public override Rectangle PlaceBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)

###### Arguments

|                  Type                   |   Name    | Description |
|-----------------------------------------|-----------|-------------|
| [`PdfContentByte`](./PdfContentByte.md) | cb        |             |
| [`BaseColor`](../BaseColor.md)          | barColor  |             |
| [`BaseColor`](../BaseColor.md)          | textColor |             |

##### CreateDrawingImage

[*Source code*](https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/BarcodeCodabar.cs#L98)  
public override Image CreateDrawingImage(Color foreground, Color background)

###### Arguments

|  Type   |    Name    | Description |
|---------|------------|-------------|
| `Color` | foreground |             |
| `Color` | background |             |

#### Properties

##### BarcodeSize

public override Rectangle BarcodeSize { get; }

*Generated with* [*ModularDoc*](https://github.com/hailstorm75/ModularDoc)

---
language: "en"
---
# barcodedatamatrix

[Next Page](https://kb.itextpdf.com/llms-full.txt/1)
