Components for Developers
© 2000-2018, Two Pilots

PDF Library   EMF2PDF SDK Pilot   Virtual Printers   HTML2PDF-X Pilot   Converters   PDF Mosaic

Two Pilots blog

Archive for the ‘For software developers’ Category

Virtual Printer Driver – Embedded fonts issues

Thursday, January 25th, 2018

At the moment, there are two problems with embedded fonts:

Subsetting problem:

Most fonts are too large if they were to be entirely embedded in an output PDF file. The so-called subsetting technique allows one to make files much smaller. By subsetting, only required characters are embedded (only several glyphs instead of the full set of glyphs). Since this process is not standardized, there could be unexpected problems. For example, the POST table (that links each glyph ID to a unicode value for further creation of PDF) could be empty.

Delta font problem:

– There are three types of embedded fonts in EMF files:

– Engine font – is a normal TrueType font that could be packed via dttf table. There are no problems with such fonts.

– Subset font – is a subfont of TrueType. This font could be also packed via dttf table and there are no problems with such fonts as well.

Delta font – this is a part of a TrueType subfont. Such a font contains a set of glyphs and this font has no name. Although Microsoft writes in its documentation that this font must be combined with a subset font used previously, it doesn’t explain how to find this subset font. The solution we found at the moment requires too much RAM.

We are aware of these problems and are going to solve them, but we are not sure how long it will take us.

Please feel free to write comments.

Rounding Effect

Wednesday, July 14th, 2010

Look at the picture of the line before inexact rounding of floating points, and at the
picture after rounding:


The problem arose while converting an EMF into a PDF or while drawing an HDC-context taken from a PDF. The problem was connected to the Polyline(To) function. The function transformed an array of points with close value coordinates. Then, to draw a set of lines in a PDF, transformation of the
coordinates from HDC to PDF coordinates was necessary. For this transformation the LPtoDP function was used. But LPtoDP returns integer values. For example, this function transforms the (160, 74) and (159, 60) coordinates from EMF to (1, 1) and (1, 2) for a PDF. So a set of lines was generated as shown in the left picture. To improve the results, we have stopped using the LPtoDP function. Now Polyline(To) function gives the correct results.

Artem Golubnichenko

Layers (Optional Content Groups)

Tuesday, September 8th, 2009

Layers or as they are more formally known Optional Content Groups (OCG) is representing a collection of graphics that can be made visible or invisible dynamically by users of viewer applications. (This ca­pability is useful in items such as CAD drawings, maps, and multi-language documents) With the introduction of PDF version 1.5 came the concept of Layers. Form and image and annotations can be made optional too.


PDF Creator Project News

Tuesday, December 16th, 2008


Today I want to talk about important improvements in the current version of the PDF Creator Pilot Library.

It was always one of the weakest things about the Library – it demanded huge amounts of memory to work with larger documents. Quite often clients were not able to create a document consisting of more than 100 pages, because they did not have enough memory. In this version, we have managed to open up a bottleneck, which helped us significantly reduce memory requirements. In short, if a page contains a lot of graphics, it also contains a lot of page operation commands. Keeping all these commands in memory was the bottleneck. We cached the commands into a temporary file, and that solved the problem.


COM: The First Steps

Friday, November 7th, 2008

Let me show you the process of creating of a COM component with Visual Studio 2008 using ATL and C++.

First, let’s create a Visual C++/ATL project:


PDF Creator – about project and development process

Tuesday, October 28th, 2008

In this article I describe the organization of the PDF Creator project and the tools that we use to develop and promote the product.

Development Tools

1. Subversion (SVN) Control

