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:
- 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);
-
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;
-
For C# user:
-
Select Solution Explorer from View menu to open Solution Explorer;
-
Right click Reference under the project that you wish to use EO.Pdf, select
Add Reference. The Add Reference dialog opens;
-
For Visual Basic.NET user:
-
Right click your project, then select Properties;
-
Click References tab on the left;
-
Click the drop down arrow on the Add... button below the References
list;
-
Click Reference... from the drop down menu;
-
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;
-
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.
-
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:
-
Open your project;
-
Select Solution Explorer from View menu to open Solution Explorer;
-
For C# user:
-
Expand Reference;
-
Delete EO.Pdf from the list;
-
For Visual Basic.NET user:
-
Right click your project, then select Properties;
-
Click References tab on the left;
-
Select EO.Pdf from the References list;
-
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.