EMF to PDF Converter

PDF Creator Pilot’s EMF converter is one of the best in the world. We are working on improving our EMF converter always. EMF to PDF feature can convert EMF (Enhanced MetaFile) to PDF document file for reading with Adobe Reader and other PDF Readers. For converting EMF files you need just call method PlayMetaFile. See example “How to Convert a Metafile to a PDF Using C++“. With EMF to PDF conversion, users can encrypt PDF documents, add password, compressing, text and images, etc.

Artem Golubnichenko,
Two Pilots

News from the PDF Library Laboratory

We are working to improve the quality of pdf-files created by PDF Creator Pilot library.  Significant improvements have been made in that part of the library, which converts the emf-files in pdfs. Including:

1. Fixed bugs with incorrect positioning for right text align in EMF.
2. Added support for “brush with hatch” style in EMF.
3. Improved working with the AlphaBlend function in EMF.

The latest version of the library PDF Creator Pilot 4.3.2000 is available for download:

PDF Creator Pilot 4.3.3200
PDF Creator Pilot 4.3.3200, x64 edition

Artem Golubnichenko.

New method: ShowTextParagraph

We’re glad to introduce the new method ShowTextParagraph and it’s Unicode version – ShowUnicodeTextParagraph.

This method draws a text paragraph, this means that the library will automatically split the paragraph text to the lines to fit the page bounds, align text lines as needed and add a new PDF page if the text does not fit to the rest of the current PDF page.

Here is a sample of how to use it (Visual Basic Script):

fnt = PDF.AddFont(“Arial”, false, false, false, false, fcDefault)
PDF.UseFont fnt, 14
PDF.ShowTextParagraph x, y, paJustify, interval, marginLeft, marginTop, marginRight, marginBottom, paragr_Text

So now, for example, you may convert your favourite text book to the PDF format for your eBook reader.

Here you may find Visual Basic Script samples that convert TXT file to a PDF (ASCII and Unicode versions):

  1. install the library,
  2. download and unpack scripts,
  3. run the script,
  4. get the PDF book.

Max Filimonov,
Two Pilots Developers Team.

How to use “PDF Creator Pilot” on x64 systems with Microsoft Visual Studio.

There are two methods you can use to accomplish this in your .NET projects. Let’s suppose we have a C# project, and that “PDF Creator Pilot x64” is already installed.

Method #1

1) Open your project (or create a new one) and choose “Add Reference” in the Solution Manager (you can also do this from the main menu -> Project -> Add Reference…) and then select the “COM” tab.

2) In the component list find “PDFCreatorPilot Type Library” and press the “OK” button.

3) In the code file (*.cs) add this line:

using PDFCreatorLib;

and declare a variable somewhere in your code:

PDFDocument4 pdf = new PDFDocument4();
pdf.SetLicenseData(“demo”, “demo”);
// more code…

4) You may set project target type to “x64” or leave it as “Any CPU”.

If all is done correctly, the PDF Creator Pilot now will be available to you in your project.

In some cases developers may not be able to add a reference as shown in the example above. In that case we recommend that you manually register the COM dll (PDFCreatorPilot.dll) with an administrator’s credentials:

regsvr32 PDFCreatorPilot.dll

After this please restart the Visual Studio and try to add the reference again. If this does not help, then please use Method #2.

Method #2

1) We need to manually create an interop wrapper library for .NET from the “PDF Creator Pilot x64” COM library. Find please where the “PDFCreatorPilot.dll” (x64 version) is located and create a simple batch file with the following line:

“C:\Program Files\Microsoft SDKs\Windows\v6.xx\bin\TlbImp.exe” “full\path\to\PDFCreatorPilot.dll” /out:”Interop.PDFCreatorPilotLib.dll” /namespace:PDFCreatorLib /machine:X64

2) Launch this file. This will produce the “Interop.PDFCreatorPilotLib.dll” file which is an interop library for the COM dll.

Note: the TlbImp.exe is a standard Windows SDK utility. If you do not have it on your machine,  please install the Windows SDK from the Microsoft website: http://www.microsoft.com/downloads/details.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b&displaylang=en

3) Open your project (or create a new one) and choose “Add Reference” in the Solution Manager (you can also do this from the main menu -> Project -> Add Reference…) and select the “Browse” tab. In the file list find “Interop.PDFCreatorPilotLib.dll” created in the previous step and press the “OK” button.

4) In the code file (*.cs) add this line:

using PDFCreatorLib;
/* PDFCreatorLib is a namespace you’ve specified as a parameter for TlbImp.exe. */

and declare a variable somewhere in your code:

PDFDocument4 pdf = new PDFDocument4();
pdf.SetLicenseData(“demo”, “demo”);
// more code…

