4-Heights® PDF Toolbox SDK - Edit, combine and create PDF in C# .NET Core and Java
The 4-Heights® PDF Toolbox SDK is a fast, high-quality, PDF/A-compliant component to programmatically create PDF documents from scratch, add any content, such as text and images to existing PDFs and assemble (merge and split) PDF documents. Thanks to various interfaces, the SDK can be used with Java, C/C++, .NET Core and .NET languages, such as C# and Visual Basic.
Forms and Annotations
Create, fill and extract forms programmatically. Add, modify and extract annotations.
Edit PDF
Change PDF documents. Add additional information, such as a stamp, image or text or remove text from a PDF.
Create PDF
Create new pages with any content. Make a new PDF or merge them with your existing PDFs.

PDF Toolbox - Features
Document assembly
- Copy pages from existing PDFs
- Copy annotations, form fields, links, logical structure, destinations, outlines, layers
- Flatten annotations, form fields, signatures
- Optimize resources
- Crop and rotate pages
- Free composition of content: Overlays, Underlays, Stamps, Transformations
- Encryption: User password, Owner password, Permissions
- Copy and modify document metadata
- Copy and modify page metadata
- Add embedded files and associated files
- Get and set OpenAction destination
Generation
Document Level
- Create pages
- Create form fields
- General text fields and comb text fields
- Check boxes
- Radio button groups
- List boxes
- Combo boxes
- Create new outline items and insert them at any position in the tree
- Destinations: Named and direct destinations in the same document
- Create pages
Page Content Level
- Create new PDF content from scratch
- Apply content to existing pages
Colors
- Device colors: RGB, CMYK and Grayscale
- ICC color profiles
- Transparency: Alpha and Blend mode
Paths
- Single and Multi-segment lines
- Rectangle, Circle, Bezier curves, Ellipse, Arc, Pie
- Filling, stroking, clipping and combinations thereof
- Line width, cap, join, dash array, dash phase and miter limit
- Inside rule: Nonzero winding rule, Even/odd rule
Text
- Font size, Character spacing, Word spacing
- Horizontal scaling, leading, rise
- Enables simple text layouting
- Standard PDF fonts, installed fonts
- Font metrics: Italic angle, Ascent, Descent, Cap height, Character width
- Unicode characters
- Text stroke: Line width, Line join and Dashes
- Fill and stroke text, invisible text
- Use text as clipping path
Images
- Bi-level: CCITT G3, G3 2D and G4, Flate, LZW, Packbits, uncompressed
- 4 bit and 8 bit grayscale: Flate, LZW, Packbits, JPEG and JPEG-6 (8 bit only), uncompressed
- RGB: Flate, JPEG and JPEG-6, LZW, Packbits, uncompressed
Transformations
- Translation
- Scaling
- Skewing (Horizontal, Vertical)
- Rotation
Annotations
- Web link annotations
- File attachment annotations
- Free text annotation
- Sticky note annotation
- Text stamp annotation
- Custom stamp annotation
- Circle annotation
- Square annotation
- Line annotation
- Polyline annotation
- Polygon annotation
- Free drawing ("ink") annotation
Modification
Page Content
- Selective deletion of content elements (without markup)
- Geometric transformation of content elements (without markup)
Annotations
- Web link annotations’ target URIs
- Markup annotations’ location, creation/modification date, subject, author, content
Form Fields
- Deletion of fields and modification of field values for
- General text fields and comb text fields
- Check boxes
- Radio button groups
- List boxes
- Combo boxes
- Deletion of fields and modification of field values for
Extraction
Document and Page
- Document information entries: Title, Author, Subject, Keywords, Creator, Producer, Creation date, Modification date
- Document XMP metadata
- Document encryption settings
- Embedded files
- Page bounding boxes: Media box, Crop box, Bleed box, Trim box, Art box
- Page XMP metadata
- Outline item tree: Tree structure, item title, expanded/collapsed
- Destinations: Named and direct destinations in the same document
- Viewer settings
Content
- Page’s and group’s content elements including
- Bounding box
- Affine transformation
- As either of the following:
- Group element
- Image element
- Width and height in pixel
- Bits per component
- Color space
- Image mask element
- Width and height in pixel
- Paint for filling the mask
- Path element
- Alignment box
- Fill parameters including paint and fill rule
- Stroke parameters including line paint and line style
- Shading element
- Text element
- Text fragments
- Bounding box
- Affine transformation
- Unicode string
- Fill parameters including paint and fill rule
- Stroke parameters including line paint and line style
- Text fragments
- Page’s and group’s content elements including
Annotations
- Annotations: location
- Markup annotation: type, location, creation/modification date, subject, author, content
- Custom stamp annotations: appearance
- Link annotations: location, target destination or URI
- Signature fields: name, location, reason, contact info, date, visibility
AcroForm Form Fields
- Form field identifiers, export names and user names, including form field hierarchy
- Form field export and display content of:
- Push buttons
- Check boxes
- Radio button groups
- General text fields and comb text fields
- List boxes
- Combo boxes
Conformance
- ISO 32000-1 (PDF 1.7)
- ISO 32000-2 (PDF 2.0)
- ISO 19005-1 (PDF/A-1)
- ISO 19005-2 (PDF/A-2)
- ISO 19005-3 (PDF/A-3)
Supported formats
Supported PDF Formats
- PDF 1.0 to 1.7
- PDF 2.0
- PDF/A-1, PDF/A-2, PDF/A-3
Supported image formats
- BMP
- DIB
- JPEG
- JPEG2000
- JBIG2
- PNG
- GIF
- TIFF
Supported Font Formats
- Type1
- TrueType
- OpenType
- OpenType (CFF)