The life of a programmer would be unbearable without a source control manager :-). As of this writing, we have executed 2387 commits in the PDF Creator project using the Tortoise SVN, ( Since every mistake would cost a lot, we try to follow this rule – one that we would recommend to everyone: Always commit smaller portions of the code. Every commit must correspond to a single task!

This way it is (a) easier to find an error during rollbacks (every commit changes a small amount of source code), (b) often easy to discover an error before the commit just by looking at it, and (c) easier for colleagues to be aware of the changes in the source code, since all they have to do is read the comments and look at the smaller portions of the code.

Of course, this is not possible in all cases, and sometimes we do have to perform huge commits. Still this is a rule worth following. After all, it is one of the refactoring rules: Change smaller portions of the code, preserving its workability between sessions.

Two more source-control rules:

  1. There must always be two versions in the SVN – a version that compiles and a workable version. It is easy to create code that compiles, but the real aim is its correctness.
  2. Text comments should be supplied to every commit. This is also a good way to check whether the commit implements only a single task. If a comment describes several targets instead of just one, the rule has been violaled.

2. Bug Tracker

We use Mantis ( PDF Creator is the base for a number of other products – converters, virtual printer, etc. (See The number of its users is much higher than the count of those who purchased the base product. We needed to simplify communications between the developers and the users of the products.


What you should know before deploying your .NET application that uses PDF Creator Pilot and HTML2PDF Addon to another server.

Friday, October 10th, 2008

First, you need to install PDF Creator Pilot and HTML2PDF Addon to this server.
It is not necessary to run installer programs for those products, you may register in system corresponding dll files running commands (both on x86 and x64 versions):

C:\Windows\system32\regsvr32 PDFCreatorPilot.dll
C:\Windows\system32\regsvr32 HTML2PDF.dll

Second, you need to re-create interop wrappers for these components. This can be done with standard .NET SDK utility – TlbImp.exe (C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\TlbImp.exe)

TlbImp.exe PDFCreatorPilot.dll /out:Interop.PDFCreatorPilotLib.dll
TlbImp.exe HTML2PDF.DLL /out:Interop.HTML2PDFAddOn.dll

Note: It is not necessary to regenerate wrappers directly on the server, you may do it on the developer machine and copy theese wrappers to the server.

Third, you need to place these interop wrappers into the appropriate directory on the new server. For ASP.NET it is the “bin” folder of that application. For the rest applications you need to place wrappers near the exe module (at the same folder).

Filimonov MaximDeveloper of PDF Library

COM arrays in PHP

Monday, June 9th, 2008

We don’t claim to be experts in PHP, and an educated reader might find this article to be a redundant description of evident facts. Nevertheless, we hope that this article may be of some help to somebody.

We wanted to check whether our library (this one) works well with PHP. (more…)

Using PDF Creator Pilot on ASP.NET Web Pages without Visual Studio

Thursday, March 6th, 2008

 To do work with ASP.NET, we must perform three steps:

  1. Create an Interop-wrapper
  2. Copy the wrapper into a specific folder
  3. Attach the namespace libraries to the application

To create the Interop-wrapper of PDF Creator Pilot (i.e. a wrapper that would make it possible to call unmanaged COM-object code of the library from the managed code of an ASP.NET application), we should use one of the standard utilities from the .NET SDK – TlbImp.exe (C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\TlbImp.exe)


C++ Unit Tests

Wednesday, February 6th, 2008

Hi everybody!

Here I talk about various tools that may be used to develop the unit tests with C++, in particular about those that we use in PDF Creator, and about the way we deploy it.

As PDF Creator evolved, it started to become more evident that there was a need for an easy-to-use testing procedure. The huge code base, lots of clients, quirks of the PDF format and of the library itself — these were the factors that turned every change in the code into a difficult task. Currently, every time we release a new version (actually, even more frequently), we pass the library through a set of visual tests. Some tests produce PDF files; their quality and correctness may be checked visually. Other tests convert EMF files, producing a visible result, too. There are also ASP and VB scripts among the tests. The set of the tests grows constantly, however, even when the library passes through all of them OK, there is no guarantee that all the functions of the library have been retained.


PDF Library   EMF2PDF SDK Pilot   Virtual Printers   HTML2PDF-X Pilot   Converters   PDF Mosaic


Support | Blog | Contact | About

© 2000-2018, Two Pilots