File: c04.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 (179 lines) | stat: -rw-r--r-- 5,917 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
174
175
176
177
178
179
/* CHAPTER 3. Pages */

/*
 * cpdf_scalePages(pdf, range, x scale, y scale) scales the page dimensions
 * and content by the given scale, about (0, 0). Other boxes (crop etc. are
 * altered as appropriate)
 */
void cpdf_scalePages(int, int, double, double);

/*
 * cpdf_scaleToFit(pdf, range, width, height, scale) scales the content to fit
 * new page dimensions (width x height) multiplied by scale (typically 1.0).
 * Other boxes (crop etc. are altered as appropriate)
 */
void cpdf_scaleToFit(int, int, double, double, double);

/* Standard page sizes. */
enum cpdf_papersize {
  cpdf_a0portrait,        /* A0 portrait */
  cpdf_a1portrait,        /* A1 portrait */
  cpdf_a2portrait,        /* A2 portrait */
  cpdf_a3portrait,        /* A3 portrait */
  cpdf_a4portrait,        /* A4 portrait */
  cpdf_a5portrait,        /* A5 portrait */
  cpdf_a0landscape,       /* A0 landscape */
  cpdf_a1landscape,       /* A1 landscape */
  cpdf_a2landscape,       /* A2 landscape */
  cpdf_a3landscape,       /* A3 landscape */
  cpdf_a4landscape,       /* A4 landscape */
  cpdf_a5landscape,       /* A5 landscape */
  cpdf_usletterportrait,  /* US Letter portrait */
  cpdf_usletterlandscape, /* US Letter landscape */
  cpdf_uslegalportrait,   /* US Legal portrait */
  cpdf_uslegallandscape   /* US Legal landscape */
};

/*
 * cpdf_scaleToFitPaper(pdf, range, papersize, scale) scales the page content
 * to fit the given page size, possibly multiplied by scale (typically 1.0)
 */
void cpdf_scaleToFitPaper(int, int, enum cpdf_papersize, double);

/* Positions on the page. Used for scaling about a point, and adding text. */
enum cpdf_anchor {
  cpdf_posCentre,      /* Absolute centre */
  cpdf_posLeft,        /* Absolute left */
  cpdf_posRight,       /* Absolute right */
  cpdf_top,            /* Top top centre of the page */
  cpdf_topLeft,        /* The top left of the page */
  cpdf_topRight,       /* The top right of the page */
  cpdf_left,           /* The left hand side of the page, halfway
                        * down */
  cpdf_bottomLeft,     /* The bottom left of the page */
  cpdf_bottom,         /* The bottom middle of the page */
  cpdf_bottomRight,    /* The bottom right of the page */
  cpdf_right,          /* The right hand side of the page, halfway
                        * down */
  cpdf_diagonal,       /* Diagonal, bottom left to top right */
  cpdf_reverseDiagonal /* Diagonal, top left to bottom right */
};

/*
 * A cpdf_position is an anchor (above) and zero or one or two parameters
 * (cpdf_coord1, cpdf_coord2).
 *
 * cpdf_posCentre: Two parameters, x and y
 *
 * cpdf_posLeft: Two parameters, x and y
 *
 * cpdf_posRight: Two parameters, x and y
 *
 * cpdf_top: One parameter -- distance from top
 *
 * cpdf_topLeft: One parameter -- distance from top left
 *
 * cpdf_topRight: One parameter -- distance from top right
 *
 * cpdf_left: One parameter -- distance from left middle
 *
 * cpdf_bottomLeft: One parameter -- distance from bottom left
 *
 * cpdf_bottom: One parameter -- distance from bottom
 *
 * cpdf_bottomRight: One parameter -- distance from bottom right
 *
 * cpdf_right: One parameter -- distance from right
 *
 * cpdf_diagonal: Zero parameters
 *
 * cpdf_reverseDiagonal: Zero parameters
 */
struct cpdf_position {
  int cpdf_anchor;    /* Position anchor */
  double cpdf_coord1; /* Parameter one */
  double cpdf_coord2; /* Parameter two */
};

/*
 * cpdf_scaleContents(pdf, range, position, scale) scales the contents of the
 * pages in the range about the point given by the cpdf_position, by the
 * scale given.
 */
void cpdf_scaleContents(int, int, struct cpdf_position, double);

/*
 * cpdf_shiftContents(pdf, range, dx, dy) shifts the content of the pages in
 * the range.
 */
void cpdf_shiftContents(int, int, double, double);

/*
 * cpdf_shiftContents(pdf, range, dx, dy) shifts the boxes of the pages in
 * the range.
 */
void cpdf_shiftBoxes(int, int, double, double);

/*
 * cpdf_rotate(pdf, range, rotation) changes the viewing rotation to an
 * absolute value. Appropriate rotations are 0, 90, 180, 270.
 */
void cpdf_rotate(int, int, int);

/*
 * cpdf_rotateBy(pdf, range, rotation) changes the viewing rotation by a
 * given number of degrees. Appropriate values are 90, 180, 270.
 */
void cpdf_rotateBy(int, int, int);

/*
 * cpdf_rotateContents(pdf, range, angle) rotates the content about the
 * centre of the page by the given number of degrees, in a clockwise
 * direction.
 */
void cpdf_rotateContents(int, int, double);

/*
 * cpdf_upright(pdf, range) changes the viewing rotation of the pages in the
 * range, counter-rotating the dimensions and content such that there is no
 * visual change.
 */
void cpdf_upright(int, int);

/* cpdf_hFlip(pdf, range) flips horizontally the pages in the range. */
void cpdf_hFlip(int, int);

/* cpdf_vFlip(pdf, range) flips vertically the pages in the range. */
void cpdf_vFlip(int, int);

/*
 * cpdf_crop(pdf, range, x, y, w, h) crops a page, replacing any existing
 * crop box. The dimensions are in points.
 */
void cpdf_crop(int, int, double, double, double, double);

/* cpdf_removeCrop(pdf, range) removes any crop box from pages in the range. */
void cpdf_removeCrop(int, int);

/* cpdf_removeTrim(pdf, range) removes any trim box from pages in the range. */
void cpdf_removeTrim(int, int);

/* cpdf_removeArt(pdf, range) removes any art box from pages in the range. */
void cpdf_removeArt(int, int);

/* cpdf_removeBleed(pdf, range) removes any bleed box from pages in the range.
 */
void cpdf_removeBleed(int, int);

/*
 * cpdf_trimMarks(pdf, range) adds trim marks to the given pages, if the
 * trimbox exists.
 */
void cpdf_trimMarks(int, int);

/* cpdf_showBoxes(pdf, range) shows the boxes on the given pages, for debug. */
void cpdf_showBoxes(int, int);

/* cpdf_hardBox makes a given box a 'hard box' i.e clips it explicitly. */
void cpdf_hardBox(int, int, const char[]);