Areas of use - edit and composite PDF documents
PDF generation
Programmatic creation of any PDF/A-conform document, whereby its content can stem from any source such as a database or webpage form.
Personalization
PDF documents are used for distributing e-books as well as for creating invoices, contracts and terms and conditions, for instance in insurance application forms. These documents share a common requirement: they need to be supplemented with data specific to the recipient.
Automated reporting
Large quantities of information are stored in databases and DMS systems. PDF Toolbox is designed to receive this information and convert it into distributable standardized PDF documents. It therefore enables the distribution of documents across infrastructures where different technologies and operating systems are in use.
Other areas of use
- Mass production of invoices, reports, etc.
- PDF creation "on-the-fly" in web server applications
- "Save as PDF/A" function in application programs
- Import images and text in PDF/A documents
// Open input document
using (Stream inStream = new FileStream(inPath, FileMode.Open, FileAccess.Read))
using (Document inDoc = Document.Open(inStream, null))
// Create output document
using (Stream outStream = new FileStream(outPath, FileMode.Create, FileAccess.ReadWrite))
using (Document outDoc = Document.Create(outStream, inDoc.Conformance, null))
{
// Copy document-wide data
CopyDocumentData(inDoc, outDoc);
font = Font.CreateFromSystem(outDoc, "Arial", "Italic", true);
// Get the color space
ColorSpace colorSpace = ColorSpace.CreateProcessColorSpace(outDoc, ProcessColorSpaceType.Rgb);
// Choose the RGB color value
double[] color = { 1.0, 0.0, 0.0 };
Transparency transparency = new Transparency(alpha);
// Create paint object with the choosen RGB color
paint = Paint.Create(outDoc, colorSpace, color, transparency);
// Define copy options
PageCopyOptions copyOptions = new PageCopyOptions();
// Copy all pages from input document
foreach (Page inPage in inDoc.Pages)
{
// Copy page from input to output
Page outPage = Page.Copy(outDoc, inPage, copyOptions);
// Add text to page
AddStamp(outDoc, outPage, stampString);
// Add page to document
outDoc.Pages.Add(outPage);
}
}
private static void CopyDocumentData(Document inDoc, Document outDoc)
{
// Copy document-wide data
// Output intent
if (inDoc.OutputIntent != null)
outDoc.OutputIntent = IccBasedColorSpace.Copy(outDoc, inDoc.OutputIntent);
// Metadata
outDoc.Metadata = Metadata.Copy(outDoc, inDoc.Metadata);
// Viewer settings
outDoc.ViewerSettings = ViewerSettings.Copy(outDoc, inDoc.ViewerSettings);
// Associated files (for PDF/A-3 and PDF 2.0 only)
FileReferenceList outAssociatedFiles = outDoc.AssociatedFiles;
foreach (FileReference inFileRef in inDoc.AssociatedFiles)
outAssociatedFiles.Add(FileReference.Copy(outDoc, inFileRef));
// Plain embedded files
FileReferenceList outEmbeddedFiles = outDoc.PlainEmbeddedFiles;
foreach (FileReference inFileRef in inDoc.PlainEmbeddedFiles)
outEmbeddedFiles.Add(FileReference.Copy(outDoc, inFileRef));
}
private static void AddStamp(Document outputDoc, Page outPage, string stampString)
{
// Create content generator and text object
using ContentGenerator gen = new ContentGenerator(outPage.Content, false);
Text text = Text.Create(outputDoc);
// Create text generator
using (TextGenerator textgenerator = new TextGenerator(text, font, fontSize, null))
{
// Calculate point and angle of rotation
Point rotationCenter = new Point
{
X = outPage.Size.Width / 2.0,
Y = outPage.Size.Height / 2.0
};
double rotationAngle = Math.Atan2(outPage.Size.Height,
outPage.Size.Width) / Math.PI * 180.0;
// Rotate textinput around the calculated position
AffineTransform trans = AffineTransform.Identity;
trans.Rotate(rotationAngle, rotationCenter);
gen.Transform(trans);
// Calculate position
Point position = new Point
{
X = (outPage.Size.Width - textgenerator.GetWidth(stampString)) / 2.0,
Y = (outPage.Size.Height - font.Ascent * fontSize) / 2.0
};
// Move to position
textgenerator.MoveTo(position);
// Set text paint
textgenerator.Fill = paint;
// Add given stamp string
textgenerator.ShowLine(stampString);
}
// Paint the positioned text
gen.PaintText(text);
}

The caveats of assembling PDF/A documents
Assembling PDF documents from various sources is a crucial part of an output management system. And, as the document needs to be archived in most cases, it should conform to the PDF/A standard. Is there a way to assemble a document and accomplish PDF/A conformance in one step?