XFINIUM.PDF as a Portable Class Library

XFINIUM.PDF 4.0 has been released a few days ago and it brings support for a very requested feature: support for Portable Class Libraries. The XFINIUM.PDF product is now available also as a  Portable Class Library in the form of Xfinium.Pdf.Pcl.dll assembly. Continue reading “XFINIUM.PDF as a Portable Class Library”

Display alternate images for view and print in a PDF document

A question on StackOverflow.com asked if it is possible to have 2 alternate versions of an image in a PDF file, one for display and other for print.
Several solutions were given: optional contentform fields or alternate images. In the article below we’ll show how these solutions can be implemented using XFINIUM.PDF library and how they compare to each other.
Continue reading “Display alternate images for view and print in a PDF document”

How to create a simple PDF document in .NET

When we first designed the XFINIUM.PDF library for .NET 2 years ago one of the design targets was an easy learning curve. Although it was released first in a controlled corporate environment we still had to make it easy to use.

We used simple and clear abstractions that relate to real world and also to PDF specification: PdfFixedDocument class represents a PDF document which has a fixed layout by its nature, PdfPage class represents a page in a PDF document, the page drawing surface is represented by a PdfGraphics object. The pen is used to stroke a path outline while the brush is used to fill the path interior. An annotation is represented by a specific instance of PdfAnnotation class, a form field by PdfField class and so on. We tried to match the objects in PDF specification with classes in our object model so if you are looking for more advanced PDF features you can easily find them in our API. For example optional content objects are represented by PdfOptionalContentGroup class in our API.

Creating a PDF document with XFINIUM.PDF is a simple task, an empty PDF document requires only 3 lines of code: create the document, create one page and save the document.

PdfFixedDocument document = new PdfFixedDocument();
PdfPage page = document.Pages.Add();

Adding text content to the document above requires 3 more lines of code: font creation for drawing the text, brush creation for setting the text color and drawing the actual text on page graphics.

PdfFixedDocument document = new PdfFixedDocument();
PdfPage page = document.Pages.Add();
// Create a standard font with Helvetica face and 24 point size
PdfStandardFont helvetica = new PdfStandardFont(PdfStandardFontFace.Helvetica, 24);
// Create a solid RGB red brush.
PdfBrush brush = new PdfBrush(PdfRgbColor.Red);
// Draw the text on the page.
page.Graphics.DrawString("Hello World", helvetica, brush, 100, 100);

Our object model follows the PDF specification quite closely. This lets you build complex abstractions, such as flow documents, on top of it without problems.

XFINIUM.PDF blog has been launched

We launched today the blog for our XFINIUM.PDF line of products. The blog will include in-depth technical information about our products, technical solutions for specific problems, samples and other content that we’ll consider to be useful.

XFINIUM.PDF library is a .NET/Mono library for PDF development. We support a wide set of features, ranging from simple PDF creation to form filling, content redaction or complex color conversions. The simple object model follows the PDF specification so you can have complete control over the generated PDF files. Code written for XFINIUM.PDF can be compiled on all supported platforms without changes.
XFINIUM.PDF has been developed entirely in C# and it is 100% managed code. It is licensed per developer with royalty free distribution so you can freely distribute your application without paying other fees.

Main features are:

  • Create PDF & PDF/A files and PDF portfolios
  • Create, fill, flatten and save PDF forms
  • Merge and split PDF files
  • Draw multiple pages on a new page
  • Stamp and watermark PDF files
  • Extract text and images from PDF files
  • PDF annotations and actions
  • Page content transformations
  • AES/RC4 40/128/256 bit encryption
  • Text and image redaction
  • Built-in vector 1D & 2D barcode engine
  • Complex vector graphics

You can read here the complete list of features.

We support all .NET, Mono and Xamarin platforms:  Windows Forms, ASP.NET, Mono, WPF, Silverlight, WinRT, Windows Phone, Xamarin iOS, Xamarin Android.