File: c09.tex

package info (click to toggle)
cpdf 2.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,140 kB
  • sloc: ml: 35,825; makefile: 66; sh: 49
file content (173 lines) | stat: -rw-r--r-- 6,293 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/* CHAPTER 8. Logos, Watermarks and Stamps */

/*
 * cpdf_stampOn(stamp_pdf, pdf, range) stamps stamp_pdf on top of all the
 * pages in the document which are in the range. The stamp is placed with its
 * origin at the origin of the target document.
 */
void cpdf_stampOn(int, int, int);

/*
 * cpdf_stampUnder(stamp_pdf, pdf, range) stamps stamp_pdf under all the
 * pages in the document which are in the range. The stamp is placed with its
 * origin at the origin of the target document.
 */
void cpdf_stampUnder(int, int, int);

/*
 * cpdf_stampExtended(pdf, pdf2, range, isover, scale_stamp_to_fit, pos,
 * relative_to_cropbox) is a stamping function with extra features. - isover
 * true, pdf goes over pdf2, isover false, pdf goes under pdf2 -
 * scale_stamp_to_fit scales the stamp to fit the page - pos gives the
 * position to put the stamp - relative_to_cropbox: if true, pos is relative
 * to cropbox not mediabox.
 */
void cpdf_stampExtended(int, int, int, int, int, struct cpdf_position, int);

/*
 * cpdf_combinePages(under, over) combines the PDFs page-by-page, putting
 * each page of 'over' over each page of 'under'.
 */
int cpdf_combinePages(int, int);

/* Adding text. */

/*
 * Special codes
 *
 * %Page     Page number in arabic notation (1, 2, 3...)
 *
 * %roman    Page number in lower-case roman notation (i, ii, iii...)
 *
 * %Roman    Page number in upper-case roman notation (I, II, III...)
 *
 * %EndPage  Last page of document in arabic notation
 *
 * %Label    The page label of the page
 *
 * %EndLabel The page label of the last page
 *
 * %Filename The file name
 *
 * %a        Abbreviated weekday name (Sun, Mon etc.)
 *
 * %A        Full weekday name (Sunday, Monday etc.)
 *
 * %b        Abbreviated month name (Jan, Feb etc.)
 *
 * %B        Full month name (January, February etc.)
 *
 * %d        Day of the month (01-31)
 *
 * %e        Day of the month (1-31)
 *
 * %H        Hour in 24-hour clock (00-23)
 *
 * %I        Hour in 12-hour clock (01-12)
 *
 * %j        Day of the year (001-366)
 *
 * %m        Month of the year (01-12)
 *
 * %M        Minute of the hour (00-59)
 *
 * %p        "a.m" or "p.m"
 *
 * %S        Second of the minute (00-61)
 *
 * %T        Same as %H:%M:%S
 *
 * %u        Weekday (1-7, 1 = Monday)
 *
 * %w        Weekday (0-6, 0 = Monday)
 *
 * %Y        Year (0000-9999)
 *
 * %%        The % character
 */

/* The standard fonts */
char *cpdf_timesRoman = "Times-Roman";
char *cpdf_timesBold = "Times-Bold";
char *cpdf_timesItalic = "Times-Italic";
char *cpdf_timesBoldItalic = "Times-BoldItalic";
char *cpdf_helvetica = "Helvetica";
char *cpdf_helveticaBold = "Helvetica-Bold";
char *cpdf_helveticaOblique = "Helvetica-Oblique";
char *cpdf_helveticaBoldOblique = "Helvetica-BoldOblique";
char *cpdf_courier = "Courier";
char *cpdf_courierBold = "Courier-Bold";
char *cpdf_courierOblique = "Courier-Oblique";
char *cpdf_courierBoldOblique = "Courier-BoldOblique";

/* Justifications for multi line text */
enum cpdf_justification {
  cpdf_leftJustify,   /* Left justify */
  cpdf_CentreJustify, /* Centre justify */
  cpdf_RightJustify   /* Right justify */
};

/* Add text */
void cpdf_addText(int,                  /* If true, don't actually add text but
                                         * collect metrics. */
                  int,                  /* Document */
                  int,                  /* Page Range */
                  const char[],         /* The text to add */
                  struct cpdf_position, /* Position to add text at */
                  double,               /* Linespacing, 1.0 = normal */
                  int,                  /* Starting Bates number */
                  const char[],         /* Font */
                  double,               /* Font size in points */
                  double,               /* Red component of colour, 0.0 - 1.0 */
                  double, /* Green component of colour, 0.0 - 1.0 */
                  double, /* Blue component of colour, 0.0 - 1.0 */
                  int,    /* If true, text is added underneath rather
                           * than on top */
                  int,    /* If true, position is relative to crop box
                           * not media box */
                  int,    /* If true, text is outline rather than
                           * filled */
                  double, /* Opacity, 1.0 = opaque, 0.0 = wholly
                           * transparent */
                  enum cpdf_justification, /* Justification */
                  int,          /* If true, position is relative to midline
                                 * of text, not baseline */
                  int,          /* If true, position is relative to topline
                                 * of text, not baseline */
                  const char[], /* filename that this document was read from
                                 * (optional) */
                  double,       /* line width */
                  int           /* embed fonts */
);

/* Add text, with most parameters default. NB %filename cannot be used here. */
void cpdf_addTextSimple(int,                  /* Document */
                        int,                  /* Page range */
                        const char[],         /* The text to add */
                        struct cpdf_position, /* Position to add text
                                               * at */
                        const char[],         /* font */
                        double);              /* font size */

/*
 * cpdf_removeText(pdf, range) will remove any text added by libcpdf from the
 * given pages.
 */
void cpdf_removeText(int, int);

/*
 * Return the width of a given string in the given standard font in thousandths
 * of a point.
 */
int cpdf_textWidth(const char[], const char[]);

/* cpdf_addContent(content, before, pdf, range) adds page content before (if
 * true) or after (if false) the existing content to pages in the given range
 * in the given PDF. */
void cpdf_addContent(const char[], int, int, int);

/* cpdf_stampAsXObject(pdf, range, stamp_pdf) stamps stamp_pdf onto the pages
 * in the given range in pdf as a shared Form XObject. The name of the
 * newly-created XObject is returned. */
char *cpdf_stampAsXObject(int, int, int);