pdf links

PDF Rendering
Convert PDF to Image (.NET)
Convert PDF to image on Android (Xamarin)
Convert PDF to image on iOS (Xamarin)
Convert PDF to image in Windows Store apps (.NET)
Convert PDF to image in Windows Phone apps (.NET)
PDF to image in Universal Windows Store apps (.NET)
Free PDF Viewer control for Windows Forms (.NET)
How to integrate PDF Viewer control in WPF app (.NET)
Creating WPF PDF Viewer supporting bookmarks (.NET)
Cross-platform PDF Viewer using GTK# (MONO)
Silverlight PDF viewer control (Silverlight 5)
Multithreaded PDF rendering (.NET)
Convert pdf to image in Silverlight app (C# sample)
How to set fallback fonts for PDF rendering (C#)
Avoiding the out-of-memory exception on rendering (C#)
PDF viewer single page application (WebAPI, AngularJS)
PDF viewer control for Windows 10 universal applications
Use custom ICC profile for CMYK to RGB conversion
PDF layers - separate images, text, annotations, graphics

PDF Forms Creation PDF Security
Conversion to PDF/A
Other topics
PDF Document Manipulation
PDF Content Generation
Fixed and Flow layout document API (.NET)
Creation of grids and tables in PDF (C# sample)
How to create interactive documents using Actions (C# sample)
Text flow effects in PDF (C# sample)
How to generate ordered and bulleted lists in PDF (C# sample)
Convert HTML to PDF using flow layout API (C# sample)
How to use custom fonts for PDF generation (.NET)
Create document with differently sized pages (C#)
Create PDF documents using MONO (C#/MONO/Windows/OSX)
How to use background images for content elements (C#/PDF Kit/FlowLayout)
Add transparent images to PDF document (C#)
Draw round rect borders in PDF documents(C#)
ICC color profiles and and ICC based colors in PDF (C#)
How to use bidirectional and right to left text in PDF (C#)
Create PDF documents from XML templates (C# sample)
How to resize PDF pages and use custom stamps (C#)
Add header and footer to PDF page (.NET sample)
How to use clipping mask for drawing on PDF page
Fill graphics path with gradient brushes in PDF (Shadings)
Apitron PDF Kit and Rasterizer engine settings
Add layers to PDF page (optional content, C# sample)
How to create free text annotation with custom appearance

PDF Content Extraction
PDF Navigation

PDF to TIFF conversion
Contact us if you have a PDF related question and we'll cover it in our blog.


Full-featured documentation portal with sample code

As our blog outgrew its initial format, we decided to take it to the next level and created a full-featured documentation portal containing lots of information regarding PDF, explained with practical focus on details and accompanied by code samples including necessary know-how's.

So from now on, you're welcome to visit end enjoy it by the following url: docs.apitron.com. We'd be very thankful for your comments and suggestions, so please don't hesitate to contact our support team with your feedback.


Web API for PDF processing


New development challenges continuously call for yet another things to be done to circumvent the tricky limitations all big name platform providers impose on us for whatever reasons. Nevertheless we, at Apitron, believe that it just makes our software better and if one could use a rewording – cuts it like a diamond for it to become an even better all-around tool for our customers.

We already went a long way to make our tools cross-platform with .NET, MONO and Xamarin, so now they cover many usage scenarios and provide a solid toolset for creating full-cycle PDF processing apps. But we have even more to offer, a web API for PDF processing with the focus on signing and watermarking of documents. It’s designed to be hosted in-house but we have a demo installation publicly available as well.


Like it has been said before, the API can be hosted anywhere including your own server if you need. It supports signing and watermarking of PDF documents and we have set up a test installation for you to try it out. The slides below demonstrate the user interface of a test client web app that makes use of the aforementioned web api and is available for download from our github repo. As the first step after downloading, you’d have to configure the app to use the right web api installation URL by editing the “ServiceUrl” in its web.config. We used our demo url here.

Pic. 1 Configuring client app
Pic. 1 Configuring client app

After that we can run the app in browser and proceed by selecting the file and desired action, see below:

Pic. 2 Selecting source file and desired action
Pic. 2 Selecting source file and desired action

Source document used here is a dummy letter crafted for illustrative purposes, it’s shown below:

Pic. 3 Source PDF document
Pic. 3 Source PDF document

After setting up the desired signature properties as shown on the next slide, we will get our doc sent to the server, signed there and downloaded back. The demo installation uses https, so there won’t a be a plaintext data exchange happening and we won’t store and use any data sent to our web api except for providing you with signing and watermarking services.

Pic. 4 Applying signature settings
Pic. 4 Applying signature settings

So here we can choose among the existing server keys for signing but the demo installation has only one such key listed (with a word “password” used as its actual password). You can also upload your own key and sign with it if you wish. The purpose of having a set of pre-loaded keys is to provide an organization with a way to share certain functions among employees without actually giving them access to the signing certificates and having common keys in one place for easy management and better protection. 

It might be the case that you’d want to employ a HSM or other means for storing the keys. All these things become possible with a custom setup and implementation of storage modules. Contact us if you are interested to know more. Our web API is based on Apitron PDF Kit product and requires a license for this product to become fully functional. Otherwise it will work in evaluation mode, but the important note is that web API package itself is provided free of charge.

The results of the signing operation are shown below, signature image (if set) takes priority over signature text hence the name and surname represented by the supplied image at the bottom of the page.

Pic. 5 Signed PDF document
Pic. 5 Signed PDF document

Watermarking requires less parameters for now, it can be either a text string or an image as shown below:

Pic. 6 Applying watermark settings
Pic. 6 Applying watermark settings

The image (if set) gets centered on the page and the text gets aligned diagonally along the line coming from the left bottom corner to the top right corner.

Sample watermarked document is shown below:

Pic. 7  Watermarked PDF document
Pic. 7 Watermarked PDF document

The Code

JS code sample showing how to perform the request to the API is provided below, it is the excerpt from the client app referenced in this post, so you can examine its code and find more info there.

var formData = new FormData();
formData.append("signatureText", “your text here”);
formData.append("signatureImage", [image data here]);
formData.append("signingKeyName", “key name here”);
formData.append("signingCertificate", [cert data here]);
formData.append("signingPassword", “cert password here”);
formData.append("signatureBoundary", “115,150,185,190”);
formData.append("signaturePageIndexStart", 0);
formData.append("signaturePageIndexEnd", 0);
function (index, value) {
formData.append("sourceFiles" + index, value);

// call signing api
$.ajax({ url: “signing api url here”, 
        data: formData, 
        contentType: false, 
        processData: false, 
        type: 'POST',
        success: function (data) {
        getResults(“signing api url here”, data);
        error: function (xhr, textStatus, errorThrown) {
        reportError("Error occured while contacting the server: " + textStatus);

We’re performing the REST call here, namely POST the form with parameters describing our signing request, get back the signing task Id and later query the same service using the acquired task Id to get the result. We recommend looking at the sources of the sample app for the detailed explanation on how to make these calls.


We hope that new web API will facilitate the development of your PDF processing apps. It’s never been so easy to handle PDFs just with a few lines of code and get the serious job done so quickly. An option to have your own installation of the web api free of charge is a great benefit and our professional customer support can always help you with any questions you might have.


PDF 2.0 specification overview

As you probably know the PDF 2.0 specification has been recently released and it introduced many long awaited features as well as deprecated some stuff. Here we would like to highlight the changes, so you could have an overview of what is going to happen in PDF world soon. Our dev team is working on adding support for all the new features and some of them are already implemented, but nevertheless it will take some time to align the products with the new spec.

So here are the features:
  • "Unencrypted wrapper document" – the way to use custom encryption algorithms for encrypting string and streams
  • "Use of black point compensation" – related to rendering intents and color conversion using ICC
  • "Projection annotations" – projection annotations provide a way to save 3D and other specialized measurements and comments as markup annotations. These measurements and comments then persist in the document
  • "CAdES signatures as used in PDF" – adds new subfilter to PDF signatures
  • "Long term validation of signatures" along with the "Document Security Store (DSS)" and "Document timestamp (DTS) dictionary" specifies the way to store the information needed to validate signatures on a long-term basis (CRL, OCSP and Timestamp data)
  • "Geospatial features" – new way to store geospatial data
  • "Rich media" annotations – common framework for video, audio and animated content
  • "Namespaces" for tagged PDF – new way for preserving logical structure of docs converted from other formats
  • "Pronunciation hints" – a way to aid text-to-speech processors with correct pronunciation
  • "Document parts" – specifies the way the to divide the document into logical parts with different purposes, simply speaking, defining subdocuments
  • "Associated files" – a way to indicate the relationship between the PDF objects in the document and content in other formats
  • Support for ISO 14739-1:2014 Product Representation Compact (PRC) file format
  • Support for UTF-8

Existing PDF features were updated by adding the following capabilities:
  • Transparency and blend mode attributes for the annotations
  • Stamp Annot intent
  • Polygon and Polyline real paths
  • 256-bit AES encryption
  • ECC-based certificates
  • Unicode based passwords
  • Document requirement extensions
  • New value for tab order of fields and annotations
  • Page-level OutputIntents
  • Referenced (external) OutputIntents
  • Thumbnails for embedded files
  • Halftone Origin (HTO)
  • Measurement and Point Data for image and form XObjects
  • L (length) key for inline image data
  • Viewer preferences enforcement (for print scaling)
  • 3D measurements
  • GoToDp action
  • RichMediaExecute action
  • Extension for GoTo and GoToR supporting linking to specific structure elements
  • Extension for Signature Field Locks and Signature Seed Values
  • Extensions for 3D viewing conditions, including transparency
  • Ref (reference) structure elements
  • PageNum and Bates artifact types
  • New list types for structured lists
  • Short” (short name) attribute for table header cells
  • Extensions to OutputIntents (MixingHints and SpectralData)

And of course, many things were deprecated, see the list below:
  • XFA (finally!) including NeedsRendering
  • Movie, Sound and TrapNet annotations
  • Movie and Sound actions
  • Info dictionary
  • Assistive technology restrictions via DRM
  • ProcSet
  • Operation system specific file specifications
  • Operation system specific additions to Launch actions
  • Names for XObjects
  • Names for Fonts
  • Arrays of Blend Modes
  • Alternate Presentations
  • Open prepress interface
  • CharSet (For Type 1 fonts)
  • CIDSet (for CID fonts)
  • Prepress viewer preferences (ViewArea, ViewClip and so on)
  • NeedAppearances
  • adbe.pkcs7.sha1 subfilter, as SHA1 was considered weak
  • adbe.x509.rsa_sha1 subfilter, same as above
  • Encryption of FDF files
  • Suspects flag in MarkInfo dictionary
  • UR signatures

If we missed something just let us know and we’ll add it asap. New releases will be available soon, so keep an eye on Apitron PDF Kit and Apitron PDF Rasterizer pages and nuget packages.


Government issued smart cards and PDF documents signing

Many EU and non-EU governments and organizations are now issuing so-called e-legitimations, e.g. SuisseID / MobileID in Switzerland, BankID / MobileID / National ID in Nordic countries, ID cards in Italy and Germany, Dutch copy of BankID called iDin, Belgian National ID and so on. Some of them are produced in the form of smartcards carrying necessary digital certificates which can be used for documents signing. 

There are a few ways to work with these cards from the development perspective and it depends on the provided driver and, consequently, supported interfaces. If the target OS is Windows you can either use CryptoAPI, CNG (CryptoAPI Next Generation) or PKCS#11 if supported by the device. Most vendors supply drivers for both, so it shouldn't be the problem. In case of .NET there is a great wrapper for PKCS#11 called Pkcs11Interop that is compliant with v.2.20 of the specification. Working with CryptoAPI often requires PInvokes to be defined and mastered and, honestly, may become quite challenging task.

With macOS it's a bit foggy, nevertheless you can use tokend drivers provided by various vendors either open source or commercial. Apple's own signing API works for this purpose however it may require dancing around to get things working.

Whichever way you choose, we can provide you with a reliable PDF processing library so you'd be able to sign documents without any problems, once you try our API defined to handle various signing scenarios. Apitron PDF Kit sets high standards in PDF processing and our team is well known for the outstanding customer support. Please don't hesitate to contact us if you have any questions, we'll be happy to help you.


Apitron PDF Kit Extensions Update: Text Watermarks



In our previous post we announced the release of the open source extensions library for Apitron PDF Kit. We continue making code contributions to this project, so recently a pack of changes related to text watermark support was added and now you can promptly add watermarks using text strings in addition to images.

For those thinking about keeping doc’s size as small as possible, textual watermarks seem to have a clear advantage over images as they usually need less bytes to store. The source code for the library can be found in our github repo by the following link. See the demo of new functionality and samples below.

Code samples

Adding text watermark is super easy:

using (Stream inputStream = File.Open("../../data/letter_unsigned.pdf", FileMode.Open))
    string watermarkText = "TOP secret -for INTERNAL use - TOP secret - for
       INTERNAL use - TOP secret - for INTERNAL use - TOP secret";

using (FixedDocument doc = new FixedDocument(inputStream))
        doc.WatermarkText(watermarkText, outputFileName);

The result is below:

Pic.1 Text watermark
Pic.1 Text watermark


By releasing the Apitron PDF Kit Extensions we wanted to show you how to use the base API and at the same time make things simpler by implementing some tricky things in very a customizable way. Just get the base code and adapt it to your needs or add you own extensions. Don’t forget to share nice snippets with others.


Open source Apitron PDF Kit extensions library


Apitron PDF Kit is an outstanding library for all kinds of tasks related to PDF, it offers well-designed and balanced API that follows the specification as much as possible at the same time making your life easier by automating many routine operations. 

We decided to take it one step further and introduced Apitron PDF Kit open source extensions library which would automate most frequent pdf manipulation activities, and started with adding digital signatures and watermarks. 

The project pursues two main goals:

1. Make PDF processing more intuitive and straightforward
2. Show how the base Apitron PDF Kit API works using real-life examples

The source code for the library can be found in our github repo by the following link. We will probably wrap it as a nuget package later, but for now you can just checkout the code and compile it yourself.

Code samples

Signing is very simple and consist of a one line call of the method Sign, you provide the certicate, password, signature image and its boundaries and a few optional params if needed.

using (Stream inputStream = File.Open("../../data/letter_unsigned.pdf", FileMode.Open))
     using (FixedDocument doc = new FixedDocument(inputStream))
         doc.Sign("../../data/johndoe.pfx", "password",
         new Boundary(100, 140, 190, 180), outputFileName);

And the result:

Pic. 1 Signed PDF Document
Pic. 1 Signed PDF Document

Same applies to stamping a document with a transparent watermark, just add a one-line call and voilĂ :

using (Stream inputStream = File.Open("../../data/letter_unsigned.pdf", FileMode.Open))
     using (FixedDocument doc = new FixedDocument(inputStream))
         doc.Watermark("../../data/watermarkTransparent.png", outputFileName);

The result is below:

Pic. 2 Stamped PDF document
Pic. 2 Stamped PDF document


If you need to incorporate the basic PDF processing functionality into your applications, then the open-source Apitron PDF Kit extensions library we’ve published a few weeks ago could be the right choice. It saves time keeping things simple, and you can always fallback to the main API if you need something going beyond its capabilities. 

Please let us know what you think about it or suggest new functions to implement. If you want your code to be added to the library just send us a patch for review.


Signing pdf documents with smartcards using cryptoapi or PKCS#11 cryptographic token interface

Signing with smartcards might be challenging as they usually restrict private key export and only allow signing via own custom api, integrate with existing cryptoserviceproviders (windows cryptoapi) or provide an implementation of PKCS#11 cryptographic token interface.

If you need to implement an advanced signing workflow using smart cards, we can help you on the way as our products are fully compatible and provide extensible interfaces for these purposes. Should you have any questions, just let us know and we'll be happy to help you.