5) You may set the project target type to “x64” or leave it as “Any CPU”.

If all is done correctly, the PDF Creator Pilot now will be available to you in your project.

You may download the sample project here. This project contains a manually created interop DLL, and a C# project that refers this interop.

Max Filimonov,
Two Pilots Developers Team.

Merge and Split PDFs with PDF Creator Pilot

Do you need to split or merge PDF files and reorganize pages in your PDF documents? If yes, then PDF Creator Pilot library can help you do this. PDF Creator Pilot allows you to not only split, merge, and reorganize pages in your PDFs, but also to create tree-like outlines (bookmarks), annotations, watermarks, thumbnails, and interactive AcroForm elements for your PDF documents.

PDF Library has the following methods for splitting, merging, and reorganizing pages:

  • Append – This method appends the contents of a previously saved PDF file (not a BLOB) to a newly created (or opened) PDF document.
  • Open – This method opens an existing PDF document, then reads and parses its contents.
  • AddPage – This method creates a new PDF page, appending it to the end of the PDF document. It does not set the new page as current.
  • DeletePage – This method removes the specified page from a PDF document.

With the help of PDF Creator Pilot, you can easily and quickly manage your PDFs, reduce the size of PDF files, and quickly combine a group of files using the merge feature.

Artem Golubnichenko

DjVu Converter

The electronic DjVu format is becoming more and more popular. It is intended for storage of scanned documents (forms, electronic books and so on). DjVu is positioned as an alternative to the PDF format. An advantage of DjVu is the lighter size of the DjVu files in comparison to PDF file sizes.
Two Pilots has released a new freeware product for creating DjVu documents. DjVu Printer Pilot is an application based on a virtual printer. After installation of the program, the <DjVu Printer Pilot> virtual printer will be installed in your system. Now you can “print to” this printer any document you wish to be converted into DjVu. While printing, the document is automatically opened  in the DjVu Printer Pilot window. From here you can save the converted DjVu document or combine it with another document created earlier.
For DjVu creation, the DjVuLibre free library is used.

Artem Golubnichenko

Rounding Effect

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

PDF/A is a format for long-term preservation

PDF/A is a electronic document file format for long-term preservation. Standards to address the growing need to maintain information in electronic documents over archival time spans. The feature-rich nature of PDF can create difficulties in preserving information over the long-term, and some useful features of the PDF file format are incompatible with the demands of long-term preservation. For example, PDF documents are not necessarily self-contained, drawing on system fonts and other content stored external to the original file. As time passes, and especially as technology changes, these external connections can be broken, and the dependencies cause information to be lost.
The PDF/A-1 standard is based on Adobe’s PDF Reference 1.4, and specifies how to use a subset of PDF components to develop software that creates, renders and otherwise process a flavor of PDF that is more suitable for archival preservation than traditional PDF. PDF/A-1 aims to preserve the static visual appearance of electronic documents over time and also aims to support future access and future migration needs by providing frameworks for: 1) embedding metadata about electronic documents, and 2) defining the logical structure and semantic properties of electronic documents. The result is a file format, based on PDF 1.4 that is more suitable for long term preservation.
PDF/A-1 files must include:

* Embedded fonts
* Device-independent color
* XMP metadata

The PDF Creator Pilot has property gets or sets the value indicating whether to produce a PDF/A compatible output file. There is ProducePDFA. Setting ProducePDFA to VARIANT_TRUE means that the output PDF file will be built compatible to the PDF/A standard. You should set this property before any text or graphics output.
If you need long-term preservation documents, use the PDF/A docs. With PDF Creator Pilot you can create such documents easy.

Artem Golubnichenko

New PDF to Image Converter from Two Pilots Company

In the area of circulation of electronic documents, often we need to modify PDF documents into PNG or multipage TIFF images. Two Pilots, has just released a new converter called PDF2Image Pilot, a program for converting PDF files into high-quality BMP, EMF, GIF, JPEG, PNG, or TIFF images. (Multipage TIFF is supported as well.)

The PDF to Image converter is based on PDF Rasterization Pilot. PDF Rasterization Pilot is a library for developers. Using this tool, developers can add to their products such features as export PDF to graphic format and output PDF to a device context (display or printer).

The new PDF2Image Pilot uses only PDF Rasterization Pilot for saving PDF into graphic files and outputting PDF content to a preview window. In PDF2Image Pilot, we tried to connect the features of the PDF Rasterization library and our many years experience in the development of easy and useful interfaces. We hope that PDF2Image converter helps you to solve your tasks. We await your responses and proposals!

Artem Golubnichenko

Layers (Optional Content Groups)

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.

Continue reading