Text and image elements
Add text and image elements to the pages and templates of a document. Fonts and colors come directly from the .NET Font and Color structures.
ExpertPdf PDF Creator is a .NET library built to enhance the HTML to PDF Converter. Besides the HTML to PDF conversion features, it has a large number of general PDF capabilities: create PDF documents from scratch or modify existing ones.
Add text, images, shapes, bookmarks, links, file attachments and digital signatures, and place HTML or RTF content anywhere on a page. Encrypt documents, set passwords and permissions, merge and split PDF files.
Documentation · Online samples · NuGet · NuGet for .NET Framework · Download .zip (v22.0.0)
The features grouped by what they touch: the elements of a page, the security of the document, and the HTML and RTF content converted into the same document.
Text, images, shapes, bookmarks, links, attachments and notes: what you need to build a page in code.
Add text and image elements to the pages and templates of a document. Fonts and colors come directly from the .NET Font and Color structures.
Render multipage images (TIFF) to PDF.
Draw lines, rectangles, ellipses, circles, polygons and Bezier curves, with line width and dash style, fill colors and gradients.
Insert a table of contents with dotted leaders, page numbers and links, built from the HTML headings or from entries you add.
Number pages the way a book does (i, ii, iii, then 1, 2, 3, or A-1) in the viewer, and add named destinations that links like file.pdf#name open.
Create the bookmarks of the PDF document: root bookmarks and child bookmarks, each pointing to a page or a point in a page.
Merge and split PDF files and streams with the MergePdf and SplitPdf classes.
Create links to web addresses and to other places in the same PDF document.
Attach files to the document and add text notes to its pages.
Rotate PDF pages by 90, 180 or 270 degrees, set the viewer preferences and the document description: title, subject, keywords and author.
Digital signatures, passwords, encryption keys and document permissions.
Add ordinary digital signatures with a certificate from a PKCS#12 file (.pfx or .p12) or from a Windows certificate store.
Set the password required to open the document and the password required to change its permissions.
Encrypt the content of the PDF document.
Choose a 40 bit or a 128 bit encryption key.
Allow or deny printing, editing, copying, filling form fields and editing annotations.
Open and append PDF documents encrypted with AES-128 or AES-256, with their password.
Documents that meet the PDF/A, PDF/UA and ZUGFeRD standards.
PDF/A-1b, PDF/A-2b, PDF/A-3b, PDF/A-3u and PDF/A-3a for long-term archiving, and PDF/X-1a for print.
Tagged documents, from the HTML of a page or built in code with tags on each element, alternate text and artifacts.
Hybrid electronic invoices, profiles Minimum to XRechnung, with the invoice XML attached, and custom XMP schemas.
Attach files with their relationship to the document (source, data, alternative, supplement), as PDF/A-3 requires.
Place converted web pages and HTML strings anywhere in the document: on a page, in a template, in the header or footer.
Place the result of an HTML to PDF conversion, from a URL or an HTML string, at any position in the PDF document.
Set the width and height in the PDF of the content rendered from HTML, or let the height follow the content.
Render the HTML with the new Chromium engine (CEF 154), with Blink (Chromium 148) or with the internal WebKit engine.
With Chromium, an HTML element continues on the next pages and its last page ends where the content ends.
Add several HTML elements to the same document, each in its own position.
Get the bounds of the rendered content in each page it was rendered on, to place the next elements right under it.
Set the transparency of the rendered content and rotate it.
Add HTML to templates repeated on each page of the PDF document, for example a watermark.
Add HTML to the header and the footer of the PDF document.
The same placement options as HTML, with RTF documents as the source.
Place the result of an RTF to PDF conversion at any position in the PDF document.
Set the width and height in the PDF of the content rendered from RTF, or let the height follow the content.
Add several RTF elements to the same document, each in its own position.
Get the bounds of the rendered content in each page it was rendered on.
Set the transparency of the rendered content and rotate it.
Add RTF to templates repeated on each page of the PDF document.
Add RTF to the header and the footer of the PDF document.
The latest releases of the PDF Creator. Open the list below the table for every release since version 2.0.
Create a document, add a page, add text, a line and an image, and save it. The other tabs place HTML content on a page, and encrypt and sign a document. Coordinates and sizes are in points (1/72 inch).
using System.Drawing; using ExpertPdf.PdfCreator; LicensingManager.LicenseKey = "your license key"; // A new document with an A4 portrait page and 36 points margins var document = new Document(); PdfPage page = document.AddPage(PageSize.A4, new Margins(36), PageOrientation.Portrait); // A text element with a standard PDF font PdfFont font = document.AddFont(StdFontBaseFamily.HelveticaBold); font.Size = 18; var title = new TextElement(0, 0, "Invoice", font); title.ForeColor = Color.FromArgb(11, 102, 194); AddElementResult result = page.AddElement(title); // A line and an image under the text (coordinates in points) float y = result.EndPageBounds.Bottom + 10; page.AddElement(new LineElement(0, y, 300, y)); page.AddElement(new ImageElement(0, y + 10, 120, "logo.png")); // Save as a byte array, or with Save(fileName) or Save(stream) byte[] pdf = document.Save(); document.Close();
Install with dotnet add package ExpertPdf.PdfCreator.NetCore, or reference epdfcreator.dll from the download. The documentation explains the API and describes every class and method.
Common questions about building documents in code, HTML and RTF content, security, and the supported platforms.
HtmlToPdfElement and RtfToPdfElement place converted content at the position and size you choose. Add several of them to the same document, get the bounds of the rendered content from the AddElementResult, and continue with text, images or shapes right under it.Document from an existing PDF file or stream, also with the password of a protected document, then add pages and elements, a watermark template or a digital signature, and save it again.Document.Security property. Digital signatures are added with the DigitalSignatureElement, using a certificate from a PKCS#12 file (.pfx or .p12) or from a Windows certificate store.PdfStandardSubset produces PDF/A-1b, PDF/A-2b, PDF/A-3b, PDF/A-3u and PDF/A-3a and PDF/X-1a documents. Document.Tagged produces a tagged, accessible PDF (PDF/UA-1), with BeginTag / EndTag and the tag properties of each element for documents built in code. AddZugferdInvoice makes ZUGFeRD and Factur-X electronic invoices, profiles Minimum to XRechnung, and AddAssociatedFile attaches files for PDF/A-3.TableOfContents collects entries from the HTML headings or from entries you add, and Document.InsertTableOfContents inserts it with dotted leaders, page numbers and links. AddPageLabelRange sets page labels such as roman numerals for the front matter.Document.AddBookmark, links to web addresses with LinkUrlElement, links to other places in the document with InternalLinkElement, file attachments with FileAttachmentElement and text notes with TextNoteElement.ExpertPdf.PdfCreator.NetCore targets .NET Standard 2.0 and .NET Framework, and ExpertPdf.PdfCreator targets .NET Framework. No installation and no printer driver are needed: you reference the assembly from any type of .NET application, such as ASP.NET, Windows Forms, console applications and Windows services.Download the free trial of the PDF Creator with C# and VB.NET samples. When you are ready, license it on the pricing page.