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.

2017-04-30

Open source Apitron PDF Kit extensions library

Introduction



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",
                    "../../data/signatureImage.png",
         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
 

Summary



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.

No comments:

Post a Comment