Site Map | About Us | Contact Us  
 The same content in Microsoft HTML help file format is included in the download package.

Project Setup

Overview

This section contains information about how to setup your project to use EO.Pdf library and details about each EO.Pdf namespace.

Add Referece to EO.Pdf.dll

Before you can use EO.Pdf in your project, you must reference EO.Pdf.dll.

Follow these steps to add the reference:

  1. Download and install EO.Pdf from http://www.essentialobjects.com/Download.aspx if you have not already done so. Note that you only need to install it on your own development machine (no need to install on your customers' machines or production servers);
  2. Open the project you wish to use EO.Pdf with Visual Studio. The following steps are based on Visual Studio and Windows Form project. If you use another development tool rather than Visual Studio, or use EO.Pdf with another project type (for example, an ASP.NET Web project), then the actual steps can be different. However the basic tasks and ideas are the same;
  3. For C# user:

    1. Select Solution Explorer from View menu to open Solution Explorer;
    2. Right click Reference under the project that you wish to use EO.Pdf, select Add Reference. The Add Reference dialog opens;
  4. For Visual Basic.NET user:

    1. Right click your project, then select Properties;
    2. Click References tab on the left;
    3. Click the drop down arrow on the Add... button below the References list;
    4. Click Reference... from the drop down menu;
  5. Click Browse tab, then browse for EO.Pdf.dll ( the default installation location is "c:\Program Files\Essential Objects\EO.Pdf xxxx" on 32 bit Windows and "c:\Program Files (x86)\Essential Objects\EO.Pdf xxxx" on 64 bit Windows, where "XXXX" is the version number), then click OK;
  6. Alternatively, you can also add EO.Pdf.dll to GAC, then click .NET tab, select EO.Pdf from the list, then click OK to reference the DLL from GAC.

    To add EO.Pdf.dll to GAC, click Start -> All Programs -> EO.Pdf xxxx -> Add EO.Pdf to GAC, where "xxxx" is the version number. You can also add the DLL to GAC manually following this MSDN article (search for "How to: Install an Assembly into the Global Assembly Cache" online if the link is no longer valid).

    Adding EO.Pdf.dll into GAC and then reference the DLL from GAC is often necessary if you wish to use EO.Pdf on a remote Web project.

  7. Now you can start using EO.Pdf classes in your code.

Upgrade from an older version

If you upgrade to a newer version of EO.Pdf library, you may need to manually delete the reference to the old DLL and then add the reference to the new one. The steps to add reference is the same as above in this case. Follow these steps to delete the reference:

  1. Open your project;
  2. Select Solution Explorer from View menu to open Solution Explorer;
  3. For C# user:

    1. Expand Reference;
    2. Delete EO.Pdf from the list;
  4. For Visual Basic.NET user:

    1. Right click your project, then select Properties;
    2. Click References tab on the left;
    3. Select EO.Pdf from the References list;
    4. Click Remove to delete the reference;

Once the reference to the old DLL is deleted, you can follow the initial setup steps to add a reference to the new DLL.

EO.Pdf Namespaces

In order to use EO.Pdf classes, you must import one or more EO.Pdf namespaces in your code:

[C#]
//System.Drawing is needed to use color, font, point, etc.
//Because this is a system namespace, you may already have
//imported this namespace. In that case you should not
//import it again
using System.Drawing;

//This is usually the only namespace needed if you only use
//HTML to PDF
using EO.Pdf;

//This is the main namespace you will need in order to use
//ACM (Abstract Content Model) 
using EO.Pdf.Acm;

//The following two namespaces are only needed if you use
//low-level content API
using EO.Pdf.Drawing;
using EO.Pdf.Contents;  
        
[Visual Basic.NET]
'System.Drawing is needed to use color, font, point, etc.
'Because this is a system namespace, you may already have
'imported this namespace. In that case you should not
'import it again
Imports System.Drawing

'This is usually the only namespace needed if you only use
'HTML to PDF
Imports EO.Pdf

'This is the main namespace you will need in order to use
'ACM (Abstract Content Model)
Imports EO.Pdf.Acm

'The following two namespaces are only needed if you use
'low-level content API
Imports EO.Pdf.Drawing
Imports EO.Pdf.Contents
        

EO.Pdf provides the following namespaces:

EO.Pdf

Contains classes that represents basic PDF objects, such as PDF document, page, bookmarks, etc. You would always need to import this namespace.

This namespace also contains the HtmlToPdf class, which is the main class to perform HTML to PDF conversions.

EO.Pdf.Acm

This namespace contains classes related to ACM (Abstract Content Model). PDF is a high-fidelity document format. A PDF file encapsulates complete description of fixed-layout pages as they would appear on an output device. For example, a paragraph that contains multiple line of text would appears as a serial of "text out" commands in the PDF file, each outputs a text string starting at a specific position. In order to generate these commands, one must calculate the length of each word, break them into multiple lines and calculate each line's position. ACM frees programmers from such tasks by allowing programmers to define the document content such as Paragraph, Image, Links, etc, then format them into the final fixed layout page description commands as required by PDF. Because this is the easiest way to create a PDF file, you would almost always need to import this namespace.

EO.Pdf.Drawing

This namespace contains classes related to graphics objects such as font, color and path. Import this namespace if you need to change font style and color or work with path directly.

EO.Pdf.Contents

This namespace contains content classes related to low-level content API. Low-level content API allows you to directly place formatted contents on the output page and can be used to implement "out of flow" contents such as page header and watermarks.


Direct link to this topic