If you need a PDF .NET component
providing easy-to-use and clean API then it’s time to take a look at the Apitron PDF Kit for .NET. This
product is designed to help you on a way with creation, manipulation, and all
kind of processing related to PDF documents. These files can be of different
origin: created using all possible versions of the PDF specification and various
optimization techniques, e.g. linearized or tagged PDFs. They can also be password-protected or digitally
signed, so simply speaking - everything
created according to PDF specification can be processed using our component.
Apitron PDF Kit for .NET is a fully
managed .NET library that supports literally all features defined for PDF by Adobe,
assemblies are available for any .NET framework version starting from 2.0 and
it also works on Mono and Xamarin. Xamarin Studio +
Apitron PDF Kit can be used to create PDF processing apps running on OS X for
example. Futhermore it's possible to create apps for iOS and Android using Xamarin.iOS and Xamarin.Android. Files created using this component can be viewed on all platforms and
devices where a decent PDF viewer exists (and furthermore we have own viewer and rasterizer components as
well).
Using this component you’ll be able to:
- Extract, modify and
add graphics (text, images, drawings)
- Split or merge PDF
documents
- Fill or create PDF
forms
- Add or remove
document fields
- Examine resources
within a document - fonts, embedded files
- Digitally sign and
check existing signatures on PDF documents
- Search for specific
text
- Protect document with
a password, edit its permissions
- Work with navigation
objects, e.g. create bookmarks or links
- Control viewer
settings for PDF file
- Use full support for
annotations
- Use full support for
PDF actions
- Use all fonts defined
by specification
- Use various supported
colorspaces and color profiles, e.g. you may draw in RGB, CMYK, gray, or
whatever colorspace you like.
- Save files to other
“subtypes” of PDF – Linearized or PDF/a for example. If you require a specific
functionality and are unsure about whether it is supported, please review our
online help you contact support so we'll be able to handle this.
- Use Fixed layout API,
implemented to be 100% PDF specification compatible, it unlocks full power of
the PDF for you. Any complex PDF creation or manipulation task can be completed
instantly.
- Use Flow layout API,
a styles-driven content generation API similar to HTML+CSS provides you with
ability to create stunning documents, reports, bills, catalogs and more in
minutes. Compact and easy to use, supports creation of XML templates and much
more.
- Create cross-platform PDF processing apps targeting Windows, iOS, Android, OS X and other systems .NET/MONO implementation exists for.
This
list is rather incomplete but it gives an idea of component's capabilities. It’s
also worth mentioning that we provide first-class support and response within
24h is guaranteed.
Component’s
package contains many beautiful samples for both Fixed and Flow layout APIs and
can be downloaded here. There are samples showing how to sign
the document, draw something on PDF page, generate simple report using grid,
set document password and more. Whenever you have a need, all developer guides
and component's documentation are available online
on our website.
Below
I’m going to show you a simple “Hello world” PDF creation sample:
The
code
/// <summary>
/// "Hello World" PDF generation sample, flow
layout.
/// </summary>
class Program
{
static void Main(string[] args)
{
ResourceManager resourceManager = new ResourceManager();
//
create document and set margin
FlowDocument document = new FlowDocument() { Margin = new Thickness(5)};
document.Add(new TextBlock("Hello world with Apitron PDF Kit for .NET!") { Font = new Font(StandardFonts.Helvetica,20)});
string fileName = "HelloWorld.pdf";
// save
and open
using (Stream stream = File.Create(fileName))
{
document.Write(stream,
resourceManager, new PageBoundary(Boundaries.A4));
}
Process.Start(fileName);
}
}
Result
|
Generated "Hello world" PDF |
Similar sample demonstrating Fixed layout API
The code
/// <summary>
/// This sample shows how to draw a simple rect on PDF page.
/// </summary>
class Program
{
private static void Main(string[] args)
{
string fileName = "rectangle.pdf";
// open
and load the file
using (FileStream fs = new FileStream(fileName, FileMode.Create))
{
// this
object represents a fixed PDF document
FixedDocument document = new FixedDocument();
Page page = new Page(new PageBoundary(Boundaries.A4));
//
create colorspace resource
string rgbID = "CS_RGB";
document.ResourceManager.RegisterResource(new RgbColorSpace(rgbID));
// set
fill color
page.Content.SetNonStrokingColorSpace(rgbID);
page.Content.SetNonStrokingColor(0.33, 0.66, 0.33);
//
define the rectangle
FixedLayout.Content.Path path = new FixedLayout.Content.Path();
path.AppendRectangle(200, 300, 200,
200);
page.Content.FillAndStrokePath(path);
// add
page to the document and save
document.Pages.Add(page);
document.Save(fs);
}
//
preview document
Process.Start(fileName);
}
}
Result
|
Generated PDF |
We’ll continue to cover our API by providing more
samples in upcoming posts, stay tuned! Lots of samples are available already in our download package. Should you have any questions just let
us know and we’ll be happy to help you.