Professional Documents
Culture Documents
3-Heights
PDF Printer API
Version 4.7
Contents
1
1.1
1.2
1.2.1
1.2.2
1.2.3
1.3
1.4
1.5
1.6
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operating Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Compatibility Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How to Best Read this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
6
6
6
7
7
7
7
8
8
2
2.1
2.2
2.2.1
2.2.2
2.3
2.3.1
2.3.2
2.3.3
2.3.4
2.4
2.5
2.6
2.6.1
2.6.2
2.6.3
9
9
10
11
13
14
14
14
15
15
15
15
15
15
16
16
3
3.1
3.1.1
3.1.2
3.1.3
3.1.4
3.2
3.3
3.3.1
License Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Graphical License Manager Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
List all installed license keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Add and delete license keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Display the properties of a license . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Select between different license keys for a single product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Command Line License Manager Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
License Key Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
17
17
17
17
17
18
18
18
4
4.1
4.2
4.3
4.3.1
4.3.2
4.3.3
Programming Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Visual Basic 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ASP - VBScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Visual Basic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Simplified description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Troubleshooting: TypeInitializationException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Troubleshooting: DllNotFoundException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Troubleshooting: BadImageFormatException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
19
19
20
20
22
22
22
22
23
23
23
4.3.4
5
5.1
5.1.1
5.1.2
5.2
5.3
5.4
5.5
5.5.1
5.5.2
5.5.3
5.6
5.7
5.8
5.9
5.10
5.11
5.12
5.13
5.14
5.15
5.15.1
5.15.2
5.15.3
5.16
5.17
5.17.1
5.17.2
5.18
5.18.1
5.18.2
Users Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Same Document to Multiple Printers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Multiple Documents to same printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Multiple print jobs to same printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
One document to one printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Print a Document Using PrintFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Print Documents Using PrintPage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
List and Open Printers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Start a Print Job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What Is a Print Job? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What Are Linked Print Jobs? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Open a PDF Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Print a Particular Page of a Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
List and Select the Paper Bin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Duplex Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Set the Paper Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Get Page Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Place a Watermark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How to use the Device Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How to use the Property Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Internet Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Retrieve the Printer Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Set up the Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Connect to a Printer via HTTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating a COM+ Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Color Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Default Color Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Get Other Color Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Font Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Font Configuration File fonts.ini . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24
24
24
24
25
25
26
26
26
27
28
29
29
29
29
30
30
31
32
32
32
33
34
35
35
36
37
37
37
38
39
39
39
39
39
6
6.1
6.1.1
6.1.2
6.1.3
6.1.4
6.1.5
6.1.6
6.1.7
6.1.8
6.1.9
6.1.10
6.1.11
6.1.12
6.1.13
6.1.14
Programmers Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Printer Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AbortDocument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AddWatermarkImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AddWatermarkText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Bandsize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
BeginDocument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
BeginGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ClosePrinter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Collate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CopyMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DataType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
41
41
41
42
42
43
43
43
44
44
44
44
45
45
45
6.1.15
6.1.16
6.1.17
6.1.18
6.1.19
6.1.20
6.1.21
6.1.22
6.1.23
6.1.24
6.1.25
6.1.26
6.1.27
6.1.28
6.1.29
6.1.30
6.1.31
6.1.32
6.1.33
6.1.34
6.1.35
6.1.36
6.1.37
6.1.38
6.1.39
6.1.40
6.1.41
6.1.42
6.1.43
6.1.44
6.1.45
6.1.46
6.1.47
6.1.48
6.1.49
6.1.50
6.1.51
6.1.52
6.1.53
6.1.54
6.1.55
6.1.56
6.1.57
6.1.58
6.1.59
6.1.60
6.1.61
6.1.62
6.1.63
6.1.64
6.1.65
6.1.66
DC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DefaultSource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DeleteWatermarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DevMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Duplex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
EditDevMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
EmptyPage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
EndDocument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
EndGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ErrorCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Escape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
FitPage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetBin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetBinCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetDefaultPrinter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetDuplexMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetDuplexModeCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetErrorText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ErrorMessage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetMediaType2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetMediaTypeCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetMediaTypeName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetPageDimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PageWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PageHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetPaper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetPaperCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetPrinter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetPrinterCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
HANDLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
JobId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
LicenseIsValid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MaxPaper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MediaType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MinLineWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
OffsetX, OffsetY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
OMR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
OpenMem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
OpenPrinter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PageCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PageNo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PaperSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PJL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PrintFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PrintPage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PrintQuality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RenderingMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
46
46
46
46
47
47
47
48
48
49
49
49
49
50
50
51
51
51
51
52
52
52
52
53
53
53
54
54
54
55
55
55
55
56
56
56
57
57
57
58
58
59
59
59
59
60
60
60
61
61
62
62
6.1.67
6.1.68
6.1.69
6.1.70
6.1.71
6.1.72
6.1.73
6.1.74
6.1.75
6.1.76
6.1.77
6.1.78
6.1.79
6.1.80
6.1.81
6.1.82
6.1.83
6.1.84
6.1.85
6.1.86
6.2
6.2.1
6.2.2
6.2.3
6.2.4
TPDFErrorCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TPDFRendererOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TPDFRenderingMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TPDFRotateMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
62
63
63
63
64
64
64
65
65
65
66
66
66
66
66
66
67
67
67
67
67
68
68
71
71
7.5.2
7.6
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
No Ouput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Blank Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Duplex Mode Is Not Listed or Does Not Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Page Does Not Fit the Paper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Printer Settings or Device Mode Ignored . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Black is Not Printed Completely Black . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Spool File Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Rendering Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Printer Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PostScript Injection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Multiple Copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Printing in a Network Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Multithreaded Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Font and Text Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Handle Non-Embedded Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Font Replacement Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Handle Embedded Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Unsupported PDF Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
73
73
73
73
73
74
74
74
75
75
75
75
75
76
76
76
77
77
77
77
78
78
7
7.1
7.1.1
7.1.2
7.1.3
7.1.4
7.1.5
7.1.6
7.1.7
7.2
7.2.1
7.2.2
7.2.3
7.2.4
7.2.5
7.3
7.4
7.5
7.5.1
ReportingLevel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RotateMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ScaleXY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetCMSEngine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetLicenseKey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetPaperList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ShrinkPage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SizeX, SizeY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WaitForJobCompletion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WatermarkAngle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WatermarkBold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WatermarkColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WatermarkFileName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WatermarkFontName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WatermarkFontSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WatermarkItalic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WatermarkOutline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WatermarkScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WatermarkText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WatermarkXPos, WatermarkYPos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Enumeration
.......................................................................
A
A.1
A.2
A.3
Default Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Duplex Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Paper Bins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Paper Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
80
80
80
80
1 Introduction
1.1 Description
The 3-Heights PDF Printer API is an efficient and practical solution for automated (background-) printing of PDF
documents on all Windows printers including PostScript, PCL and on virtual printers. A variety of options are available for printer control.
The tool is characterized first and foremost by its high level of performance and is extremely adaptable to specific
requirements. It also supports PDF/A-compliant printing.
PDF Printer
Group of
Files
Parameters, Watermarks
Port
Monitors
Printer Drivers
EMF
TIFF, JPEG,
etc.
Renderer
PDF, PDF/A
Windows GDI
Spooler
PS Printer
PCL Printer
PCL-, PS-,
RAW-Files
1.2 Functions
The 3-Heights PDF Printer API translates PDF, PDF/A, TIFF and JPEG into the language of a printer driver such as
PostScript or PCL. Documents are either printed on a physical printer (local, remote or via Internet) or issued as a
file. The tool offers a variety of printer control options such as paper tray, paper format, duplex printing, stapling,
merging multiple pages to form a single print job, and applying watermarks in the form of (personalized) texts and
images. It is also possible to query the properties of the target printer (print margins, resolution, etc.) and to optimize printing accordingly. In addition to all current printer models the tool supports older printers via emulation.
The printer supports CITRIX virtual printer drivers.
1.2.1 Features
Print PDF documents
Print to file (e.g. PostScript, PCL)
PDF Tools AG Premium PDF Technology
1.2.2 Formats
Input Formats:
PDF 1.0 to 1.7
PDF/A-1, PDF/A-2, PDF/A-3
BMP
GIF
JBIG2
JPEG
JPEG2000, JPEG-LS
PBM
PNG
TIFF
Output Formats:
Print spool formats, such as PostScript, PCL 5, PCL 6, AFP
1.2.3 Compliance
Standards:
ISO 19005-1 (PDF/A-1)
ISO 19005-2 (PDF/A-2)
ISO 32000-1 (PDF 1.7),
TIFF V6
1.3 Interfaces
The following interfaces are available:
C
Java
.NET
COM
Read the chapter Introduction to verify this product meets your requirements.
Identify what interface your programming language uses.
Read and follow the instructions in the chapter Installation and Deployment
In the chapter Programming Interfaces find your programming language. Please note that not every language
is covered in this manual.
For many programming languages there is sample code available. For a start it is generally best to refer to these
samples rather than writing code from scratch.
5. (Optional) Read the chapter Users Guide for general information about the API. Read the Programmers Reference for specific information about the functions of the API.
There are 32 and 64 bit versions available. The 32 bit version runs on both, 32 and 64 bit platforms. However, it is
strongly recommended to use the 64 bit version on a 64 bit platform. This avoids all problems with the thunking
process that translates between the 32 bit application and the 64 bit printer drivers.
There is a zipped MSI (*MSI.zip) and a ZIP (*.zip) version available. The MSI (Microsoft Installer) provides
an installation routine that installs and uninstalls the product for you. The ZIP version allows you to select and
install everything individually.
Download the version you wish to install.
3. If you select an MSI version, extract the MSI, start it and follow the steps in the installation routine. No further
steps are needed.
If you are using the ZIP version, follow the steps below.
4. Open the ZIP archive. Check the appropriate option to preserve file paths (folder names) and unzip the archive
to a local folder (e.g. C:\Program Files\PDF Tools AG\).
5. The unzip process now creates the following subdirectories:
Subdirectory
Description
bin
Contains the runtime executable binary code and the .NET assemblies
bin\Fonts
doc
6. Ensure the two system environment variable TMP exist and point to an existing directory. This directory is required to temporarily install fonts that are embedded in PDF documents.
Control Panel System Advanced Environment Variables
7. Identify which interface you are using. Perform the specific installation steps for that interface described in
chapter Interface Specific Installation Steps
8. Make sure your platform meets the requirements regarding color spaces and fonts described in chapters Color
Profiles and Fonts respectively.
2.2 Interfaces
The 3-Heights PDF Printer API provides four different interfaces. The installation and deployment of the software
depend on the interface you are using. The table below shows the supported interfaces and examples with which
programming languages they can be used.
Interface
Programming Languages
.NET
The MS software platform .NET can be used with any .NET capable programming language such
as:
C#
VB .NET
J#
others
This interface is available in the Windows version only.
Java
COM
The component object model (COM) interface can be used with any COM-capable programming
language, such as:
MS Visual Basic
MS Office Products such as Access or Excel (VBA)
C++
VBScript
others
This interface is available in the Windows version only.
2.2.1 Development
The software developer kit (SDK) contains all files that are used for developing the software. The role of each file with
respect to the four different interfaces is shown in table Files for Development. The files are split in four categories:
Req.
Opt. This file is optional. See also table File Description to identify which files are required for your application.
Doc.
Empty field An empty field indicates this file is not used at all for this particular interface.
Files for Development
Name
.NET
Java
COM
bin\PdfPrintAPI.dll
Req.
Req.
Req.
Req.
bin\Inet.dll
Opt.
Opt.
Opt.
Opt.
bin\*NET.dll
Req.
bin\*NET.xml
Doc.
bin\Fonts\fonts.ini
Opt.
Opt.
Opt.
Opt.
bin\Fonts\*.ttf
Opt.
Opt.
Opt.
Opt.
bin\Icc\*.*
Opt.
Opt.
Opt.
Opt.
doc\*.pdf
Doc.
Doc.
Doc.
Doc.
Doc.
doc\PrinterOCX.idl
Doc.
doc\javadoc\*.*
include\printer_c.h
Req.
include\*.*
Opt.
Req.
jar\PRNA.jar
Req.
lib\PdfPrint.lib
Doc.
samples\*.*
Doc.
Doc.
Doc.
The purpose of the most important distributed files of is described in table File Description.
File Description
Name
Description
bin\PdfPrintAPI.dll
bin\Inet.dll
This DLL implements https: and ftp: connections using the Internet Explorer. It
is loaded from module path.
bin\*NET.dll
The .NET assemblies are required when using the .NET interface. The files
bin\*NET.xml contain the corresponding XML documentation for MS Visual
Studio.
bin\Fonts\fonts.ini
This configuration file allows for specifying substitution fonts (see Fonts).
bin\Fonts\*.ttf
The font ZapfDingbats (see Fonts). ZapfDingbats is one of the 14 PDF Standard
Fonts and used in many PDF documents.
bin\Icc\*
Color profiles or links to websites that offer color profiles to download. Color
profiles are optional. See also chapter Color Profiles.
doc\*.*
Various documentations.
include\*.*
File Description
lib\PdfPrint.lib
jar\PRNA.jar
samples\*.*
2.2.2 Deployment
For the deployment of the software only a subset of the files are required. Which files are required (Req.), optional
(Opt.) or not used (empty field) for the four different interfaces is shown in the table below.
Files for Deployment
Name
.NET
Java
COM
bin\PdfPrintAPI.dll
Req.
Req.
Req.
Req.
bin\Inet.dll
Opt.
Opt.
Opt.
Opt.
bin\*NET.dll
Req.
bin\Fonts\*.ttf
Opt.
Opt.
Opt.
Opt.
bin\Fonts\fonts.ini
Opt.
Opt.
Opt.
Opt.
bin\Icc\*
Opt.
Opt.
Opt.
Opt.
jar\PRNA.jar
Req.
Identify the required files from your developed application (this may also include color profiles).
Identify all files that are required by your developed application.
Include all these files into an installation routine such as an MSI file or simple batch script.
Perform any interface-specific actions (e.g. registering when using the COM interface).
Example: This is a very simple example of how a COM application written in Visual Basic 6 could be deployed.
1. The developed and compiled application consists of the file print.exe. Color profiles are not used.
2. The application uses the COM interface and is distributed on Windows only.
The main DLL PdfPrintAPI.dll must be distributed.
The application supports https connections, therefore Inet.dll is distributed.
All documents used by the application have their fonts embedded (e.g. because they are compliant to
PDF/A), therefore the font related files are not distributed.
3. All files are copied to the target location using a batch script. This script contains the following commands:
regsvr32 /s %targetlocation%\PdfPrintAPI.dll.
For execution Additionally the library PdfPrintAPI.dll needs be in one of the systems library directories3 or
added to the Java system property java.library.path. This can be achieved by either adding it dynamically at
program startup before using the API, or by specifying it using the switch -Djava.library.path when starting
the Java VM.
-Djava.library.path=C:\pdf-tools\bin sample
PdfPrintAPI.dll is not a .NET assembly, but a native DLL. It is not to be added as a reference in the project.
The native DLL PdfPrintAPI.dll is called by the .NET assembly PdfPrintNET.dll.
PdfPrintAPI.dll must be found at execution time by the Windows operating system. The common way to do
this is adding PdfPrintAPI.dll as an existing item to the project and set its property Copy to output directory
to Copy if newer.
Alternatively the directory where PdfPrintAPI.dll resides can be added to the environment variable %Path%
or it can simply be copied manually to the output directory.
2.3.4 C Interface
The header file pdfprint_c.h needs to be included in the C/C++ program.
The library PdfPrint.lib needs to be linked to the project.
The dynamic link library PdfPrintAPI.dll needs to be in a path of executables (e.g. on the environment
variable %PATH%).
Windows
1.
2.
3.
4.
3 License Management
There are three possibilities to pass the license key to the application:
1. The license key is installed using the GUI tool (graphical user interface). This is the easiest way if the licenses are
managed manually. It is only available on Windows.
2. The license key is installed using the shell tool. This is the preferred solution for all non-Windows systems and
for automated license management.
3. The license key is passed to the application at run-time via the SetLicenseKey method. This is the preferred
solution for OEM scenarios.
licmgr
licmgr list
The currently active license for a specific product is marked with a star * on the left side.
Add and delete license keys:
Install new license key:
3.3.1 Windows
The license keys are stored in the registry:
HKLM\Software\PDF Tools AG (for all users)
HKCU\Software\PDF Tools AG (for the current user)
4 Programming Interfaces
4.1 Visual Basic 6
After installing the 3-Heights PDF Printer API and registering the COM interface (see chapter Windows), you find a
Visual Basic 6 example print.vbp in the directory samples/VB/. You can either use this sample as a base for
an application, or you can start from scratch.
If you start from scratch, here is a quick start guide for you:
1. First create a new Standard-Exe Visual Basic 6 project. Then include the 3-Heights PDF Printer API component
to your project.
Example:
"<p>"
"Default printer: " & pdfPrint.GetDefaultPrinter & "<br>"
"Printer count: " & pdfPrint.GetPrinterCount & "<br>"
"</p>"
4.3 .NET
There should be at least one .NET sample for MS Visual Studio available in the ZIP archive of the Windows version
of the 3-Heights PDF Printer API. The easiest for a quick start is to refer to this sample.
In order to create a new project from scratch, do the following steps:
1. Start Visual Studio and create a new C# or VB project.
2. Add references to the .NET assemblies.
To do so, in the Solution Explorer right-click your project and select Add Reference. . .. The Add Reference
dialog will appear. In the tab Browse, browse for the .NET assemblies libpdfNET.dll, RendererNET.dll,
and PdfPrintNET.dll.
3. Import namespaces (Note: This step is optional, but useful.)
4. Write your code.
Steps 3 and 4 are shown separately for C# and Visual Basic.
4.3.2 C#
3. Add the following namespaces:
Example:
using Pdftools.Pdf;
using Pdftools.PdfRenderer;
using Pdftools.PdfPrint;
4. The .NET interface can now be used as shown below:
Example:
4.3.3 Deployment
This is a guideline on how to distribute a .NET project that uses the 3-Heights PDF Printer API.
Detailed description
1. The project must be compiled using Microsoft Visual Studio. Hereby it is cruciual that the solution platform (x86
or x64) matches the platform of the native DLL PdfPrint.dll.
2. The executable is created in the directory bin\Release.
3. For deployment, the executable and all .NET assemblies must be copied into the same folder on the target
computer. The .NET assemblies of the 3-Heights PDF Printer API have the file name *NET.dll.
4. At runtime, the native DLL PdfPrint.dll must be found on the target computer by the DLL search sequence.
To ensure this, the DLL must either be copied to the folder containing the executable or to a directory on the
environment variable Path (e.g. %SystemRoot%\system32).
5. If required by the application, optional DLLs must be copied to the same folder. See Deployment for a list and
description of optional DLLs.
Simplified description
1. Compile the project using Microsoft Visual Studio.
2. Deploy your executable and all files in the directory bin of the 3-Heights PDF Printer APIs installation directory
to the same directory on the target computer.
PDF Tools AG Premium PDF Technology
System.DllNotFoundException Unable to load DLL PdfPrintAPI.dll: The specified module could not
be found.
Troubleshooting: DllNotFoundException
This means, that the native DLL PdfPrintAPI.dll could not be found at execution time.
Resolve this by either:
adding PdfPrintAPI.dll as an existing item to your project and set its property Copy to output directory
to Copy if newer, or
adding the directory where PdfPrintAPI.dll resides to the environment variable %Path%, or
copying PdfPrintAPI.dll to the output directory of your project.
Troubleshooting: BadImageFormatException
The exception means, that the native DLL PdfPrintAPI.dll has the wrong bitness (i.e. platform 32 vs. 64 bit).
There are two versions of PdfPrintAPI.dll available: one is 32-bit (name of product kit download contains
WIN32) and the other 64-bit (name of download contains X64). It is crucial, that the platform of the native DLL
matches the platform of the applications process.
The platform of the applications process is defined by the projects platform configuration for which there are 3 possibilities:
AnyCPU This means, that the application will run as a 32-bit process on 32-bit Windows and as 64-bit process
on 64-bit Windows. When using AnyCPU one has to use a different native DLL, depending on the platform of
Windows. This can be ensured either when installing the application (by installing the matching native DLL)
or at application start-up (by determining the applications platform and ensuring the matching native DLL is
loaded).
x86 This means, that the application will always run as 32-bit process, regardless of the platform of the Windows
installation. The 32-bit DLL runs on all systems, which makes this the simplest configuration. Hence, if an application needs to be portable and does not require any specific 64-bit features, it is recommended to use this
setting.
x64 This means, that the application will always run as 64-bit process. As a consequence the application will not
run on a 32-bit Windows system.
5 Users Guide
This chapter explains how most standard procedures of the 3-Heights PDF Printer API work. Most samples are all
in Visual Basic, but the functionality and calling sequence is similar for other languages such as Java, C, or C#.
5.1 Basics
5.1.1 Printing
The 3-Heights PDF Printer API provides a series of functions to create print jobs. Some of these functions reflect
the native Windows calls used for printing. Others are calls to link print jobs, or to simply print a page. Most of these
functions come in pairs and are also to be used in pairs.
Open, Close
OpenPrinter, ClosePrinter
BeginDocument, EndDocument
BeginGroup, EndGroup
These calls are optional. They mark the beginning and end of series of
linked jobs, i.e. all print jobs started within the same group are printed
consecutively, and without begin interrupted by other print jobs (e.g.
from other printing applications). Do note, that only documents that
are printed onto the same printer may be within one group.
PrintPage
The above functions can be used in a very flexible way as we will see the upcoming examples.
Open("C:\mydocument.pdf")
OpenPrinter("HP LaserJet 4250 PS")
BeginDocument("my print job")
' = Name that shows up in Spooler
PrintPage(1)
EndDocument
ClosePrinter
OpenPrinter("Canon iR2200-3300 PCL6")
BeginDocument("my print job")
PDF Tools AG Premium PDF Technology
PrintPage(2)
PrintPage(3)
EndDocument
ClosePrinter
Close
For n = 1 to PageCount
PrintPage(n)
Next n
As we have seen there are various ways how these calls can be combined. The only limitations are:
Calls should be used in pairs. Every Open/Begin call must have its corresponding Close/End call. Even though
a call to Open first closes an open document, we suggest to use the pairs properly.
BeginDocument must always be used after OpenPrinter, since a print job requires a printer to be specified.
5.1.2 Settings
To set properties such as duplex/simplex mode, bin, paper size or to open a printer, there is always the same procedure: A printer can have multiple duplex modes, bins or paper sizes, a host can have multiple printers. The steps to
set any of these properties or open a printer are:
1. Ask how many there are: GetDuplexModeCount, GetBinCount, GetPaperCount, GetPrinterCount
2. Select one, get its name: GetDuplexMode, GetBin, GetPaper, GetPrinter
3. Do something with it: Duplex=. . ., DefaultSource=. . ., PaperSize=. . ., OpenPrinter
Settings must always be done before printing. How printing is done and settings are retrieved and set is described
in the upcoming chapters.
PrintFile cannot be combined with any other functions other than printing settings (such as duplex, paper size,
etc.).
Example: Print All Pages.
This sample prints all pages of the PDF document C:\some.pdf to the local printer "HP LaserJet 4050 Series PCL".
An empty string as password (3rd parameter) is indicating the document is not encrypted with a user password.
A page range can be defined using the optional parameters 4 and 5.
Example: Print a Range of Pages.
This sample prints the first two pages of a file on the default printer:
If a PDF document is encrypted with a user password, it means a password is required to open the document.
PDF Tools AG Premium PDF Technology
ClosePrinter()
The 7 steps above can also be used in a different order. For example a PDF file can be left open, while the print job
starts and ends and a new print job for the same PDF is started (optionally to a different printer). See also chapter
Basics.
The 7 steps are explained in the following samples.
Open Printer
Begin Group
Begin Document
Open File
Print Page
Optionally repeat 5
Close File
Optionally repeat 4-6
End Document
Optionally repeat 3-7
End Group
Close Printer
5.5.3 Guidelines
It is suggested to keep the size of print jobs at a reasonable level. There are pros and cons for small and large print
jobs.
Small print jobs have the advantage of releasing resources quickly.
E.g. all fonts used in a print job are locked by the printer. If a document contains very large amounts of fonts or
other resources, the system might run out of resources and fail to print the job after a certain amount of pages.
Large print jobs on the other hand have the advantage of reducing overhead.
E.g. a font only needs to be sent once per print job. A few large print jobs are clearer arranged in a printer queue
than hundreds of small jobs.
For documents with simple pages, one should bundle a maximum of around 1000 pages into one print job. For
more complex pages (complex vector drawings, large format newspapers, etc.) the bundle size should be reduced
to around 100 pages.
printer.DefaultSource = 259
End Sub
Simplex
Vertical Duplex
Horizontal Duplex
printer.Duplex = 2
On most printers the three default values work fine. Experience has shown there are virtually no printers that support custom duplex modes only.
If you have one of these printers, use the method GetDuplexModeCount to receive the total number of custom
duplex modes and then the function GetDuplexMode to actually receive the value-name. For sample code, look
at the samples in chapter List and Select the Paper Bin.
The procedure to set the duplex mode is similar.
The above steps are shown in the Visual Basic 6 example below.
Example: Set multiple watermarks
This sample shows how to set watermark on page and, and how to remove it when printing page 2.
printer.PrintPage 2
2. This will open the printers GUI as shown in the next screenshot.
3. In this dialog apply the required settings (e.g. 2 pages per sheet in Landscape).
4. When done press the button OK. These settings are now binary saved in the Printer APIs property DevMode.
This data is still volatile, i.e. after closing the application, it is lost. How to save the data onto a file is described
in the C# sample.
5. Note that certain features in the device mode require the network printing architecture of Windows, to ensure
this set DataType to EMF.
6. The stop of creating a device mode only needs to be done once. To automatically use the settings defined in
the device mode, load it before printing (also described in the C# sample). If no device mode is loaded in the
Printer API, the default device mode is used from the current printers settings.
Note that the created device mode is printer driver specific. So a device mode can only be used with the printer
model and driver that created it.
It is possible to set a device mode in addition to setting standard printing properties of the 3-Heights PDF Printer
API, which will overwrite the values in the device mode.
'Enable Banding
printer.Options = printer.Options Or eOptionBanding
'Disable Banding
printer.Options = printer.Options And Not eOptionBanding
// Enable Banding
PdfViewer.Options |= (int) eOptionBanding;
// Disable Banding
PdfViewer.Options &= ~(int) eOptionBanding;
This will list the available printers. Click on the one to which you want to print via HTTP.
Then click Properties on the left hand side, and you should see the properties including the network name of the
printer.
This step is required and ensures the client system can communicate with the printer on the server. It does not
install a printer driver.
http://www.pdf-tools.com/public/downloads/resources/colorprofiles.zip
http://www.color.org/srgbprofiles.html
https://www.adobe.com/support/downloads/iccprofiles/iccprofiles_win.html
5.18 Fonts
PDF documents may contain both embedded and non-embedded fonts. When printing non-embedded fonts the
best result can be achieved, if the font is available on the system. Therefore it is important to make sure the Font
Directories contain all fonts required.
For more information on how to cope with font issues, please refer to section Font and Text Issues.
The section [fonts] is only considered if the font-matcher does not find an appropriate font amongst the existing
installed fonts. It is suggested to only use this section.
The section [replace] is stronger and applied before the font-matcher. This means a font will be replaced as
defined, even if the correctly installed font is available on the system.
Syntax: The syntax of the mapping file is as follows
[fonts]
PDF_font_1=installed_font_1{,font_style}
PDF_font_2=installed_font_2{,font_style}
[replace]
PDF_font_n=installed_font_n{,font_style}
PDF_font_* is the name of the font in the PDF.
This name can be found in one of the following ways:
Use any tool that can list fonts. Such as 3-Heights PDF Extract or 3-Heights PDF Optimizer. Ignore possible
prefixes of font subsets. A subset prefix consists of 6 characters followed by the plus sign. For example
KHFOKE+MonotypeCorsiva, in this case only use MonotypeCorsiva as font name in the mapping file.
Open the document with Adobe Acrobat, use the MarkUp Text Tool, mark the text of which you would like
to know the font name, right-click it, select Properties...
font_style is an optional style, that is added coma-separated after the font family name.
The style is always one word. Examples of font styles are Italic, Bold, BoldItalic. Omit the font style, if it is
Regular or Normal.
Remove blanks from all font names, i.e. in both the PDF_font_* and the installed_font_*.
Example:
[fonts]
Ryumin-Light=MSMincho
GothicBBB-Medium=MSGothic
[replace]
ArialIta=Arial,BoldItalic
6 Programmers Reference
Note: This manual describes the COM interface only. Other interfaces (C, Java,
.NET), however, work similarly, i.e. they have calls with similar names and the call
sequence to be used is the same as with COM.
6.1.1 AbortDocument
Method:
Boolean AbortDocument()
Abort the current print job. The currently processed page is finished, any further pages are aborted. Note that after
calling AbortDocument, no further calls to PrintPage shall be done.
Returns:
True Print job was aborted successfully.
False Otherwise.
6.1.2 AddWatermarkImage
Method:
Add an image or PDF watermark to the print job. The properties of the watermark (scaling, position) are taken from
the current settings of the corresponding properties (WatermarkScale, WatermarkXPos, WatermarkYPos
etc).
Multiple watermarks can be added using multiple calls to AddWatermarkImage. The watermark must be added
before the page or document is printed.
Parameter:
FileName [String] The file name and optionally the file-path, drive or server string according to the operating systems file name specification rules of an image.
Returns:
True Watermark image successfully added.
PDF Tools AG Premium PDF Technology
False Otherwise.
6.1.3 AddWatermarkText
Method:
Add a textual watermark to the print job. The properties of the watermark (font, size, position, etc) are taken from
the current settings of the corresponding properties (WatermarkScale, WatermarkXPos, WatermarkYPos,
etc).
Multiple watermarks can be added using multiple calls to AddWatermarkText.
The watermark(s) must be added before the page or document is printed.
The text can contain placeholders, which can be used to insert document specific text. The following placeholders
are supported:
%ds
short date
%dl
long date
%t
document title
%a
document author
%s
document keywords
%k
document subject
For example the following text contains the documents title, author and date in the watermark text:
Parameter:
Text [String] The watermark text.
Returns:
True Watermark text successfully added.
False Otherwise.
6.1.4 Bandsize
Property (get, set): Long Bandsize
Default: 1048576 (2^20)
Set or get the size of the chunks in bytes when banding is applied (i.e. when Options = eOptionBanding).
6.1.5 BeginDocument
Method:
Start a new printer job. All pages within one print job are printed successively, e.g. cannot be interrupted by another
print job. The printer must be previously chosen with OpenPrinter. During or before the beginning of the print
job, a PDF or image document can be opened from file or memory and closed. This method can be repeated if its
return value is False in order to recover from failures in a network printing environment.
The end of the print job is marked with EndDocument.
Parameter:
DocumentName [String] The name of the print job
Returns:
True Successfully connected to printer and started a print job.
False Otherwise.
6.1.6 BeginGroup
Method:
Boolean BeginGroup()
Start a new chain of linked print jobs. All subsequent calls to BeginDocument will create print jobs, which are
linked to each other (i.e. be printed in sequential order). The end of the chain is marked by a call to EndGroup. The
print job is paused until EndGroup is called.
This method can only be used if printing to a spooler. It cannot be used if the property Output is set to a file name.
Returns:
True Successfully started a chain of linked print jobs.
False Otherwise.
6.1.7 Center
Property (get, set): Boolean Center
Default: False
Set or get the center mode. When set to True, the document is horizontally and vertically centered on the page.
When set to False, the document is printed to the upper left corner of the page.
6.1.8 Close
Method:
Void Close()
Close the currently opened document. If the document is already closed the method does nothing.
6.1.9 ClosePrinter
Method:
Boolean ClosePrinter()
Close the connection to the printer. It deletes temporarily installed font files of embedded fonts.
Returns:
True The connection could successfully be closed.
False The connection could not be closed.
6.1.10 Collate
Property (get, set): Integer Collate
Default: -1
Set or get the collate mode. It only has an impact if two or more copies of the document are printed using the
method PrintFile. The following collate modes are supported:
Value
Description
-1
Repeat Page Mode (Default): (1, 1, . . .2, 2, . . .3, 3, . . .) In this mode, every page is repeated as many times as
copies are selected, then the next page, etc. In this mode the print is sorted by page.
Repeat Document Mode: (1, 2, 3, . . .1, 2, 3, . . .) In this mode, all pages of the first copy are printed, then all
pages of the second copy, etc. In this mode the print is sorted by document.
6.1.11 Color
Property (get, set): Integer Color
Default: -1
Set or get the color mode. Supported values are:
PDF Tools AG Premium PDF Technology
Value
Description
-1
DMCOLOR_MONOCHROME (0)
Monochrome
DMCOLOR_COLOR (1)
Color
6.1.12 Copies
Property (get, set): Integer Copies
Default: -1
Set or get the number of copies. This property should be used in combination with PrintFile . If the value of
this property is set to -1, the number of copies defined in the printer is applied.
6.1.13 CopyMode
Property (get, set): Long CopyMode
This property sets or gets the copy mode, it only has an impact if two or more copies of the document are printed
using the method PrintFile.
Value
Description
6.1.14 DataType
Property (get, set): String DataType
Default: ""
Set or get the data type of the spool file. There are two valid data types: "raw" and "emf".
"raw"
"raw" is with respect to the printer language. E.g. if "raw" is used for a PCL printer, a PCL file is
created, if "raw" is used for a PS printer, a PS file is created.
For local printers the DataType should be set to "raw".
"emf"
If "emf" is used, an EMF5 file is generated. The EMF file can be sent over a network and at its
destination the (remote-) printer driver converts it to a raw file.
For network printers "emf" should be used and it comes with the following two advantages:
It takes less bandwidth to send the spool file over the network, because and EMF file is smaller
than raw spool file.
The workload is balanced: On the host where the Printer API resides, the EMF file is generated,
on the host where the printer resides, the EMF file is converted to a raw file.
""
If DataType is set to an empty string, the data type is inherited from the printers setting of the
current user. In any situation where the current user settings are not well defined (e.g. IIS), the
DataType should be set explicitly to either "raw" or "emf".
6.1.15 DC
Property (get):
Long DC
This property returns a handle to the device context. It is valid after a successful call to BeginDocument and until
calling EndDocument.
6.1.16 DefaultSource
Property (get, set): Integer DefaultSource
Default: -1
The default source defines from which input tray the paper shall be selected. For default values see Paper Bins. There
is no property to set the output paper tray. In order to set the output paper tray, use the device mode functionality.
Some printers ignore the value of this property. If DefaultSource has no effect on the paper bin chosen by the
printer, sometimes the bin can be selected using the property MediaType.
6.1.17 DeleteWatermarks
Method:
Void DeleteWatermarks()
Delete all current watermarks, which includes textual and image watermarks.
6.1.18 DevMode
Property (get):
Long DevMode
Set or get the device mode of the currently open printer. The method EditDevMode modifies this property.
This property can be got or set only if a printer is open, i.e. in between OpenPrinter and ClosePrinter calls.
See chapter How to use the Device Mode for more information on device modes.
6.1.19 Duplex
Property (get, set): Integer Duplex
Default: -1
Set or get the duplex mode. For Windows default values, see Duplex Modes. It is suggested to use the default values
1, 2 and 3.
-1
DMDUP_SIMPLEX (1)
Simplex
DMDUP_VERTICAL(2)
Vertical Duplex
DMDUP_HORIZONTAL(3)
Horizontal Duplex
6.1.20 EditDevMode
Method:
Open the printer properties dialog and allows the interactive modification of its settings (e.g. paper size, duplex,
number of copies, etc.). Upon pressing the OK button in the dialog, the settings (device mode) are saved, otherwise
they are discarded. A printer must be selected prior to editing the device mode.
Parameter:
hwndParent [Long] Handle to the parent window.
Returns:
True The device mode was successfully edited and the user pressed OK. The edited device mode is now available in the property DevMode.
False Otherwise (e.g. user pressed Cancel).
6.1.21 EmptyPage
Method:
Insert an empty page of the given dimensions into the spool output. There must be an open printer connection
but there is no need for an open document before calling this method. Active watermarks are printed on the empty
page. The page dimensions are used to scale and rotate the page and select a suitable bin if appropriate.
Parameters:
Width [Double] The width of the page in points
Height [Double] The height of the page in points
Returns:
True The page was successfully printed.
False Otherwise.
6.1.22 EndDocument
Method:
Boolean EndDocument()
Define the end of the printer job. After calling EndDocument, the print job is no longer under the control of the
3-Heights PDF Printer API.
When printing directly to a printer (i.e. not using a spooler), EndDocument means the entire print job is on the
printer.
When using the spooler, EndDocument means the entire print job is in the queue of the spooler. It does not imply
that it is already being printed.
Returns:
True The print job was submitted and the connection to the printer could successfully be closed.
False Otherwise.
6.1.23 EndGroup
Method:
Boolean EndGroup()
Returns:
True The end of the print job chain was set successfully.
False Otherwise.
6.1.24 ErrorCode
Property (get):
TPDFErrorCode ErrorCode
This property can be accessed to receive the latest error code. See also enumeration TPDFErrorCode. PDF-Tools
error codes are listed in the header file bseerror.h. Please note that only few of them are relevant for the 3Heights PDF Printer API.
6.1.25 Escape
Method:
This method is used to pass a binary (or text) string to the printer driver. It is cached and inserted in the printer data
stream immediately after the GDI StartPage call without any interpretation as its content depends on the specific
printer language.
Parameter:
varData [Variant] A binary or text string.
Returns:
True If the method completed successfully.
False Otherwise.
6.1.26 FitPage
Property (get, set): Boolean FitPage
Default: False
The fit-page property defines how the PDF page should fit the paper size. Allowed values are:
True
The page is resized so that both, page width and height fit on the printable part of the paper
supported by the printer device. The ratio width to height remains unchanged.
False
The size of the page remains unchanged. If part of the content is outside the printable area (i.e.
close to the border of the page) it will not be printed.
6.1.27 GetBin
Method:
Return the value-name of the input paper bin with number iBin. The returned string contains a number (1-5
digits) and a description of the bin. The number is the value that needs to be used to set the bin by the property
DefaultSource.
Parameter:
iBin [Integer] The bin number. When iterating over all bins, iBin runs from 0 to GetBinCount-1.
Compatibility Note: In the COM interface of versions prior to 1.91.0.20 iBin
runs from 1 to GetBinCount.
Returns:
Value-Name The value-name for the bin with number iBin.
6.1.28 GetBinCount
Method:
Return the total number of input paper bins on a printer. This method should be used prior to GetBin.
Parameter:
PrinterName [String] The name of the printer.
Returns:
The number of total bins for the printer.
6.1.29 GetDefaultPrinter
Method:
String GetDefaultPrinter()
Return the name of the default printer, if there is a default printer installed on the system. If there is no default
printer defined, it returns an empty string.
Returns:
The name of the default printer.
6.1.30 GetDuplexMode
Method:
Parameter:
iDuplex [Integer] The duplex mode number.
Returns:
Value-Name The value-name for the duplex mode with number iDuplex.
6.1.31 GetDuplexModeCount
Method:
Return the total number of duplex modes on a printer. This method should be used prior to GetDuplexMode.
Parameter:
PrinterName [String] The name of the printer.
Returns:
The number of total duplex modes for the printer.
6.1.32 GetErrorText
[Deprecated] Method: String GetErrorText(TPDFErrorCode iErrorCode)
Deprecated. Use ErrorMessage instead.
6.1.33 ErrorMessage
Property (get):
String ErrorMessage
6.1.34 GetMediaType2
Method:
Get the media type value that can be used to specify the respective media type for printing using the property
MediaType. Standard media type numbers are listed in the MSDN documentation.
Parameter:
iMediaType [Integer] The media type index. When iterating over all media types, iMediaType runs
from 0 to GetMediaTypeCount (-1).
Returns:
The media type value of the media type with number iMediaType.
6.1.35 GetMediaTypeCount
Method:
Returns the total number of supported MediaTypes of a printer. Should be used prior to GetMediaType2 and
GetMediaTypeName.
Parameter:
PrinterName [String] The name of the printer.
6.1.36 GetMediaTypeName
Method:
Returns the media type value and name of the media type with number iMediaType, see GetMediaType2 and
GetMediaTypeCount.
Parameter:
iMediaType [Integer] The media type index. When iterating over all media types, iMediaType runs from 0
to GetMediaTypeCount (-1).
6.1.37 GetPageDimensions
[Deprecated] Method: GetPageDimensions(Float* Width, Float* Height)
Deprecated, use PageWidth and PageHeight instead.
PDF Tools AG Premium PDF Technology
6.1.38 PageWidth
Property (get):
Float PageWidth
The Size of a page. The page needs first to be selected with PageNo.
The dimensions for a PDF document are in PDF points. (72 points = 1 inch, 1 inch = 25.4 mm). This method can also
be applied to raster images, such as TIFF, JPEG, PNG, etc. In this case the resolution of the image is applied if existing.
If the image does not provide a resolution, it is set to 96 DPI (dots per inch).
Examples:
1. A Tiff image 800 by 600 pixels has a resolution of 72 DPI: PageWidth returns 800 points.
2. A TIFF image 800 by 600 pixels has a resolution of 300 DPI: PageWidth returns 192 points.
3. For a JPEG image 800 by 600 pixels without an associated resolution a resolution of 96 DPI is assumed:
PageWidth returns 600 points.
6.1.39 PageHeight
Property (get):
Float PageHeight
The Size of a page. The page needs first to be selected with PageNo.
The dimensions for a PDF document are in PDF points. (72 points = 1 inch, 1 inch = 25.4 mm). This method can also
be applied to raster images, such as TIFF, JPEG, PNG, etc. In this case the resolution of the image is applied if existing.
If the image does not provide a resolution, it is set to 96 DPI (dots per inch).
Examples:
1. A Tiff image 800 by 600 pixels has a resolution of 72 DPI: PageHeight returns 600 points.
2. A TIFF image 800 by 600 pixels has a resolution of 300 DPI: PageHeight returns 144 points.
3. For a JPEG image 800 by 600 pixels without an associated resolution a resolution of 96 DPI is assumed: PageHeight returns 450 points.
6.1.40 GetPaper
Method:
Parameter:
iPaper [Integer] The paper number. When iterating over all papers, iPaper runs from 0 to GetPaperCount (-1).
Returns:
Value-Name The value-name for the paper with number iPaper.
6.1.41 GetPaperCount
Method:
Return the total number of paper sizes on a printer. This method should be used prior to GetPaper.
Parameter:
PrinterName [String] The name of the printer
Returns:
The total number of paper sizes on the printer.
6.1.42 GetPrinter
Method:
Return the name of the printer with number iPrinter. To select a remote printer, use GetPrinterCount to
specify the host prior to GetPrinter. GetPrinter will then select the printer with number iPrinter.
Parameter:
iPrinter [Integer] The number of the printer
Returns:
The name of the printer with number iPrinter.
6.1.43 GetPrinterCount
Method:
Return the total number of printers on a host. This method should be used prior to GetPrinter.
Parameter:
Host [String] The name of the host. For localhost use an empty string (default).
Returns:
The total number of printers available on the host.
6.1.44 HANDLE
Property (get):
Long HANDLE
Get the current printer handle. This property is valid after a successful call to OpenPrinter and until calling
ClosePrinter. The handle which is defined by the OpenPrinter call is opened with the PRINTER_ALL_ACCESS access rights.
6.1.45 JobId
Property (get):
Long JobId
Returns the ID of the current print job after BeginDocument has been called. This allows for managing the print
job using Windows API functions.
6.1.46 LicenseIsValid
Property (get):
Boolean LicenseIsValid
6.1.47 MaxPaper
Property (get, set): Integer MaxPaper
Default: 0
Set the maximum paper size that is supported by the automatic paper size feature (PaperSize set to -2). Any
paper size that exceeds the paper width or height is excluded. The paper sizes are represented by an inter value as
returned in the first five characters by the function GetPaper; see also Paper Bins.
Example:
If MaxPaper is set to 66 (A2), then larger paper sizes, such as A1, are ignored by the automatic paper selection.
PDF Tools AG Premium PDF Technology
6.1.48 MediaType
Property (get, set): Integer MediaType
Default: -1
Set or get the MediaType. Supported values are:
Value
Description
-1
DMMEDIA_STANDARD (1)
Standard paper
DMMEDIA_TRANSPARENCY (2)
Transparency
DMMEDIA_GLOSSY (3)
Glossy Paper
Media types supported by a printer can be enumerated using the methods GetMediaTypeCount, GetMediaType2 and GetMediaTypeName.
6.1.49 MinLineWidth
Property (get, set): String MinLineWidth
Default: 0
Get or set the minimum line width in PDF points. In cases where lines are printed too thin, a minimum line width in
PDF points can be defined. Any line will then be printed with at least the defined minimum line width. Note that as
a result, thin and very thin lines can no longer be distinguished.
This option only affects lines. It has no influence when lines are drawn in any another way as by using the PDF
operators m and l (move to, line to). It does not affect text unless text is drawn with lines instead of using a font.
6.1.51 OMR
Property (get, set): String OMR
Default: ""
The string specifies OMR markers which are printed on each succeeding page until the marker is changed or deleted.
The syntax of the string is as follows:
Example: "0, 20, 10, 4, 15, 0, 01110011"
0 horizontal position of the first markers
20 vertical position of the first marker
10 horizontal extension of the marker
4 vertical extension of the marker
0 Markers are drawn from either top of page to bottom (1) or from bottom to top (0).
01110011 Array of Boolean numbers indicating whether the marker shall be present or not.
This property was introduced with version 1.91.6.0.
6.1.52 Open
Method:
Open a PDF file or raster image file, i.e. make the objects contained in the document accessible. If a document is
already open, it is closed first.
Parameters:
Filename [String] The file name and optionally the file path, drive or server string according to the operating systems file name specification rules.
[String] (optional) The user or the owner password of the encrypted PDF document. If this
Password
Returns:
True The file could be successfully opened.
False The file does not exist, it is corrupt, or the password is not valid. Use the property ErrorCode for additional information.
6.1.53 OpenMem
Method:
Open a PDF file or raster image file, i.e. make the objects contained in the document accessible. If a document is
already open, it is closed first.
Parameters:
MemBlock [Variant] The memory block containing the PDF file given as a one dimensional byte array.
[String] (optional) The user or the owner password of the encrypted PDF document. If this
parameter is left out an empty string is used as a default.
Password
Returns:
True The document could be successfully opened.
False The document could not be opened, it is corrupt, or the password is not valid.
6.1.54 OpenPrinter
Method:
Open a printer. This method can be repeated, if its return value is False in order to recover from failures in a
network printing environment.
Parameter:
[String] The name of the printer. The name is the same as shown on the Settings/Printer
window, for example "HP LaserJet 4050 Series PS". It is not the same as the network name. Network
printers could look like this: "\\PrinterServer\HP LaserJet 4250 PCL 6".
PrinterName
Returns:
True The printer could be successfully opened.
False Otherwise.
6.1.55 Options
Property (get, set): TPDFRendererOption Options
Default:
eOptionBanding + eOptionTrueType + eOptionHighQuality +
eOptionPrint
Set or get a specific rendering option.
Use bitwise OR to add an option.
Use bitwise AND NOT to remove an option.
For more information on the options available in the 3-Heights PDF Printer API and how to use the this property
please see TPDFRendererOption.
6.1.56 Orientation
Property (get, set): Integer Orientation
Default: -1
Set or get the orientation of the paper. Allowed values are:
-2
Automatic
-1
DMORIENT_PORTRAIT (1)
Force portrait
DMORIENT_LANDSCAPE (2)
Force landscape
When not specified, the PDF Printer API uses the setting of the printer.
Compatibility Note: In older versions, the default was set to automatic, which
places the page on the paper such that it fits best.
6.1.57 Output
Property (get, set): String Output
Default: ""
Set or get the path to an output file. The output is then redirected to the specified file name. The selected port of
the printer is ignored. If the string is empty, the output is not redirected to a file.
This property must be set before BeginDocument to redirect the print job.
This property must be set to an empty string if using BeginGroup and EndGroup.
6.1.58 Page
[Deprecated] Property (get, set): Long Page
Deprecated, use PageNo instead.
6.1.59 PageCount
Property (get):
Long PageCount
Get the number of pages of an open document. If the document is closed or if the document is a collection (also
known as PDF Portfolio) then this property is 0.
6.1.60 PageNo
Property (get, set): Long PageNo
Set or get the current page number in the PDF. Set the page number before retrieving information from this page,
such as PageWidth and PageHeight.
The numbers are counted starting from 1 for the first page to the value of PageCount for the last page.
6.1.61 PaperSize
Property (get, set): Integer PaperSize
Default: -1
Get or set the paper size. The 118 Windows default paper sizes are listed in chapter Paper Sizes.
If the value is set to -1, the default paper configured in the printer is used.
If the value is set to -2, the 3-Heights PDF Printer API calculates the paper sizes of the pages. It transmits the
paper size to the printer, which then selects the paper from the appropriate bin automatically. Use the method
SetPaperList in order to limit the allowed set of paper sizes used.
If the value is set to -2, the setting of the property DefaultSource is ignored.
Background information when using -2: There are printer drivers that return a generic result when asked which
paper sizes they support (see GetPaperCount and GetPaper). That includes paper sizes that are not supported
by the connected physical device, and are intended for another type of device, which shares the same driver. This
may result in selecting a paper size that is too large and therefore not supported. As an undesired consequence of
the too large paper size not being available, the printer selects the default paper size. To manually limit the paper
sizes to those that are actually available, use the property MaxPaper.
6.1.62 PJL
Property (get, set): String PJL
Default: ""
Allow for inserting PJL commands directly into the header of the spool file and override identical PJL commands
that are created by the printer. The PJL command can be passed in two ways:
1. As text file.
In this case the value of the property is to be set to the file path. The text file should be ANSI and contain one
command per line. The last line should be empty.
Example: for text file C:\path\pjl.txt
PJL = @"C:\path\pjl.txt";
2. As direct PJL command.
Example to set PJL property (C#):
6.1.63 PrintFile
Method:
Print one file to one printer. This is a stand-alone function, the file and printer as provided in the method. This
method cannot be combined with other methods such as Open, BeginDocument or EndDocument.
Parameters:
FileName [String] The path and name of the PDF file.
PrinterName [String] The name of the printer.
[String] (optional) The name of the password. A password (owner or user) must be provided
when the PDF file is encrypted and has a user password set.
Password
Returns:
True The document was successfully printed.
False Otherwise.
6.1.64 PrintPage
Method:
Print a page of the currently opened document. The printer must be selected previously (OpenPrinter). This
method must be called after BeginDocument and before EndDocument.
PDF Tools AG Premium PDF Technology
Parameter:
PageNumber [Long] This is the number of the page in the PDF file to be printed.
Returns:
True The page was successfully printed.
False Otherwise.
6.1.65 PrintQuality
Property (get, set): Integer PrintQuality
Default: 1 (Printer default)
Set or get the printing quality. The supported values, from lowest to highest, are:
Value
Description
Printer Default
DMRES_DRAFT (-1)
Quality = draft
DMRES_LOW (-2)
Quality = low
DMRES_MEDIUM (-3)
Quality = medium
DMRES_HIGH (-4)
Quality = high
6.1.66 RenderingMode
Property (get, set): TPDFRenderingMode RenderingMode
Default: eModeFast
Set or get the rendering mode. The supported rendering modes are listed in the enumeration TPDFRenderingMode. The default and recommended mode is eModeFast.
Note: This property is not to be mixed up with the property PrintQuality.
eModeFast is optimized for printing to physical devices and creating a high quality
spool file with a small file size.
6.1.67 ReportingLevel
Property (get, set): Integer ReportingLevel
Default: 1
Set or get the reporting level. Available values are:
PDF Tools AG Premium PDF Technology
Value
Description
Do not report.
Errors, warnings and information are described in the header file bseerror.h.
6.1.68 RotateMode
Property (get, set): TPDFRotateMode RotateMode
Default: eRotateAttribute
Set or get the rotation. There are four valid values listed under the enumeration TPDFRotateMode.
6.1.69 ScaleXY
Property (get, set): Float ScaleXY
Default: 1.0
After the page has been scaled to fit the paper size an additional scaling can be specified by using this property. A
number less than 1 shrinks the page. A number greater than 1 expands the page. This property can optionally be
combined with the FitPage property.
6.1.70 SetCMSEngine
Method:
Set the Color Management System (CMS) Engine. The following strings are supported:
"None" The algorithms specified in the PDF reference are used. This results in the maximum possible contrast.
"Neugebauer" The Neugebauer algorithm efficiently converts CMYK to RGB. It does not need any color profiles.
The results, however, look similar to conversion using color profiles.
(default): Use ICC color profiles. Default profiles are used for all unmanaged device color spaces as
described in section Color Profiles.
"lcms"
FileName Providing a file name, a configurable version of the Neugebauer algorithm is applied. The coefficients
can be defined in the text file. The default Neugebauer coefficients are listed below (Red, Green, Blue; Color):
0.000000,
0.925490,
1.000000,
0.215686,
0.243137,
0.000000,
0.066667,
0.929412,
0.215686,
0.200000,
0.266667,
0.133333,
0.074510,
0.215686,
0.125490,
0.686275,
0.149020,
0.949020,
0.203922,
0.247059,
0.658824,
0.176471,
0.196078,
0.101961,
0.196078,
0.266667,
0.098039,
0.180392,
0.121569,
0.121569,
0.937255
0.560784
0.066667
0.207843
0.584314
0.349020
0.215686
0.215686
0.141176
0.125490
0.274510
0.160784
0.133333
0.113725
0.121569
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
C
M
Y
K
CM
CY
CK
MY
MK
YK
CMY
CMK
CYK
MYK
CMYK
The Neugebauer algorithm mixes the colors based on the amount of color and the corresponding weighted coefficient. Altering the values for a pure color specifically changes the result for this pure color.
The color transition remains smooth.
6.1.71 SetLicenseKey
Method:
6.1.72 SetPaperList
Method:
Set the list of approved paper sizes used, when selecting a paper size automatically (e.g. when property PaperSize is set to -2).
For example, SetPaperList("8, 9, 11") will set the approved paper sizes to A3, A4 and A5.
Parameter:
[String] Comma-separated list of paper numbers. Valid paper number values are those listed at the
beginning of the strings returned by GetPaper.
List
6.1.73 ShrinkPage
Property (get, set): Boolean ShrinkPage
Default: false
The shrink-page property defines whether the PDF page size should be reduced to fit the paper size. Allowed values
are:
PDF Tools AG Premium PDF Technology
Value
Description
True
The page is resized so that both, page width and height fit on the printable part of the paper
supported by the printer device. The ratio width to height remains unchanged. In contrast to the
FitPage property the resizing is only done if the page size is larger than the paper size.
False
The size of the page remains unchanged. If part of the content is outside the printable area (i.e.
close to the border of the page) it will not be printed.
6.1.75 WaitForJobCompletion
Property (get, set): Boolean WaitForJobCompletion
Default: False
If set to True, the tool waits in EndDocument until the spooler reports that the job has been completed. This
ensures that temporarily installed fonts are not removed until the print job has been completed. In conjunction
with virtual printer drivers or when printing to a network printer (especially to Windows 2012 print servers) this
switch is recommended.
If the input file contains embedded fonts, their use is not disabled, and the printing is done locally then the wait
function is enabled by default. With the property the wait function can be enabled unconditionally.
6.1.76 WatermarkAngle
Property (get, set): Single WatermarkAngle
Default: 0
Set or get the angle of the watermark in radians. In order to transform a degree-value to a radian-value multiply the
degree-value by factor 2 / 360.
6.1.77 WatermarkBold
Property (get, set): Boolean WatermarkBold
Default: False
Set or get if a bold font is used.
6.1.78 WatermarkColor
Property (get, set): Long WatermarkColor
Default: 0 (Black)
Set or get the color of the watermark. The color is in RGB. The value is calculated as:
Color = red + 256 green + 2562 blue,
where red, green and blue are values from 0-255.
6.1.79 WatermarkFileName
[Deprecated] Property (get, set): String WatermarkFileName
Default: ""
Use AddWatermarkImage instead. This property can be used to embed a raster image or PDF as watermark logo.
The supported image types are BMP, GIF, JPEG, PNG and TIFF. Transparency and alpha channels are not supported
for raster images.
6.1.80 WatermarkFontName
Property (get, set): String WatermarkFontName
Default: ""
Set or get the font name of the watermark text.
6.1.81 WatermarkFontSize
Property (get, set): Single WatermarkFontSize
Default: 12
Set or get the size of the font of the watermark text.
6.1.82 WatermarkItalic
Property (get, set): Boolean WatermarkItalic
Default: False
PDF Tools AG Premium PDF Technology
6.1.83 WatermarkOutline
Property (get, set): Boolean WatermarkOutline
Default: False
Set or get whether the font property outline is turned on or off. Outline refers to only stroking the text without
filling it.
6.1.84 WatermarkScale
Property (get, set): Single WatermarkScale
Default: 1
Set or get the scaling factor to scale raster images. A value of 1 equals 100%, i.e. no scaling.
6.1.85 WatermarkText
[Deprecated] Property (get, set): String WatermarkText
Deprecated, use AddWatermarkText instead.
6.2 Enumeration
Note: Depending on the interface, enumerations may have TPDF as prefix (COM,
C) or PDF as prefix (.NET) or no prefix at all (Java).
A PDF page of size "A4" is 595 by 842 points. A page of size Letter is 612 by 792 points.
PDF Tools AG Premium PDF Technology
6.2.1 TPDFErrorCode
All TPDFErrorCode enumerations start with a prefix, such as PDF_, followed by a single letter which is one of S,
E, W or I, an underscore and a descriptive text.
The single letter gives an indication of the severity of the error. These are: Success, Error, Warning and Information.
In general, an error is returned if an operation could not be completed. A warning is returned if the operation was
completed, but problems occurred in the process.
A list of all error codes is available in the C APIs header file bseerror.h, the javadoc documentation of
com.pdftools.NativeLibrary.ERRORCODE and the .NET documentation of Pdftools.Pdf.PDFErrorCode.
Note that only a few are relevant for the 3-Heights PDF Printer API, most of which are listed here:
TPDFErrorCode Table
TPDFErrorCode
Description
PDF_S_SUCCESS
LIC_E_NOTINIT, . . .
LIC_E_LEVEL
PDF_E_FILEOPEN
PDF_E_FILECREATE
PDF_E_PASSWORD
PDF_E_UNKSECHANDLER
The file uses a proprietary security handler, e.g. for a proprietary digital
rights management (DRM) system.
PDF_E_COLLECTION
PDF_E_XFANEEDSRENDERING
The file contains unrendered XFA form fields, i.e. the file is an XFA and not
a PDF file.
The XFA (XML Forms Architecture) specification is referenced as an
external document to ISO 32000-1 (PDF 1.7) and has not yet been
standardized by ISO. Technically spoken, an XFA form is included as a
resource in a shell PDF. The PDFs page content is generated dynamically
from the XFA data, which is a complex, non-standardized process. For this
reason, XFA is forbidden by the ISO Standards ISO 19005-2 (PDF/A-2) and
ISO 32000-2 (PDF 2.0) and newer.
6.2.2 TPDFRendererOption
Renderer options are set using the property Options. To combine multiple options use a bitwise OR operator. To
disable an option use the bitwise AND NOT operators.
Example: C/C++
eOptionAutoAccurateMode
eOptionBanding
(default) The data is sent in small chunks. This is mainly for older printers
with limited memory.
eOptionBilinear
eOptionBitmap
The pages are rendered in a bitmap, which then is sent to the device.
eOptionDisableAnnots
When setting this option flag then annotations are not printed.
eOptionDisableBPC
If this option flag is set then the black point compensation feature is
disabled when converting colors e.g. from CMYK to RGB.
eOptionDisableBuffer
eOptionDisableContent
When setting this option flag then only form fields and annotations are
printed without the underlying page content.
eOptionDisableFilter
TPDFRendererOption Table
eOptionDisablePatterns
Disable patterns.
eOptionDisablePS
eOptionDrawPopups
eOptionFillStroke
When setting this option flag then strokes are converted to filled paths.
eOptionJPEG
If a printer supports JPEG compression, then the pages can be sent with
JPEG compression to reduce the size of the spool file.
eOptionHighQuality
(default) Anti-aliasing for text and path objects and filtering of image
objects can be turned off and on with this option.
eOptionNoEmbedded
Do not use embedded fonts. Instead fonts from the operating systems
font directory are used (%Systemroot%\fonts).
eOptionOutlines
eOptionPreInstalled
eOptionPNG
If a printer supports PNG compression, then the pages can be sent with
PNG compression to reduce the size of the spool file.
eOptionPrint
eOptionPrintOnlySig
eOptionDoNotPrintSig
eOptionPSLevel2
eOptionTransparency
eOptionTrueType
(default) CFF and Type1 fonts are converted to True Type fonts. This
option overrules option eOptionType1.
eOptionType1
TPDFRendererOption Table
eOptionUseFastImages
Always print images in fast mode. This should help resolving performance
issues with complex images and image masks of documents that are to be
printed in accurate mode.
eOptionUseUnicodes
eOptionWindows9x
6.2.3 TPDFRenderingMode
TPDFLayoutMode Table
TPDFRenderingMode
eModeAccurate
The accurate mode is intended for virtual printers such as a TIFF printer. It uses the
Windows GDI+ for rendering. This mode allows for image filtering, sub-pixel
rendering and anti-aliasing. It should not be applied for physical devices, such as a
laser printer, due to the fact that those devices do not support the above features.
Using the accurate mode creates generally larger spool files than the fast mode.
eModeDirect
eModeFast
The fast mode is the recommended mode for printing to any physical printer device
such as a laser printer, or ink jet printer. It uses the Windows GDI for rendering. This
mode is generally faster and creates smaller spool files than the accurate mode. Use
this mode for high resolution (600 DPI).
6.2.4 TPDFRotateMode
TPDFViewerOption Table
TPDFRotateMode
eRotateAttribute
Set the rotation to the viewing rotation attribute of the PDF page, i.e. rendering the
page with the same rotation as it is displayed in a PDF viewer.
TPDFViewerOption Table
eRotatePortrait
eRotateLandscape
eRotateNone
7 Troubleshooting
7.1 General
7.1.1 No Ouput
Check the return codes of:
OpenPrinter: If false, the printer driver could not be found. Verify that the name of the printer is written
correctly, the printer is installed and the user has permission rights to access it. Missing permission rights is a
common cause in a network or web application for OpenPrinter to fail.
BeginDocument: If false, the connection to the physical printer device failed. Verify that the printer device is
connected to the networks and turned on. This method will also return false if OpenPrinter failed previously.
Open: If false, the PDF document could not be opened. Check for spelling errors. Verify the PDF document is
not corrupted (or test with another document). Also check for permission rights.
PrintPage: If false, the selected page could not be printed. Check page range.
PrintFile: This method does all the four steps above (plus Close, EndDocument, ClosePrinter) in one.
Therefore if PrintFile returns false, any of the above steps could have failed.
Verify the property Output is not set. Otherwise the output is redirected to a file.
Go to Start Settings Printer right-click your printer Properties Device Properties. Look for options like Installable Options Duplex Unit.
If you can print duplex using other Windows applications, try using the value 2 or 3 as parameter.
Alternatively to the Duplex property, the duplex mode can be defined in the printers properties. See Section How
to use the Device Mode.
7.1.5 Orientation
Every page in a PDF document can have a separate rotation value: For example, a page that visually appears as
a landscape can actually be a by 90 rotated portrait. When sending such a page to the printer, it will be treated
according to the property RotateMode, which is by default set to eRotateAttribute and will thus be sent the
way it is viewed as landscape.
Then the next property comes into play: Orientation. While RotateMode was for the page, Orientation is
for the paper. The default of this property is Orientation = -1, which means the printer defaults are used. -2
means the automatic mode is used, this will set the orientation so that the page best fits the paper. The values 1
and 2 force the orientation to portrait and landscape.
Example: If you would like a page that appears as landscape to be printed as landscape (and filling the paper), use
the following settings:
FitPage = True
Orientation = -2
Example: If you would like a landscape to be printed as portrait, and thereby only filling half of the paper, use a
setting like this:
FitPage = True
Orientation = 1
due to the nature of how the printing system works on Windows. A detailed explanation is not provided here, but
a work-around to this type of issue is normally using the EMF mode (which, as a side-effect, simulates a network
environment even for local printers).
%%Title: input.pdf
%%Creator: PScript5.dll Version 5.2.2
%%CreationDate: 5/23/2005 11:40:2
%%For: pre
%%BoundingBox: (atend)
%%DocumentNeededResources: (atend)
%%DocumentSuppliedResources: (atend)
%%DocumentData: Clean7Bit
%%TargetDevice: (HP LaserJet 4050 Series) (2014.108) 1
%%LanguageLevel: 2
%%EndComments
The DSC is used to define the page settings and all printer driver dependent properties.
In between the DCS comments there are the actual PostScript commands (all the parts that do not start with %%)
which provide all the information about the content of the page.
An application which is printing a spool file can first ask the GDI whether the type is PostScript. If the GDI says yes,
then there is a so called pass through mode which can be used to provide the PostScript commands directly and
let the printer driver only take care of the DSC. This called direct PostScript injection. Some printer drivers do not
support this, in such cases it should be turned off.
7.2.4 Resolution
Most printers support different resolutions, such as 300 DPI, 600 DPI, 1200 DPI, etc. Depending on the printer language and the document, the resolution influences the spool size. For printer devices that require raster graphics
to be provided uncompressed and at device resolution, the size of an image at 1200 DPI is 16 times the size as at
300 DPI.
Check permissions: The user of a printing application must at least have the print permission to use the referred
printer object.
Use the property WaitForJobCompletion to prevent issues printing embedded fonts. This feature ensures that
temporarily installed fonts are not removed until the print job has been completed.
Retry calls: Calls to the windows operating system may fail while printing to a remote printer. An application program may therefore want to repeat calls to the API until they succeed. This is allowed for calls to OpenPrinter
and BeginDocument as these functions have been designed for this purpose.
a. If the font name appears in the [replace] section in the configuration file fonts.ini the name is replaced and looked up in the installed font collection.
b. If it is a standard font7 it is replaced by the equivalent TrueType font name and it is looked up in the installed
font collection.
c. If the font name appears in the [fonts] section in the configuration file fonts.ini the name is replaced
and looked up in the installed font collection.
d. If the font has Italic or Bold in its name the font without these styles is looked up in the installed font
collection.
2. If a font name is looked up in the installed font collection then the name comparison is performed as follows:
a. PostScript name.
b. TrueType name without blanks (a missing style is interpreted as Regular or Normal).
c. TrueType name without modifications.
3. If the font is embedded, it is converted to a Windows compatible font and temporarily installed. If eOptionNoEmbedded is used then the glyphs of the fonts are converted to either bitmaps or outlines8. If eOptionOutlines is used then the glyphs are converted to outlines only.
4. If the font is not embedded and the Unicodes are available then the nearest font from the installed font collection
is tailored to the metrics of the font.
7
8
http://www.pdf-tools.com
pdfsales@pdf-tools.com
A Default Values
A.1 Duplex Modes
1
Simplex
Vertical Duplex
Horizontal Duplex
Upper
Lower
Middle
Manual
Envelope
Envelope Manual
Auto
Tractor
Small FMT
10
Large FMT
11
Large Capacity
12
undef.
13
undef.
14
Cassette
15
From Source
Letter 8 1/2 x 11 in
Tabloid 11 x 17 in
Ledger 17 x 11 in
Legal 8 1/2 x 14 in
A3 297 x 420 mm
A3 297 x 420 mm
10
11
A5 148 x 210 mm
12
13
B5(JIS)182x257mm
14
Folio 8 1/2 x 13 in
15
16
10x14 in
17
11x17 in
18
Note 8 1/2 x 11 in
19
20
21
22
Envelope # 12 4 \276 x 11
23
Envelope # 14 5 x 11 1/2
24
C size sheet
25
D size sheet
26
E size sheet
27
28
29
30
31
32
33
34
35
36
37
38
63/4Envelope35/8x61/2in
39
USStdFanfold147/8x11in
40
41
42
43
44
9 x 11 in
45
10 x 11 in
46
15 x 11 in
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
A2 420 x 594 mm
67
68
69
70
A6 105 x 148 mm
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
89
90
12x11in
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118