Merge lp:~lfaraone/ubuntu/lucid/xpdf/lp556483 into lp:ubuntu/lucid/xpdf
- Lucid (10.04)
- lp556483
- Merge into lucid
Proposed by
Luke Faraone
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | not available | ||||
Proposed branch: | lp:~lfaraone/ubuntu/lucid/xpdf/lp556483 | ||||
Merge into: | lp:ubuntu/lucid/xpdf | ||||
Diff against target: |
78352 lines (+75595/-559) 111 files modified
.pc/.version (+1/-0) .pc/01_manpage.dpatch/doc/pdffonts.1 (+142/-0) .pc/01_manpage.dpatch/doc/pdfimages.1 (+102/-0) .pc/01_manpage.dpatch/doc/pdfinfo.1 (+158/-0) .pc/01_manpage.dpatch/doc/pdftoppm.1 (+119/-0) .pc/01_manpage.dpatch/doc/pdftops.1 (+235/-0) .pc/01_manpage.dpatch/doc/pdftotext.1 (+137/-0) .pc/01_manpage.dpatch/doc/xpdf.1 (+863/-0) .pc/01_manpage.dpatch/doc/xpdfrc.5 (+617/-0) .pc/02_permissions.dpatch/xpdf/PDFCore.cc (+2044/-0) .pc/02_permissions.dpatch/xpdf/XPDFCore.cc (+1655/-0) .pc/02_permissions.dpatch/xpdf/XPDFViewer.cc (+3488/-0) .pc/02_permissions.dpatch/xpdf/pdfimages.cc (+155/-0) .pc/02_permissions.dpatch/xpdf/pdftops.cc (+344/-0) .pc/02_permissions.dpatch/xpdf/pdftotext.cc (+333/-0) .pc/09_xpdfrc_manpage.dpatch/doc/xpdfrc.5 (+620/-0) .pc/80-fix-hypens-in-manpages.patch/doc/pdfinfo.1 (+157/-0) .pc/80-fix-hypens-in-manpages.patch/doc/pdftops.1 (+234/-0) .pc/80-fix-hypens-in-manpages.patch/doc/xpdf.1 (+874/-0) .pc/80-fix-hypens-in-manpages.patch/doc/xpdfrc.5 (+620/-0) .pc/applied-patches (+18/-0) .pc/bug_408502_message_5.mbox/xpdf/XPDFViewer.cc (+3498/-0) .pc/bug_408502_message_5.mbox/xpdf/XPDFViewer.h (+352/-0) .pc/fix-437725.dpatch/xpdf/XPDFViewer.cc (+3492/-0) .pc/fix-444648.dpatch/xpdf/Stream.cc (+4686/-0) .pc/fix-462544.dpatch/xpdf/SplashOutputDev.cc (+2845/-0) .pc/fix-479467.dpatch/xpdf/XPDFViewer.cc (+3495/-0) .pc/fix-CVE-2007-3387_CVE-2007-5049.dpatch/xpdf/Stream.cc (+4627/-0) .pc/fix-CVE-2007-5393_2007-5392_2007-4352.dpatch/xpdf/Stream.cc (+4625/-0) .pc/fix-CVE-2007-5393_2007-5392_2007-4352.dpatch/xpdf/Stream.h (+858/-0) .pc/fix-CVE-2009-0146,0147,0165,0166,0799,0800,1179-1183.dpatch/goo/gmem.cc (+264/-0) .pc/fix-CVE-2009-0146,0147,0165,0166,0799,0800,1179-1183.dpatch/xpdf/JBIG2Stream.cc (+3413/-0) .pc/fix-CVE-2009-3603+CVE-2009-1188.patch/splash/SplashBitmap.cc (+188/-0) .pc/fix-CVE-2009-3604.patch/splash/Splash.cc (+3310/-0) .pc/fix-CVE-2009-3604.patch/splash/SplashErrorCodes.h (+32/-0) .pc/fix-CVE-2009-3606.patch/xpdf/PSOutputDev.cc (+6222/-0) .pc/fix-CVE-2009-3608.patch/xpdf/XRef.cc (+896/-0) .pc/fix-CVE-2009-3609.patch/xpdf/Stream.cc (+4686/-0) .pc/xpdf-zoom-height.patch/doc/xpdf.1 (+874/-0) .pc/xpdf-zoom-height.patch/doc/xpdfrc.5 (+620/-0) .pc/xpdf-zoom-height.patch/xpdf/GlobalParams.cc (+2908/-0) .pc/xpdf-zoom-height.patch/xpdf/PDFCore.cc (+2048/-0) .pc/xpdf-zoom-height.patch/xpdf/PDFCore.h (+321/-0) .pc/xpdf-zoom-height.patch/xpdf/XPDFCore.cc (+1663/-0) .pc/xpdf-zoom-height.patch/xpdf/XPDFViewer.cc (+3713/-0) .pc/xpdf-zoom-height.patch/xpdf/XPDFViewer.h (+364/-0) .pc/xpdf-zoom-height.patch/xpdf/about-text.h (+48/-0) debian/changelog (+76/-0) debian/compat (+1/-1) debian/control (+8/-7) debian/copyright (+1/-3) debian/patches/00list (+0/-44) debian/patches/01_manpage.dpatch (+16/-24) debian/patches/02_permissions.dpatch (+12/-18) debian/patches/09_xpdfrc_manpage.dpatch (+3/-4) debian/patches/80-fix-hypens-in-manpages.patch (+268/-0) debian/patches/bug_408502_message_5.mbox (+327/-0) debian/patches/bug_558020_message_5.mbox (+20/-0) debian/patches/do-not-make-ps-arrays-bigger-than-64k-from-big-images-in-patterns.dpatch (+3/-0) debian/patches/fix-437725.dpatch (+3/-3) debian/patches/fix-444648.dpatch (+2/-2) debian/patches/fix-462544.dpatch (+3/-3) debian/patches/fix-479467.dpatch (+3/-4) debian/patches/fix-CVE-2007-3387_CVE-2007-5049.dpatch (+3/-4) debian/patches/fix-CVE-2007-5393_2007-5392_2007-4352.dpatch (+19/-21) debian/patches/fix-CVE-2009-0146,0147,0165,0166,0799,0800,1179-1183.dpatch (+4/-6) debian/patches/fix-CVE-2009-3603+CVE-2009-1188.patch (+68/-0) debian/patches/fix-CVE-2009-3604.patch (+50/-0) debian/patches/fix-CVE-2009-3606.patch (+13/-0) debian/patches/fix-CVE-2009-3608.patch (+67/-0) debian/patches/fix-CVE-2009-3609.patch (+14/-0) debian/patches/series (+57/-0) debian/patches/slideshow.patch.2 (+349/-0) debian/patches/xpdf-zoom-height.patch (+253/-0) debian/rules (+18/-23) debian/source/format (+1/-0) debian/watch (+2/-0) debian/xpdf-common.postinst (+1/-1) debian/xpdf-reader.dirs (+0/-1) debian/xpdf-reader.files (+0/-2) debian/xpdf-reader.menu (+1/-1) debian/xpdf-utils.files (+2/-0) debian/xpdf.desktop (+1/-2) doc/pdffonts.1 (+1/-3) doc/pdfimages.1 (+3/-5) doc/pdfinfo.1 (+2/-3) doc/pdftoppm.1 (+1/-3) doc/pdftops.1 (+9/-10) doc/pdftotext.1 (+1/-3) doc/xpdf.1 (+53/-35) doc/xpdfrc.5 (+12/-9) goo/gmem.cc (+36/-4) splash/Splash.cc (+10/-3) splash/SplashBitmap.cc (+27/-8) splash/SplashErrorCodes.h (+2/-0) xpdf/GlobalParams.cc (+2/-0) xpdf/JBIG2Stream.cc (+157/-35) xpdf/PDFCore.cc (+28/-0) xpdf/PDFCore.h (+4/-3) xpdf/PSOutputDev.cc (+1/-1) xpdf/SplashOutputDev.cc (+4/-4) xpdf/Stream.cc (+271/-208) xpdf/Stream.h (+6/-4) xpdf/XPDFCore.cc (+12/-2) xpdf/XPDFViewer.cc (+276/-39) xpdf/XPDFViewer.h (+14/-1) xpdf/XRef.cc (+17/-1) xpdf/about-text.h (+1/-1) xpdf/pdfimages.cc (+4/-0) xpdf/pdftops.cc (+4/-0) xpdf/pdftotext.cc (+4/-0) |
||||
To merge this branch: | bzr merge lp:~lfaraone/ubuntu/lucid/xpdf/lp556483 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Sponsors | Pending | ||
Review via email: mp+22866@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory '.pc' | |||
2 | === added file '.pc/.version' | |||
3 | --- .pc/.version 1970-01-01 00:00:00 +0000 | |||
4 | +++ .pc/.version 2010-04-06 13:42:20 +0000 | |||
5 | @@ -0,0 +1,1 @@ | |||
6 | 1 | 2 | ||
7 | 0 | 2 | ||
8 | === added directory '.pc/01_manpage.dpatch' | |||
9 | === added directory '.pc/01_manpage.dpatch/doc' | |||
10 | === added file '.pc/01_manpage.dpatch/doc/pdffonts.1' | |||
11 | --- .pc/01_manpage.dpatch/doc/pdffonts.1 1970-01-01 00:00:00 +0000 | |||
12 | +++ .pc/01_manpage.dpatch/doc/pdffonts.1 2010-04-06 13:42:20 +0000 | |||
13 | @@ -0,0 +1,142 @@ | |||
14 | 1 | .\" Copyright 1999-2007 Glyph & Cog, LLC | ||
15 | 2 | .TH pdffonts 1 "27 February 2007" | ||
16 | 3 | .SH NAME | ||
17 | 4 | pdffonts \- Portable Document Format (PDF) font analyzer (version | ||
18 | 5 | 3.02) | ||
19 | 6 | .SH SYNOPSIS | ||
20 | 7 | .B pdffonts | ||
21 | 8 | [options] | ||
22 | 9 | .RI [ PDF-file ] | ||
23 | 10 | .SH DESCRIPTION | ||
24 | 11 | .B Pdffonts | ||
25 | 12 | lists the fonts used in a Portable Document Format (PDF) file along | ||
26 | 13 | with various information for each font. | ||
27 | 14 | .PP | ||
28 | 15 | The following information is listed for each font: | ||
29 | 16 | .TP | ||
30 | 17 | .B name | ||
31 | 18 | the font name, exactly as given in the PDF file (potentially including | ||
32 | 19 | a subset prefix) | ||
33 | 20 | .TP | ||
34 | 21 | .B type | ||
35 | 22 | the font type -- see below for details | ||
36 | 23 | .TP | ||
37 | 24 | .B emb | ||
38 | 25 | "yes" if the font is embedded in the PDF file | ||
39 | 26 | .TP | ||
40 | 27 | .B sub | ||
41 | 28 | "yes" if the font is a subset | ||
42 | 29 | .TP | ||
43 | 30 | .B uni | ||
44 | 31 | "yes" if there is an explicit "ToUnicode" map in the PDF file (the | ||
45 | 32 | absence of a ToUnicode map doesn't necessarily mean that the text | ||
46 | 33 | can't be converted to Unicode) | ||
47 | 34 | .TP | ||
48 | 35 | .B object ID | ||
49 | 36 | the font dictionary object ID (number and generation) | ||
50 | 37 | .PP | ||
51 | 38 | PDF files can contain the following types of fonts: | ||
52 | 39 | .PP | ||
53 | 40 | .RS | ||
54 | 41 | Type 1 | ||
55 | 42 | .RE | ||
56 | 43 | .RS | ||
57 | 44 | Type 1C -- aka Compact Font Format (CFF) | ||
58 | 45 | .RE | ||
59 | 46 | .RS | ||
60 | 47 | Type 1C (OT) -- OpenType with 8-bit CFF data | ||
61 | 48 | .RE | ||
62 | 49 | .RS | ||
63 | 50 | Type 3 | ||
64 | 51 | .RE | ||
65 | 52 | .RS | ||
66 | 53 | TrueType | ||
67 | 54 | .RE | ||
68 | 55 | .RS | ||
69 | 56 | TrueType (OT) -- OpenType with 8-bit TrueType data | ||
70 | 57 | .RE | ||
71 | 58 | .RS | ||
72 | 59 | CID Type 0 -- 16-bit font with no specified type | ||
73 | 60 | .RE | ||
74 | 61 | .RS | ||
75 | 62 | CID Type 0C -- 16-bit PostScript CFF font | ||
76 | 63 | .RE | ||
77 | 64 | .RS | ||
78 | 65 | CID Type 0C (OT) -- OpenType with CID CFF data | ||
79 | 66 | .RE | ||
80 | 67 | .RS | ||
81 | 68 | CID TrueType -- 16-bit TrueType font | ||
82 | 69 | .RE | ||
83 | 70 | .RS | ||
84 | 71 | CID TrueType (OT) -- OpenType with CID TrueType data | ||
85 | 72 | .RE | ||
86 | 73 | .SH CONFIGURATION FILE | ||
87 | 74 | Pdffonts reads a configuration file at startup. It first tries to | ||
88 | 75 | find the user's private config file, ~/.xpdfrc. If that doesn't | ||
89 | 76 | exist, it looks for a system-wide config file, typically | ||
90 | 77 | /usr/local/etc/xpdfrc (but this location can be changed when pdffonts | ||
91 | 78 | is built). See the | ||
92 | 79 | .BR xpdfrc (5) | ||
93 | 80 | man page for details. | ||
94 | 81 | .SH OPTIONS | ||
95 | 82 | Many of the following options can be set with configuration file | ||
96 | 83 | commands. These are listed in square brackets with the description of | ||
97 | 84 | the corresponding command line option. | ||
98 | 85 | .TP | ||
99 | 86 | .BI \-f " number" | ||
100 | 87 | Specifies the first page to analyze. | ||
101 | 88 | .TP | ||
102 | 89 | .BI \-l " number" | ||
103 | 90 | Specifies the last page to analyze. | ||
104 | 91 | .TP | ||
105 | 92 | .BI \-opw " password" | ||
106 | 93 | Specify the owner password for the PDF file. Providing this will | ||
107 | 94 | bypass all security restrictions. | ||
108 | 95 | .TP | ||
109 | 96 | .BI \-upw " password" | ||
110 | 97 | Specify the user password for the PDF file. | ||
111 | 98 | .TP | ||
112 | 99 | .BI \-cfg " config-file" | ||
113 | 100 | Read | ||
114 | 101 | .I config-file | ||
115 | 102 | in place of ~/.xpdfrc or the system-wide config file. | ||
116 | 103 | .TP | ||
117 | 104 | .B \-v | ||
118 | 105 | Print copyright and version information. | ||
119 | 106 | .TP | ||
120 | 107 | .B \-h | ||
121 | 108 | Print usage information. | ||
122 | 109 | .RB ( \-help | ||
123 | 110 | and | ||
124 | 111 | .B \-\-help | ||
125 | 112 | are equivalent.) | ||
126 | 113 | .SH EXIT CODES | ||
127 | 114 | The Xpdf tools use the following exit codes: | ||
128 | 115 | .TP | ||
129 | 116 | 0 | ||
130 | 117 | No error. | ||
131 | 118 | .TP | ||
132 | 119 | 1 | ||
133 | 120 | Error opening a PDF file. | ||
134 | 121 | .TP | ||
135 | 122 | 2 | ||
136 | 123 | Error opening an output file. | ||
137 | 124 | .TP | ||
138 | 125 | 3 | ||
139 | 126 | Error related to PDF permissions. | ||
140 | 127 | .TP | ||
141 | 128 | 99 | ||
142 | 129 | Other error. | ||
143 | 130 | .SH AUTHOR | ||
144 | 131 | The pdffonts software and documentation are copyright 1996-2007 Glyph | ||
145 | 132 | & Cog, LLC. | ||
146 | 133 | .SH "SEE ALSO" | ||
147 | 134 | .BR xpdf (1), | ||
148 | 135 | .BR pdftops (1), | ||
149 | 136 | .BR pdftotext (1), | ||
150 | 137 | .BR pdfinfo (1), | ||
151 | 138 | .BR pdftoppm (1), | ||
152 | 139 | .BR pdfimages (1), | ||
153 | 140 | .BR xpdfrc (5) | ||
154 | 141 | .br | ||
155 | 142 | .B http://www.foolabs.com/xpdf/ | ||
156 | 0 | 143 | ||
157 | === added file '.pc/01_manpage.dpatch/doc/pdfimages.1' | |||
158 | --- .pc/01_manpage.dpatch/doc/pdfimages.1 1970-01-01 00:00:00 +0000 | |||
159 | +++ .pc/01_manpage.dpatch/doc/pdfimages.1 2010-04-06 13:42:20 +0000 | |||
160 | @@ -0,0 +1,102 @@ | |||
161 | 1 | .\" Copyright 1998-2007 Glyph & Cog, LLC | ||
162 | 2 | .TH pdfimages 1 "27 February 2007" | ||
163 | 3 | .SH NAME | ||
164 | 4 | pdfimages \- Portable Document Format (PDF) image extractor | ||
165 | 5 | (version 3.02) | ||
166 | 6 | .SH SYNOPSIS | ||
167 | 7 | .B pdfimages | ||
168 | 8 | [options] | ||
169 | 9 | .I PDF-file image-root | ||
170 | 10 | .SH DESCRIPTION | ||
171 | 11 | .B Pdfimages | ||
172 | 12 | saves images from a Portable Document Format (PDF) file as Portable | ||
173 | 13 | Pixmap (PPM), Portable Bitmap (PBM), or JPEG files. | ||
174 | 14 | .PP | ||
175 | 15 | Pdfimages reads the PDF file, scans one or more pages, | ||
176 | 16 | .IR PDF-file , | ||
177 | 17 | and writes one PPM, PBM, or JPEG file for each image, | ||
178 | 18 | .IR image-root - nnn . xxx , | ||
179 | 19 | where | ||
180 | 20 | .I nnn | ||
181 | 21 | is the image number and | ||
182 | 22 | .I xxx | ||
183 | 23 | is the image type (.ppm, .pbm, .jpg). | ||
184 | 24 | .PP | ||
185 | 25 | NB: pdfimages extracts the raw image data from the PDF file, without | ||
186 | 26 | performing any additional transforms. Any rotation, clipping, | ||
187 | 27 | color inversion, etc. done by the PDF content stream is ignored. | ||
188 | 28 | .SH CONFIGURATION FILE | ||
189 | 29 | Pdfimages reads a configuration file at startup. It first tries to | ||
190 | 30 | find the user's private config file, ~/.xpdfrc. If that doesn't | ||
191 | 31 | exist, it looks for a system-wide config file, typically | ||
192 | 32 | /usr/local/etc/xpdfrc (but this location can be changed when pdfimages | ||
193 | 33 | is built). See the | ||
194 | 34 | .BR xpdfrc (5) | ||
195 | 35 | man page for details. | ||
196 | 36 | .SH OPTIONS | ||
197 | 37 | Many of the following options can be set with configuration file | ||
198 | 38 | commands. These are listed in square brackets with the description of | ||
199 | 39 | the corresponding command line option. | ||
200 | 40 | .TP | ||
201 | 41 | .BI \-f " number" | ||
202 | 42 | Specifies the first page to scan. | ||
203 | 43 | .TP | ||
204 | 44 | .BI \-l " number" | ||
205 | 45 | Specifies the last page to scan. | ||
206 | 46 | .TP | ||
207 | 47 | .B \-j | ||
208 | 48 | Normally, all images are written as PBM (for monochrome images) or PPM | ||
209 | 49 | (for non-monochrome images) files. With this option, images in DCT | ||
210 | 50 | format are saved as JPEG files. All non-DCT images are saved in | ||
211 | 51 | PBM/PPM format as usual. | ||
212 | 52 | .TP | ||
213 | 53 | .BI \-opw " password" | ||
214 | 54 | Specify the owner password for the PDF file. Providing this will | ||
215 | 55 | bypass all security restrictions. | ||
216 | 56 | .TP | ||
217 | 57 | .BI \-upw " password" | ||
218 | 58 | Specify the user password for the PDF file. | ||
219 | 59 | .TP | ||
220 | 60 | .B \-q | ||
221 | 61 | Don't print any messages or errors. | ||
222 | 62 | .RB "[config file: " errQuiet ] | ||
223 | 63 | .TP | ||
224 | 64 | .B \-v | ||
225 | 65 | Print copyright and version information. | ||
226 | 66 | .TP | ||
227 | 67 | .B \-h | ||
228 | 68 | Print usage information. | ||
229 | 69 | .RB ( \-help | ||
230 | 70 | and | ||
231 | 71 | .B \-\-help | ||
232 | 72 | are equivalent.) | ||
233 | 73 | .SH EXIT CODES | ||
234 | 74 | The Xpdf tools use the following exit codes: | ||
235 | 75 | .TP | ||
236 | 76 | 0 | ||
237 | 77 | No error. | ||
238 | 78 | .TP | ||
239 | 79 | 1 | ||
240 | 80 | Error opening a PDF file. | ||
241 | 81 | .TP | ||
242 | 82 | 2 | ||
243 | 83 | Error opening an output file. | ||
244 | 84 | .TP | ||
245 | 85 | 3 | ||
246 | 86 | Error related to PDF permissions. | ||
247 | 87 | .TP | ||
248 | 88 | 99 | ||
249 | 89 | Other error. | ||
250 | 90 | .SH AUTHOR | ||
251 | 91 | The pdfimages software and documentation are copyright 1998-2007 Glyph | ||
252 | 92 | & Cog, LLC. | ||
253 | 93 | .SH "SEE ALSO" | ||
254 | 94 | .BR xpdf (1), | ||
255 | 95 | .BR pdftops (1), | ||
256 | 96 | .BR pdftotext (1), | ||
257 | 97 | .BR pdfinfo (1), | ||
258 | 98 | .BR pdffonts (1), | ||
259 | 99 | .BR pdftoppm (1), | ||
260 | 100 | .BR xpdfrc (5) | ||
261 | 101 | .br | ||
262 | 102 | .B http://www.foolabs.com/xpdf/ | ||
263 | 0 | 103 | ||
264 | === added file '.pc/01_manpage.dpatch/doc/pdfinfo.1' | |||
265 | --- .pc/01_manpage.dpatch/doc/pdfinfo.1 1970-01-01 00:00:00 +0000 | |||
266 | +++ .pc/01_manpage.dpatch/doc/pdfinfo.1 2010-04-06 13:42:20 +0000 | |||
267 | @@ -0,0 +1,158 @@ | |||
268 | 1 | .\" Copyright 1999-2007 Glyph & Cog, LLC | ||
269 | 2 | .TH pdfinfo 1 "27 February 2007" | ||
270 | 3 | .SH NAME | ||
271 | 4 | pdfinfo \- Portable Document Format (PDF) document information | ||
272 | 5 | extractor (version 3.02) | ||
273 | 6 | .SH SYNOPSIS | ||
274 | 7 | .B pdfinfo | ||
275 | 8 | [options] | ||
276 | 9 | .RI [ PDF-file ] | ||
277 | 10 | .SH DESCRIPTION | ||
278 | 11 | .B Pdfinfo | ||
279 | 12 | prints the contents of the \'Info' dictionary (plus some other useful | ||
280 | 13 | information) from a Portable Document Format (PDF) file. | ||
281 | 14 | .PP | ||
282 | 15 | The \'Info' dictionary contains the following values: | ||
283 | 16 | .PP | ||
284 | 17 | .RS | ||
285 | 18 | title | ||
286 | 19 | .RE | ||
287 | 20 | .RS | ||
288 | 21 | subject | ||
289 | 22 | .RE | ||
290 | 23 | .RS | ||
291 | 24 | keywords | ||
292 | 25 | .RE | ||
293 | 26 | .RS | ||
294 | 27 | author | ||
295 | 28 | .RE | ||
296 | 29 | .RS | ||
297 | 30 | creator | ||
298 | 31 | .RE | ||
299 | 32 | .RS | ||
300 | 33 | producer | ||
301 | 34 | .RE | ||
302 | 35 | .RS | ||
303 | 36 | creation date | ||
304 | 37 | .RE | ||
305 | 38 | .RS | ||
306 | 39 | modification date | ||
307 | 40 | .RE | ||
308 | 41 | .PP | ||
309 | 42 | In addition, the following information is printed: | ||
310 | 43 | .PP | ||
311 | 44 | .RS | ||
312 | 45 | tagged (yes/no) | ||
313 | 46 | .RE | ||
314 | 47 | .RS | ||
315 | 48 | page count | ||
316 | 49 | .RE | ||
317 | 50 | .RS | ||
318 | 51 | encrypted flag (yes/no) | ||
319 | 52 | .RE | ||
320 | 53 | .RS | ||
321 | 54 | print and copy permissions (if encrypted) | ||
322 | 55 | .RE | ||
323 | 56 | .RS | ||
324 | 57 | page size | ||
325 | 58 | .RE | ||
326 | 59 | .RS | ||
327 | 60 | file size | ||
328 | 61 | .RE | ||
329 | 62 | .RS | ||
330 | 63 | linearized (yes/no) | ||
331 | 64 | .RE | ||
332 | 65 | .RS | ||
333 | 66 | PDF version | ||
334 | 67 | .RE | ||
335 | 68 | .RS | ||
336 | 69 | metadata (only if requested) | ||
337 | 70 | .RE | ||
338 | 71 | .SH CONFIGURATION FILE | ||
339 | 72 | Pdfinfo reads a configuration file at startup. It first tries to find | ||
340 | 73 | the user's private config file, ~/.xpdfrc. If that doesn't exist, it | ||
341 | 74 | looks for a system-wide config file, typically /usr/local/etc/xpdfrc | ||
342 | 75 | (but this location can be changed when pdfinfo is built). See the | ||
343 | 76 | .BR xpdfrc (5) | ||
344 | 77 | man page for details. | ||
345 | 78 | .SH OPTIONS | ||
346 | 79 | Many of the following options can be set with configuration file | ||
347 | 80 | commands. These are listed in square brackets with the description of | ||
348 | 81 | the corresponding command line option. | ||
349 | 82 | .TP | ||
350 | 83 | .BI \-f " number" | ||
351 | 84 | Specifies the first page to examine. If multiple pages are requested | ||
352 | 85 | using the "-f" and "-l" options, the size of each requested page (and, | ||
353 | 86 | optionally, the bounding boxes for each requested page) are printed. | ||
354 | 87 | Otherwise, only page one is examined. | ||
355 | 88 | .TP | ||
356 | 89 | .BI \-l " number" | ||
357 | 90 | Specifies the last page to examine. | ||
358 | 91 | .TP | ||
359 | 92 | .B \-box | ||
360 | 93 | Prints the page box bounding boxes: MediaBox, CropBox, BleedBox, | ||
361 | 94 | TrimBox, and ArtBox. | ||
362 | 95 | .TP | ||
363 | 96 | .B \-meta | ||
364 | 97 | Prints document-level metadata. (This is the "Metadata" stream from | ||
365 | 98 | the PDF file's Catalog object.) | ||
366 | 99 | .TP | ||
367 | 100 | .BI \-enc " encoding-name" | ||
368 | 101 | Sets the encoding to use for text output. The | ||
369 | 102 | .I encoding\-name | ||
370 | 103 | must be defined with the unicodeMap command (see | ||
371 | 104 | .BR xpdfrc (5)). | ||
372 | 105 | This defaults to "Latin1" (which is a built-in encoding). | ||
373 | 106 | .RB "[config file: " textEncoding ] | ||
374 | 107 | .TP | ||
375 | 108 | .BI \-opw " password" | ||
376 | 109 | Specify the owner password for the PDF file. Providing this will | ||
377 | 110 | bypass all security restrictions. | ||
378 | 111 | .TP | ||
379 | 112 | .BI \-upw " password" | ||
380 | 113 | Specify the user password for the PDF file. | ||
381 | 114 | .TP | ||
382 | 115 | .BI \-cfg " config-file" | ||
383 | 116 | Read | ||
384 | 117 | .I config-file | ||
385 | 118 | in place of ~/.xpdfrc or the system-wide config file. | ||
386 | 119 | .TP | ||
387 | 120 | .B \-v | ||
388 | 121 | Print copyright and version information. | ||
389 | 122 | .TP | ||
390 | 123 | .B \-h | ||
391 | 124 | Print usage information. | ||
392 | 125 | .RB ( \-help | ||
393 | 126 | and | ||
394 | 127 | .B \-\-help | ||
395 | 128 | are equivalent.) | ||
396 | 129 | .SH EXIT CODES | ||
397 | 130 | The Xpdf tools use the following exit codes: | ||
398 | 131 | .TP | ||
399 | 132 | 0 | ||
400 | 133 | No error. | ||
401 | 134 | .TP | ||
402 | 135 | 1 | ||
403 | 136 | Error opening a PDF file. | ||
404 | 137 | .TP | ||
405 | 138 | 2 | ||
406 | 139 | Error opening an output file. | ||
407 | 140 | .TP | ||
408 | 141 | 3 | ||
409 | 142 | Error related to PDF permissions. | ||
410 | 143 | .TP | ||
411 | 144 | 99 | ||
412 | 145 | Other error. | ||
413 | 146 | .SH AUTHOR | ||
414 | 147 | The pdfinfo software and documentation are copyright 1996-2007 Glyph & | ||
415 | 148 | Cog, LLC. | ||
416 | 149 | .SH "SEE ALSO" | ||
417 | 150 | .BR xpdf (1), | ||
418 | 151 | .BR pdftops (1), | ||
419 | 152 | .BR pdftotext (1), | ||
420 | 153 | .BR pdffonts (1), | ||
421 | 154 | .BR pdftoppm (1), | ||
422 | 155 | .BR pdfimages (1), | ||
423 | 156 | .BR xpdfrc (5) | ||
424 | 157 | .br | ||
425 | 158 | .B http://www.foolabs.com/xpdf/ | ||
426 | 0 | 159 | ||
427 | === added file '.pc/01_manpage.dpatch/doc/pdftoppm.1' | |||
428 | --- .pc/01_manpage.dpatch/doc/pdftoppm.1 1970-01-01 00:00:00 +0000 | |||
429 | +++ .pc/01_manpage.dpatch/doc/pdftoppm.1 2010-04-06 13:42:20 +0000 | |||
430 | @@ -0,0 +1,119 @@ | |||
431 | 1 | .\" Copyright 2005-2007 Glyph & Cog, LLC | ||
432 | 2 | .TH pdftoppm 1 "27 February 2007" | ||
433 | 3 | .SH NAME | ||
434 | 4 | pdftoppm \- Portable Document Format (PDF) to Portable Pixmap (PPM) | ||
435 | 5 | converter (version 3.02) | ||
436 | 6 | .SH SYNOPSIS | ||
437 | 7 | .B pdftoppm | ||
438 | 8 | [options] | ||
439 | 9 | .I PDF-file PPM-root | ||
440 | 10 | .SH DESCRIPTION | ||
441 | 11 | .B Pdftoppm | ||
442 | 12 | converts Portable Document Format (PDF) files to color image files in | ||
443 | 13 | Portable Pixmap (PPM) format, grayscale image files in Portable | ||
444 | 14 | Graymap (PGM) format, or monochrome image files in Portable Bitmap | ||
445 | 15 | (PBM) format. | ||
446 | 16 | .PP | ||
447 | 17 | Pdftoppm reads the PDF file, | ||
448 | 18 | .IR PDF-file , | ||
449 | 19 | and writes one PPM file for each page, | ||
450 | 20 | .IR PPM-root - nnnnnn .ppm, | ||
451 | 21 | where | ||
452 | 22 | .I nnnnnn | ||
453 | 23 | is the page number. | ||
454 | 24 | .SH CONFIGURATION FILE | ||
455 | 25 | Pdftoppm reads a configuration file at startup. It first tries to | ||
456 | 26 | find the user's private config file, ~/.xpdfrc. If that doesn't | ||
457 | 27 | exist, it looks for a system-wide config file, typically | ||
458 | 28 | /usr/local/etc/xpdfrc (but this location can be changed when pdftoppm | ||
459 | 29 | is built). See the | ||
460 | 30 | .BR xpdfrc (5) | ||
461 | 31 | man page for details. | ||
462 | 32 | .SH OPTIONS | ||
463 | 33 | Many of the following options can be set with configuration file | ||
464 | 34 | commands. These are listed in square brackets with the description of | ||
465 | 35 | the corresponding command line option. | ||
466 | 36 | .TP | ||
467 | 37 | .BI \-f " number" | ||
468 | 38 | Specifies the first page to convert. | ||
469 | 39 | .TP | ||
470 | 40 | .BI \-l " number" | ||
471 | 41 | Specifies the last page to convert. | ||
472 | 42 | .TP | ||
473 | 43 | .BI \-r " number" | ||
474 | 44 | Specifies the resolution, in DPI. The default is 150 DPI. | ||
475 | 45 | .TP | ||
476 | 46 | .B \-mono | ||
477 | 47 | Generate a monochrome PBM file (instead of a color PPM file). | ||
478 | 48 | .TP | ||
479 | 49 | .B \-gray | ||
480 | 50 | Generate a grayscale PGM file (instead of a color PPM file). | ||
481 | 51 | .TP | ||
482 | 52 | .BI \-t1lib " yes | no" | ||
483 | 53 | Enable or disable t1lib (a Type 1 font rasterizer). This defaults to | ||
484 | 54 | "yes". | ||
485 | 55 | .RB "[config file: " enableT1lib ] | ||
486 | 56 | .TP | ||
487 | 57 | .BI \-freetype " yes | no" | ||
488 | 58 | Enable or disable FreeType (a TrueType / Type 1 font rasterizer). | ||
489 | 59 | This defaults to "yes". | ||
490 | 60 | .RB "[config file: " enableFreeType ] | ||
491 | 61 | .TP | ||
492 | 62 | .BI \-aa " yes | no" | ||
493 | 63 | Enable or disable font anti-aliasing. This defaults to "yes". | ||
494 | 64 | .RB "[config file: " antialias ] | ||
495 | 65 | .TP | ||
496 | 66 | .BI \-aaVector " yes | no" | ||
497 | 67 | Enable or disable vector anti-aliasing. This defaults to "yes". | ||
498 | 68 | .RB "[config file: " vectorAntialias ] | ||
499 | 69 | .TP | ||
500 | 70 | .BI \-opw " password" | ||
501 | 71 | Specify the owner password for the PDF file. Providing this will | ||
502 | 72 | bypass all security restrictions. | ||
503 | 73 | .TP | ||
504 | 74 | .BI \-upw " password" | ||
505 | 75 | Specify the user password for the PDF file. | ||
506 | 76 | .TP | ||
507 | 77 | .B \-q | ||
508 | 78 | Don't print any messages or errors. | ||
509 | 79 | .RB "[config file: " errQuiet ] | ||
510 | 80 | .TP | ||
511 | 81 | .B \-v | ||
512 | 82 | Print copyright and version information. | ||
513 | 83 | .TP | ||
514 | 84 | .B \-h | ||
515 | 85 | Print usage information. | ||
516 | 86 | .RB ( \-help | ||
517 | 87 | and | ||
518 | 88 | .B \-\-help | ||
519 | 89 | are equivalent.) | ||
520 | 90 | .SH EXIT CODES | ||
521 | 91 | The Xpdf tools use the following exit codes: | ||
522 | 92 | .TP | ||
523 | 93 | 0 | ||
524 | 94 | No error. | ||
525 | 95 | .TP | ||
526 | 96 | 1 | ||
527 | 97 | Error opening a PDF file. | ||
528 | 98 | .TP | ||
529 | 99 | 2 | ||
530 | 100 | Error opening an output file. | ||
531 | 101 | .TP | ||
532 | 102 | 3 | ||
533 | 103 | Error related to PDF permissions. | ||
534 | 104 | .TP | ||
535 | 105 | 99 | ||
536 | 106 | Other error. | ||
537 | 107 | .SH AUTHOR | ||
538 | 108 | The pdftoppm software and documentation are copyright 1996-2007 Glyph | ||
539 | 109 | & Cog, LLC. | ||
540 | 110 | .SH "SEE ALSO" | ||
541 | 111 | .BR xpdf (1), | ||
542 | 112 | .BR pdftops (1), | ||
543 | 113 | .BR pdftotext (1), | ||
544 | 114 | .BR pdfinfo (1), | ||
545 | 115 | .BR pdffonts (1), | ||
546 | 116 | .BR pdfimages (1), | ||
547 | 117 | .BR xpdfrc (5) | ||
548 | 118 | .br | ||
549 | 119 | .B http://www.foolabs.com/xpdf/ | ||
550 | 0 | 120 | ||
551 | === added file '.pc/01_manpage.dpatch/doc/pdftops.1' | |||
552 | --- .pc/01_manpage.dpatch/doc/pdftops.1 1970-01-01 00:00:00 +0000 | |||
553 | +++ .pc/01_manpage.dpatch/doc/pdftops.1 2010-04-06 13:42:20 +0000 | |||
554 | @@ -0,0 +1,235 @@ | |||
555 | 1 | .\" Copyright 1996-2007 Glyph & Cog, LLC | ||
556 | 2 | .TH pdftops 1 "27 February 2007" | ||
557 | 3 | .SH NAME | ||
558 | 4 | pdftops \- Portable Document Format (PDF) to PostScript converter | ||
559 | 5 | (version 3.02) | ||
560 | 6 | .SH SYNOPSIS | ||
561 | 7 | .B pdftops | ||
562 | 8 | [options] | ||
563 | 9 | .RI [ PDF-file | ||
564 | 10 | .RI [ PS-file ]] | ||
565 | 11 | .SH DESCRIPTION | ||
566 | 12 | .B Pdftops | ||
567 | 13 | converts Portable Document Format (PDF) files to PostScript so they | ||
568 | 14 | can be printed. | ||
569 | 15 | .PP | ||
570 | 16 | Pdftops reads the PDF file, | ||
571 | 17 | .IR PDF-file , | ||
572 | 18 | and writes a PostScript file, | ||
573 | 19 | .IR PS-file . | ||
574 | 20 | If | ||
575 | 21 | .I PS-file | ||
576 | 22 | is not specified, pdftops converts | ||
577 | 23 | .I file.pdf | ||
578 | 24 | to | ||
579 | 25 | .I file.ps | ||
580 | 26 | (or | ||
581 | 27 | .I file.eps | ||
582 | 28 | with the -eps option). If | ||
583 | 29 | .I PS-file | ||
584 | 30 | is \'-', the PostScript is sent to stdout. | ||
585 | 31 | .SH CONFIGURATION FILE | ||
586 | 32 | Pdftops reads a configuration file at startup. It first tries to find | ||
587 | 33 | the user's private config file, ~/.xpdfrc. If that doesn't exist, it | ||
588 | 34 | looks for a system-wide config file, typically /usr/local/etc/xpdfrc | ||
589 | 35 | (but this location can be changed when pdftops is built). See the | ||
590 | 36 | .BR xpdfrc (5) | ||
591 | 37 | man page for details. | ||
592 | 38 | .SH OPTIONS | ||
593 | 39 | Many of the following options can be set with configuration file | ||
594 | 40 | commands. These are listed in square brackets with the description of | ||
595 | 41 | the corresponding command line option. | ||
596 | 42 | .TP | ||
597 | 43 | .BI \-f " number" | ||
598 | 44 | Specifies the first page to print. | ||
599 | 45 | .TP | ||
600 | 46 | .BI \-l " number" | ||
601 | 47 | Specifies the last page to print. | ||
602 | 48 | .TP | ||
603 | 49 | .B \-level1 | ||
604 | 50 | Generate Level 1 PostScript. The resulting PostScript files will be | ||
605 | 51 | significantly larger (if they contain images), but will print on Level | ||
606 | 52 | 1 printers. This also converts all images to black and white. No | ||
607 | 53 | more than one of the PostScript level options (-level1, -level1sep, | ||
608 | 54 | -level2, -level2sep, -level3, -level3Sep) may be given. | ||
609 | 55 | .RB "[config file: " psLevel ] | ||
610 | 56 | .TP | ||
611 | 57 | .B \-level1sep | ||
612 | 58 | Generate Level 1 separable PostScript. All colors are converted to | ||
613 | 59 | CMYK. Images are written with separate stream data for the four | ||
614 | 60 | components. | ||
615 | 61 | .RB "[config file: " psLevel ] | ||
616 | 62 | .TP | ||
617 | 63 | .B \-level2 | ||
618 | 64 | Generate Level 2 PostScript. Level 2 supports color images and image | ||
619 | 65 | compression. This is the default setting. | ||
620 | 66 | .RB "[config file: " psLevel ] | ||
621 | 67 | .TP | ||
622 | 68 | .B \-level2sep | ||
623 | 69 | Generate Level 2 separable PostScript. All colors are converted to | ||
624 | 70 | CMYK. The PostScript separation convention operators are used to | ||
625 | 71 | handle custom (spot) colors. | ||
626 | 72 | .RB "[config file: " psLevel ] | ||
627 | 73 | .TP | ||
628 | 74 | .B \-level3 | ||
629 | 75 | Generate Level 3 PostScript. This enables all Level 2 features plus | ||
630 | 76 | CID font embedding and masked image generation. | ||
631 | 77 | .RB "[config file: " psLevel ] | ||
632 | 78 | .TP | ||
633 | 79 | .B \-level3Sep | ||
634 | 80 | Generate Level 3 separable PostScript. The separation handling is the | ||
635 | 81 | same as for -level2Sep. | ||
636 | 82 | .RB "[config file: " psLevel ] | ||
637 | 83 | .TP | ||
638 | 84 | .B \-eps | ||
639 | 85 | Generate an Encapsulated PostScript (EPS) file. An EPS file contains | ||
640 | 86 | a single image, so if you use this option with a multi-page PDF file, | ||
641 | 87 | you must use -f and -l to specify a single page. No more than one of | ||
642 | 88 | the mode options (-eps, -form) may be given. | ||
643 | 89 | .TP | ||
644 | 90 | .B \-form | ||
645 | 91 | Generate a PostScript form which can be imported by software that | ||
646 | 92 | understands forms. A form contains a single page, so if you use this | ||
647 | 93 | option with a multi-page PDF file, you must use -f and -l to specify a | ||
648 | 94 | single page. The -level1 option cannot be used with -form. | ||
649 | 95 | .TP | ||
650 | 96 | .B \-opi | ||
651 | 97 | Generate OPI comments for all images and forms which have OPI | ||
652 | 98 | information. (This option is only available if pdftops was compiled | ||
653 | 99 | with OPI support.) | ||
654 | 100 | .RB "[config file: " psOPI ] | ||
655 | 101 | .TP | ||
656 | 102 | .B \-noembt1 | ||
657 | 103 | By default, any Type 1 fonts which are embedded in the PDF file are | ||
658 | 104 | copied into the PostScript file. This option causes pdftops to | ||
659 | 105 | substitute base fonts instead. Embedded fonts make PostScript files | ||
660 | 106 | larger, but may be necessary for readable output. | ||
661 | 107 | .RB "[config file: " psEmbedType1Fonts ] | ||
662 | 108 | .TP | ||
663 | 109 | .B \-noembtt | ||
664 | 110 | By default, any TrueType fonts which are embedded in the PDF file are | ||
665 | 111 | copied into the PostScript file. This option causes pdftops to | ||
666 | 112 | substitute base fonts instead. Embedded fonts make PostScript files | ||
667 | 113 | larger, but may be necessary for readable output. Also, some | ||
668 | 114 | PostScript interpreters do not have TrueType rasterizers. | ||
669 | 115 | .RB "[config file: " psEmbedTrueTypeFonts ] | ||
670 | 116 | .TP | ||
671 | 117 | .B \-noembcidps | ||
672 | 118 | By default, any CID PostScript fonts which are embedded in the PDF | ||
673 | 119 | file are copied into the PostScript file. This option disables that | ||
674 | 120 | embedding. No attempt is made to substitute for non-embedded CID | ||
675 | 121 | PostScript fonts. | ||
676 | 122 | .RB "[config file: " psEmbedCIDPostScriptFonts ] | ||
677 | 123 | .TP | ||
678 | 124 | .B \-noembcidtt | ||
679 | 125 | By default, any CID TrueType fonts which are embedded in the PDF file | ||
680 | 126 | are copied into the PostScript file. This option disables that | ||
681 | 127 | embedding. No attempt is made to substitute for non-embedded CID | ||
682 | 128 | TrueType fonts. | ||
683 | 129 | .RB "[config file: " psEmbedCIDTrueTypeFonts ] | ||
684 | 130 | .TP | ||
685 | 131 | .B \-preload | ||
686 | 132 | Convert PDF forms to PS procedures, and preload image data. This uses | ||
687 | 133 | more memory in the PostScript interpreter, but generates significantly | ||
688 | 134 | smaller PS files in situations where, e.g., the same image is drawn on | ||
689 | 135 | every page of a long document. | ||
690 | 136 | .TP | ||
691 | 137 | .BI \-paper " size" | ||
692 | 138 | Set the paper size to one of "letter", "legal", "A4", or "A3". This | ||
693 | 139 | can also be set to "match", which will set the paper size to match the | ||
694 | 140 | size specified in the PDF file. | ||
695 | 141 | .RB "[config file: " psPaperSize ] | ||
696 | 142 | .TP | ||
697 | 143 | .BI \-paperw " size" | ||
698 | 144 | Set the paper width, in points. | ||
699 | 145 | .RB "[config file: " psPaperSize ] | ||
700 | 146 | .TP | ||
701 | 147 | .BI \-paperh " size" | ||
702 | 148 | Set the paper height, in points. | ||
703 | 149 | .RB "[config file: " psPaperSize ] | ||
704 | 150 | .TP | ||
705 | 151 | .B \-nocrop | ||
706 | 152 | By default, output is cropped to the CropBox specified in the PDF | ||
707 | 153 | file. This option disables cropping. | ||
708 | 154 | .RB "[config file: " psCrop ] | ||
709 | 155 | .TP | ||
710 | 156 | .B \-expand | ||
711 | 157 | Expand PDF pages smaller than the paper to fill the paper. By | ||
712 | 158 | default, these pages are not scaled. | ||
713 | 159 | .RB "[config file: " psExpandSmaller ] | ||
714 | 160 | .TP | ||
715 | 161 | .B \-noshrink | ||
716 | 162 | Don't scale PDF pages which are larger than the paper. By default, | ||
717 | 163 | pages larger than the paper are shrunk to fit. | ||
718 | 164 | .RB "[config file: " psShrinkLarger ] | ||
719 | 165 | .TP | ||
720 | 166 | .B \-nocenter | ||
721 | 167 | By default, PDF pages smaller than the paper (after any scaling) are | ||
722 | 168 | centered on the paper. This option causes them to be aligned to the | ||
723 | 169 | lower-left corner of the paper instead. | ||
724 | 170 | .RB "[config file: " psCenter ] | ||
725 | 171 | .TP | ||
726 | 172 | .B \-pagecrop | ||
727 | 173 | Treat the CropBox as the PDF page size. By default, the MediaBox is | ||
728 | 174 | used as the page size. | ||
729 | 175 | .TP | ||
730 | 176 | .B \-duplex | ||
731 | 177 | Set the Duplex pagedevice entry in the PostScript file. This tells | ||
732 | 178 | duplex-capable printers to enable duplexing. | ||
733 | 179 | .RB "[config file: " psDuplex ] | ||
734 | 180 | .TP | ||
735 | 181 | .BI \-opw " password" | ||
736 | 182 | Specify the owner password for the PDF file. Providing this will | ||
737 | 183 | bypass all security restrictions. | ||
738 | 184 | .TP | ||
739 | 185 | .BI \-upw " password" | ||
740 | 186 | Specify the user password for the PDF file. | ||
741 | 187 | .TP | ||
742 | 188 | .B \-q | ||
743 | 189 | Don't print any messages or errors. | ||
744 | 190 | .RB "[config file: " errQuiet ] | ||
745 | 191 | .TP | ||
746 | 192 | .BI \-cfg " config-file" | ||
747 | 193 | Read | ||
748 | 194 | .I config-file | ||
749 | 195 | in place of ~/.xpdfrc or the system-wide config file. | ||
750 | 196 | .TP | ||
751 | 197 | .B \-v | ||
752 | 198 | Print copyright and version information. | ||
753 | 199 | .TP | ||
754 | 200 | .B \-h | ||
755 | 201 | Print usage information. | ||
756 | 202 | .RB ( \-help | ||
757 | 203 | and | ||
758 | 204 | .B \-\-help | ||
759 | 205 | are equivalent.) | ||
760 | 206 | .SH EXIT CODES | ||
761 | 207 | The Xpdf tools use the following exit codes: | ||
762 | 208 | .TP | ||
763 | 209 | 0 | ||
764 | 210 | No error. | ||
765 | 211 | .TP | ||
766 | 212 | 1 | ||
767 | 213 | Error opening a PDF file. | ||
768 | 214 | .TP | ||
769 | 215 | 2 | ||
770 | 216 | Error opening an output file. | ||
771 | 217 | .TP | ||
772 | 218 | 3 | ||
773 | 219 | Error related to PDF permissions. | ||
774 | 220 | .TP | ||
775 | 221 | 99 | ||
776 | 222 | Other error. | ||
777 | 223 | .SH AUTHOR | ||
778 | 224 | The pdftops software and documentation are copyright 1996-2007 Glyph & | ||
779 | 225 | Cog, LLC. | ||
780 | 226 | .SH "SEE ALSO" | ||
781 | 227 | .BR xpdf (1), | ||
782 | 228 | .BR pdftotext (1), | ||
783 | 229 | .BR pdfinfo (1), | ||
784 | 230 | .BR pdffonts (1), | ||
785 | 231 | .BR pdftoppm (1), | ||
786 | 232 | .BR pdfimages (1), | ||
787 | 233 | .BR xpdfrc (5) | ||
788 | 234 | .br | ||
789 | 235 | .B http://www.foolabs.com/xpdf/ | ||
790 | 0 | 236 | ||
791 | === added file '.pc/01_manpage.dpatch/doc/pdftotext.1' | |||
792 | --- .pc/01_manpage.dpatch/doc/pdftotext.1 1970-01-01 00:00:00 +0000 | |||
793 | +++ .pc/01_manpage.dpatch/doc/pdftotext.1 2010-04-06 13:42:20 +0000 | |||
794 | @@ -0,0 +1,137 @@ | |||
795 | 1 | .\" Copyright 1997-2007 Glyph & Cog, LLC | ||
796 | 2 | .TH pdftotext 1 "27 Febuary 2007" | ||
797 | 3 | .SH NAME | ||
798 | 4 | pdftotext \- Portable Document Format (PDF) to text converter | ||
799 | 5 | (version 3.02) | ||
800 | 6 | .SH SYNOPSIS | ||
801 | 7 | .B pdftotext | ||
802 | 8 | [options] | ||
803 | 9 | .RI [ PDF-file | ||
804 | 10 | .RI [ text-file ]] | ||
805 | 11 | .SH DESCRIPTION | ||
806 | 12 | .B Pdftotext | ||
807 | 13 | converts Portable Document Format (PDF) files to plain text. | ||
808 | 14 | .PP | ||
809 | 15 | Pdftotext reads the PDF file, | ||
810 | 16 | .IR PDF-file , | ||
811 | 17 | and writes a text file, | ||
812 | 18 | .IR text-file . | ||
813 | 19 | If | ||
814 | 20 | .I text-file | ||
815 | 21 | is not specified, pdftotext converts | ||
816 | 22 | .I file.pdf | ||
817 | 23 | to | ||
818 | 24 | .IR file.txt . | ||
819 | 25 | If | ||
820 | 26 | .I text-file | ||
821 | 27 | is \'-', the text is sent to stdout. | ||
822 | 28 | .SH CONFIGURATION FILE | ||
823 | 29 | Pdftotext reads a configuration file at startup. It first tries to | ||
824 | 30 | find the user's private config file, ~/.xpdfrc. If that doesn't | ||
825 | 31 | exist, it looks for a system-wide config file, typically | ||
826 | 32 | /usr/local/etc/xpdfrc (but this location can be changed when pdftotext | ||
827 | 33 | is built). See the | ||
828 | 34 | .BR xpdfrc (5) | ||
829 | 35 | man page for details. | ||
830 | 36 | .SH OPTIONS | ||
831 | 37 | Many of the following options can be set with configuration file | ||
832 | 38 | commands. These are listed in square brackets with the description of | ||
833 | 39 | the corresponding command line option. | ||
834 | 40 | .TP | ||
835 | 41 | .BI \-f " number" | ||
836 | 42 | Specifies the first page to convert. | ||
837 | 43 | .TP | ||
838 | 44 | .BI \-l " number" | ||
839 | 45 | Specifies the last page to convert. | ||
840 | 46 | .TP | ||
841 | 47 | .B \-layout | ||
842 | 48 | Maintain (as best as possible) the original physical layout of the | ||
843 | 49 | text. The default is to \'undo' physical layout (columns, | ||
844 | 50 | hyphenation, etc.) and output the text in reading order. | ||
845 | 51 | .TP | ||
846 | 52 | .B \-raw | ||
847 | 53 | Keep the text in content stream order. This is a hack which often | ||
848 | 54 | "undoes" column formatting, etc. Use of raw mode is no longer | ||
849 | 55 | recommended. | ||
850 | 56 | .TP | ||
851 | 57 | .B \-htmlmeta | ||
852 | 58 | Generate a simple HTML file, including the meta information. This | ||
853 | 59 | simply wraps the text in <pre> and </pre> and prepends the meta | ||
854 | 60 | headers. | ||
855 | 61 | .TP | ||
856 | 62 | .BI \-enc " encoding-name" | ||
857 | 63 | Sets the encoding to use for text output. The | ||
858 | 64 | .I encoding\-name | ||
859 | 65 | must be defined with the unicodeMap command (see | ||
860 | 66 | .BR xpdfrc (5)). | ||
861 | 67 | The encoding name is case-sensitive. This defaults to "Latin1" (which | ||
862 | 68 | is a built-in encoding). | ||
863 | 69 | .RB "[config file: " textEncoding ] | ||
864 | 70 | .TP | ||
865 | 71 | .BI \-eol " unix | dos | mac" | ||
866 | 72 | Sets the end-of-line convention to use for text output. | ||
867 | 73 | .RB "[config file: " textEOL ] | ||
868 | 74 | .TP | ||
869 | 75 | .B \-nopgbrk | ||
870 | 76 | Don't insert page breaks (form feed characters) between pages. | ||
871 | 77 | .RB "[config file: " textPageBreaks ] | ||
872 | 78 | .TP | ||
873 | 79 | .BI \-opw " password" | ||
874 | 80 | Specify the owner password for the PDF file. Providing this will | ||
875 | 81 | bypass all security restrictions. | ||
876 | 82 | .TP | ||
877 | 83 | .BI \-upw " password" | ||
878 | 84 | Specify the user password for the PDF file. | ||
879 | 85 | .TP | ||
880 | 86 | .B \-q | ||
881 | 87 | Don't print any messages or errors. | ||
882 | 88 | .RB "[config file: " errQuiet ] | ||
883 | 89 | .TP | ||
884 | 90 | .BI \-cfg " config-file" | ||
885 | 91 | Read | ||
886 | 92 | .I config-file | ||
887 | 93 | in place of ~/.xpdfrc or the system-wide config file. | ||
888 | 94 | .TP | ||
889 | 95 | .B \-v | ||
890 | 96 | Print copyright and version information. | ||
891 | 97 | .TP | ||
892 | 98 | .B \-h | ||
893 | 99 | Print usage information. | ||
894 | 100 | .RB ( \-help | ||
895 | 101 | and | ||
896 | 102 | .B \-\-help | ||
897 | 103 | are equivalent.) | ||
898 | 104 | .SH BUGS | ||
899 | 105 | Some PDF files contain fonts whose encodings have been mangled beyond | ||
900 | 106 | recognition. There is no way (short of OCR) to extract text from | ||
901 | 107 | these files. | ||
902 | 108 | .SH EXIT CODES | ||
903 | 109 | The Xpdf tools use the following exit codes: | ||
904 | 110 | .TP | ||
905 | 111 | 0 | ||
906 | 112 | No error. | ||
907 | 113 | .TP | ||
908 | 114 | 1 | ||
909 | 115 | Error opening a PDF file. | ||
910 | 116 | .TP | ||
911 | 117 | 2 | ||
912 | 118 | Error opening an output file. | ||
913 | 119 | .TP | ||
914 | 120 | 3 | ||
915 | 121 | Error related to PDF permissions. | ||
916 | 122 | .TP | ||
917 | 123 | 99 | ||
918 | 124 | Other error. | ||
919 | 125 | .SH AUTHOR | ||
920 | 126 | The pdftotext software and documentation are copyright 1996-2007 Glyph | ||
921 | 127 | & Cog, LLC. | ||
922 | 128 | .SH "SEE ALSO" | ||
923 | 129 | .BR xpdf (1), | ||
924 | 130 | .BR pdftops (1), | ||
925 | 131 | .BR pdfinfo (1), | ||
926 | 132 | .BR pdffonts (1), | ||
927 | 133 | .BR pdftoppm (1), | ||
928 | 134 | .BR pdfimages (1), | ||
929 | 135 | .BR xpdfrc (5) | ||
930 | 136 | .br | ||
931 | 137 | .B http://www.foolabs.com/xpdf/ | ||
932 | 0 | 138 | ||
933 | === added file '.pc/01_manpage.dpatch/doc/xpdf.1' | |||
934 | --- .pc/01_manpage.dpatch/doc/xpdf.1 1970-01-01 00:00:00 +0000 | |||
935 | +++ .pc/01_manpage.dpatch/doc/xpdf.1 2010-04-06 13:42:20 +0000 | |||
936 | @@ -0,0 +1,863 @@ | |||
937 | 1 | .\" Copyright 1996-2007 Glyph & Cog, LLC | ||
938 | 2 | .TH xpdf 1 "27 February 2007" | ||
939 | 3 | .SH NAME | ||
940 | 4 | xpdf \- Portable Document Format (PDF) file viewer for X (version 3.02) | ||
941 | 5 | .SH SYNOPSIS | ||
942 | 6 | .B xpdf | ||
943 | 7 | [options] | ||
944 | 8 | .RI [ PDF-file | ||
945 | 9 | .RI [ page " | +" dest ]] | ||
946 | 10 | .SH DESCRIPTION | ||
947 | 11 | .B Xpdf | ||
948 | 12 | is a viewer for Portable Document Format (PDF) files. (These are also | ||
949 | 13 | sometimes also called \'Acrobat' files, from the name of Adobe's PDF | ||
950 | 14 | software.) Xpdf runs under the X Window System on UNIX, VMS, and | ||
951 | 15 | OS/2. | ||
952 | 16 | .PP | ||
953 | 17 | To run xpdf, simply type: | ||
954 | 18 | .PP | ||
955 | 19 | .RS | ||
956 | 20 | xpdf file.pdf | ||
957 | 21 | .RE | ||
958 | 22 | .PP | ||
959 | 23 | where | ||
960 | 24 | .I file.pdf | ||
961 | 25 | is your PDF file. The file name can be followed by a number | ||
962 | 26 | specifying the page which should be displayed first, e.g.: | ||
963 | 27 | .PP | ||
964 | 28 | .RS | ||
965 | 29 | xpdf file.pdf 18 | ||
966 | 30 | .RE | ||
967 | 31 | .PP | ||
968 | 32 | You can also give a named destination, prefixed with \'+' in place of | ||
969 | 33 | the page number. (This is only useful with PDF files that provide | ||
970 | 34 | named destination targets.) | ||
971 | 35 | .PP | ||
972 | 36 | You can also start xpdf without opening any files: | ||
973 | 37 | .PP | ||
974 | 38 | .RS | ||
975 | 39 | xpdf | ||
976 | 40 | .RE | ||
977 | 41 | .SH CONFIGURATION FILE | ||
978 | 42 | Xpdf reads a configuration file at startup. It first tries to find | ||
979 | 43 | the user's private config file, ~/.xpdfrc. If that doesn't exist, it | ||
980 | 44 | looks for a system-wide config file, typically /usr/local/etc/xpdfrc | ||
981 | 45 | (but this location can be changed when xpdf is built). See the | ||
982 | 46 | .BR xpdfrc (5) | ||
983 | 47 | man page for details. | ||
984 | 48 | .SH OPTIONS | ||
985 | 49 | Many of the following options can be set with configuration file | ||
986 | 50 | commands or X resources. These are listed in square brackets with the | ||
987 | 51 | description of the corresponding command line option. | ||
988 | 52 | .TP | ||
989 | 53 | .BI \-g " geometry" | ||
990 | 54 | Set the initial window geometry. | ||
991 | 55 | .RB ( \-geometry | ||
992 | 56 | is equivalent.) | ||
993 | 57 | .RB "[X resource: " xpdf.geometry ] | ||
994 | 58 | .TP | ||
995 | 59 | .BI \-title " title" | ||
996 | 60 | Set the window title. By default, the title will be "xpdf: foo.pdf". | ||
997 | 61 | .RB "[X resource: " xpdf.title ] | ||
998 | 62 | .TP | ||
999 | 63 | .B \-cmap | ||
1000 | 64 | Install a private colormap. This is ignored on TrueColor visuals. | ||
1001 | 65 | .RB "[X resource: " xpdf.installCmap ] | ||
1002 | 66 | .TP | ||
1003 | 67 | .BI \-rgb " number" | ||
1004 | 68 | Set the size of largest RGB cube xpdf will try to allocate. The | ||
1005 | 69 | default is 5 (for a 5x5x5 cube); set to a smaller number to conserve | ||
1006 | 70 | color table entries. This is ignored with private colormaps and on | ||
1007 | 71 | TrueColor visuals. | ||
1008 | 72 | .RB "[X resource: " xpdf.rgbCubeSize ] | ||
1009 | 73 | .TP | ||
1010 | 74 | .B \-rv | ||
1011 | 75 | Set reverse video mode. This reverses the colors of everything except | ||
1012 | 76 | images. It may not always produce great results for PDF files which | ||
1013 | 77 | do weird things with color. This also causes the paper color to | ||
1014 | 78 | default to black. | ||
1015 | 79 | .RB "[X resource: " xpdf.reverseVideo ] | ||
1016 | 80 | .TP | ||
1017 | 81 | .BI \-papercolor " color" | ||
1018 | 82 | Set the "paper color", i.e., the background of the page display. This | ||
1019 | 83 | will not work too well with PDF files that do things like filling in | ||
1020 | 84 | white behind the text. | ||
1021 | 85 | .RB "[X resource: " xpdf.paperColor ] | ||
1022 | 86 | .TP | ||
1023 | 87 | .BI \-mattecolor " color" | ||
1024 | 88 | Set the matte color, i.e., the color used for background outside the | ||
1025 | 89 | actual page area. (There is a separate setting, | ||
1026 | 90 | xpdf.fullScreenMatteColor, for full-screen mode.) | ||
1027 | 91 | .RB "[X resource: " xpdf.matteColor ] | ||
1028 | 92 | .TP | ||
1029 | 93 | .BI \-z " zoom" | ||
1030 | 94 | Set the initial zoom factor. A number specifies a zoom percentage, | ||
1031 | 95 | where 100 means 72 dpi.You may also specify \'page', to fit the page | ||
1032 | 96 | to the window size, or \'width', to fit the page width to the window | ||
1033 | 97 | width. | ||
1034 | 98 | .RB "[config file: " initialZoom "; or X resource: " xpdf.initialZoom ] | ||
1035 | 99 | .TP | ||
1036 | 100 | .B \-cont | ||
1037 | 101 | Start in continuous view mode, i.e., with one vertical scroll bar for | ||
1038 | 102 | the whole document. | ||
1039 | 103 | .RB "[config file: " continuousView ] | ||
1040 | 104 | .TP | ||
1041 | 105 | .BI \-t1lib " yes | no" | ||
1042 | 106 | Enable or disable t1lib (a Type 1 font rasterizer). This defaults to | ||
1043 | 107 | "yes". | ||
1044 | 108 | .RB "[config file: " enableT1lib ] | ||
1045 | 109 | .TP | ||
1046 | 110 | .BI \-freetype " yes | no" | ||
1047 | 111 | Enable or disable FreeType (a TrueType / Type 1 font rasterizer). | ||
1048 | 112 | This defaults to "yes". | ||
1049 | 113 | .RB "[config file: " enableFreeType ] | ||
1050 | 114 | .TP | ||
1051 | 115 | .BI \-aa " yes | no" | ||
1052 | 116 | Enable or disable font anti-aliasing. This defaults to "yes". | ||
1053 | 117 | .RB "[config file: " antialias ] | ||
1054 | 118 | .TP | ||
1055 | 119 | .BI \-aaVector " yes | no" | ||
1056 | 120 | Enable or disable vector anti-aliasing. This defaults to "yes". | ||
1057 | 121 | .RB "[config file: " vectorAntialias ] | ||
1058 | 122 | .TP | ||
1059 | 123 | .BI \-ps " PS-file" | ||
1060 | 124 | Set the default file name for PostScript output (i.e., the name which | ||
1061 | 125 | will appear in the print dialog). This can also be of the form | ||
1062 | 126 | \'|command' to pipe the PostScript through a command. | ||
1063 | 127 | .RB "[config file: " psFile ] | ||
1064 | 128 | .TP | ||
1065 | 129 | .BI \-paper " size" | ||
1066 | 130 | Set the paper size to one of "letter", "legal", "A4", or "A3". This | ||
1067 | 131 | can also be set to "match", which will set the paper size to match the | ||
1068 | 132 | size specified in the PDF file. | ||
1069 | 133 | .RB "[config file: " psPaperSize ] | ||
1070 | 134 | .TP | ||
1071 | 135 | .BI \-paperw " size" | ||
1072 | 136 | Set the paper width, in points. | ||
1073 | 137 | .RB "[config file: " psPaperSize ] | ||
1074 | 138 | .TP | ||
1075 | 139 | .BI \-paperh " size" | ||
1076 | 140 | Set the paper height, in points. | ||
1077 | 141 | .RB "[config file: " psPaperSize ] | ||
1078 | 142 | .TP | ||
1079 | 143 | .B \-level1 | ||
1080 | 144 | Generate Level 1 PostScript. The resulting PostScript files will be | ||
1081 | 145 | significantly larger (if they contain images), but will print on Level | ||
1082 | 146 | 1 printers. This also converts all images to black and white. | ||
1083 | 147 | .RB "[config file: " psLevel ] | ||
1084 | 148 | .TP | ||
1085 | 149 | .BI \-enc " encoding-name" | ||
1086 | 150 | Sets the encoding to use for text output. The | ||
1087 | 151 | .I encoding\-name | ||
1088 | 152 | must be defined with the unicodeMap command (see | ||
1089 | 153 | .BR xpdfrc (5)). | ||
1090 | 154 | This defaults to "Latin1" (which is a built-in encoding). | ||
1091 | 155 | .RB "[config file: " textEncoding ] | ||
1092 | 156 | .TP | ||
1093 | 157 | .BI \-eol " unix | dos | mac" | ||
1094 | 158 | Sets the end-of-line convention to use for text output. | ||
1095 | 159 | .RB "[config file: " textEOL ] | ||
1096 | 160 | .TP | ||
1097 | 161 | .BI \-opw " password" | ||
1098 | 162 | Specify the owner password for the PDF file. Providing this will | ||
1099 | 163 | bypass all security restrictions. | ||
1100 | 164 | .TP | ||
1101 | 165 | .BI \-upw " password" | ||
1102 | 166 | Specify the user password for the PDF file. | ||
1103 | 167 | .TP | ||
1104 | 168 | .B \-fullscreen | ||
1105 | 169 | Open xpdf in full-screen mode, useful for presentations. | ||
1106 | 170 | .TP | ||
1107 | 171 | .BI \-remote " name" | ||
1108 | 172 | Start/contact xpdf remote server with specified name (see the | ||
1109 | 173 | .B "REMOTE SERVER MODE" | ||
1110 | 174 | section below). | ||
1111 | 175 | .TP | ||
1112 | 176 | .BI \-exec " command" | ||
1113 | 177 | Execute a command (see the | ||
1114 | 178 | .B COMMANDS | ||
1115 | 179 | section below) in an xpdf remote server window (with -remote only). | ||
1116 | 180 | .TP | ||
1117 | 181 | .B \-reload | ||
1118 | 182 | Reload xpdf remote server window (with -remote only). | ||
1119 | 183 | .TP | ||
1120 | 184 | .B \-raise | ||
1121 | 185 | Raise xpdf remote server window (with -remote only). | ||
1122 | 186 | .TP | ||
1123 | 187 | .B \-quit | ||
1124 | 188 | Kill xpdf remote server (with -remote only). | ||
1125 | 189 | .TP | ||
1126 | 190 | .B \-cmd | ||
1127 | 191 | Print commands as they're executed (useful for debugging). | ||
1128 | 192 | .RB "[config file: " printCommands ] | ||
1129 | 193 | .TP | ||
1130 | 194 | .B \-q | ||
1131 | 195 | Don't print any messages or errors. | ||
1132 | 196 | .RB "[config file: " errQuiet ] | ||
1133 | 197 | .TP | ||
1134 | 198 | .BI \-cfg " config-file" | ||
1135 | 199 | Read | ||
1136 | 200 | .I config-file | ||
1137 | 201 | in place of ~/.xpdfrc or the system-wide config file. | ||
1138 | 202 | .TP | ||
1139 | 203 | .B \-v | ||
1140 | 204 | Print copyright and version information. | ||
1141 | 205 | .TP | ||
1142 | 206 | .B \-h | ||
1143 | 207 | Print usage information. | ||
1144 | 208 | .RB ( \-help | ||
1145 | 209 | and | ||
1146 | 210 | .B \-\-help | ||
1147 | 211 | are equivalent.) | ||
1148 | 212 | .PP | ||
1149 | 213 | Several other standard X options and resources will work as expected: | ||
1150 | 214 | .TP | ||
1151 | 215 | .BI \-display " display" | ||
1152 | 216 | .RB "[X resource: " xpdf.display ] | ||
1153 | 217 | .TP | ||
1154 | 218 | .BI \-fg " color" | ||
1155 | 219 | .RB ( \-foreground | ||
1156 | 220 | is equivalent.) | ||
1157 | 221 | .RB "[X resource: " xpdf*Foreground ] | ||
1158 | 222 | .TP | ||
1159 | 223 | .BI \-bg " color" | ||
1160 | 224 | .RB ( \-background | ||
1161 | 225 | is equivalent.) | ||
1162 | 226 | .RB "[X resource: " xpdf*Background ] | ||
1163 | 227 | .TP | ||
1164 | 228 | .BI \-font " font" | ||
1165 | 229 | .RB ( \-fn | ||
1166 | 230 | is equivalent.) | ||
1167 | 231 | .RB "[X resource: " xpdf*fontList ] | ||
1168 | 232 | .PP | ||
1169 | 233 | The color and font options only affect the user interface elements, | ||
1170 | 234 | not the PDF display (the \'paper'). | ||
1171 | 235 | .PP | ||
1172 | 236 | The following X resources do not have command line option equivalents: | ||
1173 | 237 | .TP | ||
1174 | 238 | .B xpdf.toolTipEnable | ||
1175 | 239 | Enables (if set to true) or disables (if set to false) the tool-tips | ||
1176 | 240 | on the toolbar buttons. | ||
1177 | 241 | .TP | ||
1178 | 242 | .B xpdf.fullScreenMatteColor | ||
1179 | 243 | Sets the matte color to be used in full-screen mode. The default | ||
1180 | 244 | setting is "black". | ||
1181 | 245 | .SH CONTROLS | ||
1182 | 246 | .SS On-screen controls, at the bottom of the xpdf window | ||
1183 | 247 | .TP | ||
1184 | 248 | .B "left/right arrow buttons" | ||
1185 | 249 | Move to the previous/next page. | ||
1186 | 250 | .TP | ||
1187 | 251 | .B "double left/right arrow buttons" | ||
1188 | 252 | Move backward or forward by ten pages. | ||
1189 | 253 | .TP | ||
1190 | 254 | .B "dashed left/right arrow buttons" | ||
1191 | 255 | Move backward or forward along the history path. | ||
1192 | 256 | .TP | ||
1193 | 257 | .B "\'Page' entry box" | ||
1194 | 258 | Move to a specific page number. Click in the box to activate it, type | ||
1195 | 259 | the page number, then hit return. | ||
1196 | 260 | .TP | ||
1197 | 261 | .B "zoom popup menu" | ||
1198 | 262 | Change the zoom factor (see the description of the -z option above). | ||
1199 | 263 | .TP | ||
1200 | 264 | .B "binoculars button" | ||
1201 | 265 | Find a text string. | ||
1202 | 266 | .TP | ||
1203 | 267 | .B "print button" | ||
1204 | 268 | Bring up a dialog for generating a PostScript file. The dialog has | ||
1205 | 269 | options to set the pages to be printed and the PostScript file name. | ||
1206 | 270 | The file name can be \'-' for stdout or \'|command' to pipe the | ||
1207 | 271 | PostScript through a command, e.g., \'|lpr'. | ||
1208 | 272 | .TP | ||
1209 | 273 | .B "\'?' button" | ||
1210 | 274 | Bring up the \'about xpdf' window. | ||
1211 | 275 | .TP | ||
1212 | 276 | .B "link info" | ||
1213 | 277 | The space between the \'?' and \'Quit' buttons is used to show the URL | ||
1214 | 278 | or external file name when the mouse is over a link. | ||
1215 | 279 | .TP | ||
1216 | 280 | .B "\'Quit' button" | ||
1217 | 281 | Quit xpdf. | ||
1218 | 282 | .PP | ||
1219 | 283 | .SS Menu | ||
1220 | 284 | Pressing the right mouse button will post a popup menu with the | ||
1221 | 285 | following commands: | ||
1222 | 286 | .TP | ||
1223 | 287 | .B "Open..." | ||
1224 | 288 | Open a new PDF file via a file requester. | ||
1225 | 289 | .TP | ||
1226 | 290 | .B "Open in new window..." | ||
1227 | 291 | Create a new window and open a new PDF file via a file requester. | ||
1228 | 292 | .TP | ||
1229 | 293 | .B "Reload" | ||
1230 | 294 | Reload the current PDF file. Note that Xpdf will reload the file | ||
1231 | 295 | automatically (on a page change or redraw) if it has changed since it | ||
1232 | 296 | was last loaded. | ||
1233 | 297 | .TP | ||
1234 | 298 | .B "Save as..." | ||
1235 | 299 | Save the current file via a file requester. | ||
1236 | 300 | .TP | ||
1237 | 301 | .B "Continuous view" | ||
1238 | 302 | Toggles between single page and continuous view modes. | ||
1239 | 303 | .TP | ||
1240 | 304 | .B "Rotate counterclockwise" | ||
1241 | 305 | Rotate the page 90 degrees counterclockwise. | ||
1242 | 306 | .TP | ||
1243 | 307 | .B "Rotate clockwise" | ||
1244 | 308 | Rotate the page 90 degrees clockwise. The two rotate commands are | ||
1245 | 309 | intended primarily for PDF files where the rotation isn't correctly | ||
1246 | 310 | specified in the file. | ||
1247 | 311 | .TP | ||
1248 | 312 | .B "Zoom to selection" | ||
1249 | 313 | Zoom in to the currently selected rectangle. | ||
1250 | 314 | .TP | ||
1251 | 315 | .B "Close" | ||
1252 | 316 | Close the current window. If this is the only open window, the | ||
1253 | 317 | document is closed, but the window is left open (i.e., this menu | ||
1254 | 318 | command won't quit xpdf). | ||
1255 | 319 | .TP | ||
1256 | 320 | .B "Quit" | ||
1257 | 321 | Quit xpdf. | ||
1258 | 322 | .PP | ||
1259 | 323 | .SS Outline | ||
1260 | 324 | If the PDF contains an outline (a.k.a., bookmarks), there will be an | ||
1261 | 325 | outline pane on the left side of the window. The width of the outline | ||
1262 | 326 | pane is adjustable with a vertical split bar via the knob near its | ||
1263 | 327 | bottom end. | ||
1264 | 328 | .PP | ||
1265 | 329 | .SS Text selection | ||
1266 | 330 | Dragging the mouse with the left button held down will highlight an | ||
1267 | 331 | arbitrary rectangle. Any text inside this rectangle will be copied to | ||
1268 | 332 | the X selection buffer. | ||
1269 | 333 | .PP | ||
1270 | 334 | .SS Links | ||
1271 | 335 | Clicking on a hyperlink will jump to the link's destination. A link | ||
1272 | 336 | to another PDF document will make xpdf load that document. A | ||
1273 | 337 | \'launch' link to an executable program will display a dialog, and if | ||
1274 | 338 | you click \'ok', execute the program. URL links call an external | ||
1275 | 339 | command (see the | ||
1276 | 340 | .B WEB BROWSERS | ||
1277 | 341 | section below). | ||
1278 | 342 | .PP | ||
1279 | 343 | .SS Panning | ||
1280 | 344 | Dragging the mouse with the middle button held down pans the window. | ||
1281 | 345 | .PP | ||
1282 | 346 | .SS Key bindings | ||
1283 | 347 | .TP | ||
1284 | 348 | .B o | ||
1285 | 349 | Open a new PDF file via a file requester. | ||
1286 | 350 | .TP | ||
1287 | 351 | .B r | ||
1288 | 352 | Reload the current PDF file. Note that Xpdf will reload the file | ||
1289 | 353 | automatically (on a page change or redraw) if it has changed since it | ||
1290 | 354 | was last loaded. | ||
1291 | 355 | .TP | ||
1292 | 356 | .B control-L | ||
1293 | 357 | Redraw the current page. | ||
1294 | 358 | .TP | ||
1295 | 359 | .B control-W | ||
1296 | 360 | Close the current window. | ||
1297 | 361 | .TP | ||
1298 | 362 | .B f or control-F | ||
1299 | 363 | Find a text string. | ||
1300 | 364 | .TP | ||
1301 | 365 | .B control-G | ||
1302 | 366 | Find next occurrence. | ||
1303 | 367 | .TP | ||
1304 | 368 | .B control-P | ||
1305 | 369 | Print. | ||
1306 | 370 | .TP | ||
1307 | 371 | .B n | ||
1308 | 372 | Move to the next page. Scrolls to the top of the page, unless scroll | ||
1309 | 373 | lock is turned on. | ||
1310 | 374 | .TP | ||
1311 | 375 | .B p | ||
1312 | 376 | Move to the previous page. Scrolls to the top of the page, unless | ||
1313 | 377 | scroll lock is turned on. | ||
1314 | 378 | .TP | ||
1315 | 379 | .BR <Space> " or " <PageDown> " or " <Next> | ||
1316 | 380 | Scroll down on the current page; if already at bottom, move to next | ||
1317 | 381 | page. | ||
1318 | 382 | .TP | ||
1319 | 383 | .BR <Backspace> " or " <Delete> " or " <PageUp> " or " <Previous> | ||
1320 | 384 | Scroll up on the current page; if already at top, move to previous | ||
1321 | 385 | page. | ||
1322 | 386 | .TP | ||
1323 | 387 | .B v | ||
1324 | 388 | Move forward along the history path. | ||
1325 | 389 | .TP | ||
1326 | 390 | .B b | ||
1327 | 391 | Move backward along the history path. | ||
1328 | 392 | .TP | ||
1329 | 393 | .B <Home> | ||
1330 | 394 | Scroll to top of current page. | ||
1331 | 395 | .TP | ||
1332 | 396 | .B <End> | ||
1333 | 397 | Scroll to bottom of current page. | ||
1334 | 398 | .TP | ||
1335 | 399 | .B control-<Home> | ||
1336 | 400 | Scroll to first page of document. | ||
1337 | 401 | .TP | ||
1338 | 402 | .B control-<End> | ||
1339 | 403 | Scroll to last page of document. | ||
1340 | 404 | .TP | ||
1341 | 405 | .B arrows | ||
1342 | 406 | Scroll the current page. | ||
1343 | 407 | .TP | ||
1344 | 408 | .B g | ||
1345 | 409 | Activate the page number text field ("goto page"). | ||
1346 | 410 | .TP | ||
1347 | 411 | .B 0 | ||
1348 | 412 | Set the zoom factor to 125%. | ||
1349 | 413 | .TP | ||
1350 | 414 | .B + | ||
1351 | 415 | Zoom in (increment the zoom factor by 1). | ||
1352 | 416 | .TP | ||
1353 | 417 | .B - | ||
1354 | 418 | Zoom out (decrement the zoom factor by 1). | ||
1355 | 419 | .TP | ||
1356 | 420 | .B z | ||
1357 | 421 | Set the zoom factor to 'page' (fit page to window). | ||
1358 | 422 | .TP | ||
1359 | 423 | .B w | ||
1360 | 424 | Set the zoom factor to 'width' (fit page width to window). | ||
1361 | 425 | .TP | ||
1362 | 426 | .B alt-F | ||
1363 | 427 | Toggle full-screen mode. | ||
1364 | 428 | .TP | ||
1365 | 429 | .B q | ||
1366 | 430 | Quit xpdf. | ||
1367 | 431 | .SH "WEB BROWSERS" | ||
1368 | 432 | If you want to run xpdf automatically from netscape or mosaic (and | ||
1369 | 433 | probably other browsers) when you click on a link to a PDF file, you | ||
1370 | 434 | need to edit (or create) the files | ||
1371 | 435 | .I .mime.types | ||
1372 | 436 | and | ||
1373 | 437 | .I .mailcap | ||
1374 | 438 | in your home directory. In | ||
1375 | 439 | .I .mime.types | ||
1376 | 440 | add the line: | ||
1377 | 441 | .PP | ||
1378 | 442 | .RS | ||
1379 | 443 | application/pdf pdf | ||
1380 | 444 | .RE | ||
1381 | 445 | .PP | ||
1382 | 446 | In | ||
1383 | 447 | .I .mailcap | ||
1384 | 448 | add the lines: | ||
1385 | 449 | .PP | ||
1386 | 450 | .RS | ||
1387 | 451 | # Use xpdf to view PDF files. | ||
1388 | 452 | .RE | ||
1389 | 453 | .RS | ||
1390 | 454 | application/pdf; xpdf -q %s | ||
1391 | 455 | .RE | ||
1392 | 456 | .PP | ||
1393 | 457 | Make sure that xpdf is on your executable search path. | ||
1394 | 458 | .PP | ||
1395 | 459 | When you click on a URL link in a PDF file, xpdf will execute the | ||
1396 | 460 | command specified by the urlCommand config file option, replacing an | ||
1397 | 461 | occurrence of \'%s' with the URL. For example, to call netscape with | ||
1398 | 462 | the URL, add this line to your config file: | ||
1399 | 463 | .PP | ||
1400 | 464 | .RS | ||
1401 | 465 | urlCommand "netscape -remote 'openURL(%s)'" | ||
1402 | 466 | .RE | ||
1403 | 467 | .SH COMMANDS | ||
1404 | 468 | Xpdf's key and mouse bindings are user-configurable, using the bind and | ||
1405 | 469 | unbind options in the config file (see | ||
1406 | 470 | .BR xpdfrc (5)). | ||
1407 | 471 | The bind command allows you to bind a key or mouse button to a | ||
1408 | 472 | sequence of one or more commands. | ||
1409 | 473 | .SS Available Commands | ||
1410 | 474 | The following commands are supported: | ||
1411 | 475 | .TP | ||
1412 | 476 | .BI gotoPage( page ) | ||
1413 | 477 | Go to the specified page. | ||
1414 | 478 | .TP | ||
1415 | 479 | .BI gotoPageNoScroll( page ) | ||
1416 | 480 | Go to the specified page, with the current relative scroll position. | ||
1417 | 481 | .TP | ||
1418 | 482 | .BI gotoDest( dest ) | ||
1419 | 483 | Go to a named destination. | ||
1420 | 484 | .TP | ||
1421 | 485 | .B gotoLastPage | ||
1422 | 486 | Go to the last page in the PDF file. | ||
1423 | 487 | .TP | ||
1424 | 488 | .B gotoLastPageNoScroll | ||
1425 | 489 | Go to the last page in the PDF file, with the current relative scroll | ||
1426 | 490 | position. | ||
1427 | 491 | .TP | ||
1428 | 492 | .B nextPage | ||
1429 | 493 | Go to the next page. | ||
1430 | 494 | .TP | ||
1431 | 495 | .B nextPageNoScroll | ||
1432 | 496 | Go to the next page, with the current relative scroll position. | ||
1433 | 497 | .TP | ||
1434 | 498 | .B prevPage | ||
1435 | 499 | Go to the previous page. | ||
1436 | 500 | .TP | ||
1437 | 501 | .B prevPageNoScroll | ||
1438 | 502 | Go to the previous page, with the current relative scroll position. | ||
1439 | 503 | .TP | ||
1440 | 504 | .B pageUp | ||
1441 | 505 | Scroll up by one screenful. | ||
1442 | 506 | .TP | ||
1443 | 507 | .B pageDown | ||
1444 | 508 | Scroll down by one screenful. | ||
1445 | 509 | .TP | ||
1446 | 510 | .BI scrollLeft( n ) | ||
1447 | 511 | Scroll left by | ||
1448 | 512 | .I n | ||
1449 | 513 | pixels. | ||
1450 | 514 | .TP | ||
1451 | 515 | .BI scrollRight( n ) | ||
1452 | 516 | Scroll right by | ||
1453 | 517 | .I n | ||
1454 | 518 | pixels. | ||
1455 | 519 | .TP | ||
1456 | 520 | .BI scrollUp( n ) | ||
1457 | 521 | Scroll up by | ||
1458 | 522 | .I n | ||
1459 | 523 | pixels. | ||
1460 | 524 | .TP | ||
1461 | 525 | .BI scrollDown( n ) | ||
1462 | 526 | Scroll down by | ||
1463 | 527 | .I n | ||
1464 | 528 | pixels. | ||
1465 | 529 | .TP | ||
1466 | 530 | .BI scrollUpPrevPage( n ) | ||
1467 | 531 | Scroll up by | ||
1468 | 532 | .I n | ||
1469 | 533 | pixels, moving to the previous page if appropriate. | ||
1470 | 534 | .TP | ||
1471 | 535 | .BI scrollDownPrevPage( n ) | ||
1472 | 536 | Scroll down by | ||
1473 | 537 | .I n | ||
1474 | 538 | pixels, moving to the next page if appropriate. | ||
1475 | 539 | .TP | ||
1476 | 540 | .B scrollToTopEdge | ||
1477 | 541 | Scroll to the top edge of the current page, with no horizontal | ||
1478 | 542 | movement. | ||
1479 | 543 | .TP | ||
1480 | 544 | .B scrollToBottomEdge | ||
1481 | 545 | Scroll to the bottom edge of the current page, with no horizontal | ||
1482 | 546 | movement. | ||
1483 | 547 | .TP | ||
1484 | 548 | .B scrollToLeftEdge | ||
1485 | 549 | Scroll to the left edge of the current page, with no vertical | ||
1486 | 550 | movement. | ||
1487 | 551 | .TP | ||
1488 | 552 | .B scrollToRightEdge | ||
1489 | 553 | Scroll to the right edge of the current page, with no vertical | ||
1490 | 554 | movement. | ||
1491 | 555 | .TP | ||
1492 | 556 | .B scrollToTopLeft | ||
1493 | 557 | Scroll to the top-left corner of the current page. | ||
1494 | 558 | .TP | ||
1495 | 559 | .B scrollToBottomRight | ||
1496 | 560 | Scroll to the bottom-right corner of the current page. | ||
1497 | 561 | .TP | ||
1498 | 562 | .B goForward | ||
1499 | 563 | Move forward along the history path. | ||
1500 | 564 | .TP | ||
1501 | 565 | .B goBackward | ||
1502 | 566 | Move backward along the history path. | ||
1503 | 567 | .TP | ||
1504 | 568 | .BI zoomPercent( z ) | ||
1505 | 569 | Set the zoom factor to | ||
1506 | 570 | .IR z %. | ||
1507 | 571 | .TP | ||
1508 | 572 | .B zoomFitPage | ||
1509 | 573 | Set the zoom factor to fit-page. | ||
1510 | 574 | .TP | ||
1511 | 575 | .B zoomFitWidth | ||
1512 | 576 | Set the zoom factor to fit-width. | ||
1513 | 577 | .TP | ||
1514 | 578 | .B zoomIn | ||
1515 | 579 | Zoom in - go to the next higher zoom factor. | ||
1516 | 580 | .TP | ||
1517 | 581 | .B zoomOut | ||
1518 | 582 | Zoom out - go the next lower zoom factor. | ||
1519 | 583 | .TP | ||
1520 | 584 | .B continuousMode | ||
1521 | 585 | Go to continuous view mode. | ||
1522 | 586 | .TP | ||
1523 | 587 | .B singlePageMode | ||
1524 | 588 | Go to single-page view mode. | ||
1525 | 589 | .TP | ||
1526 | 590 | .B toggleContinuousMode | ||
1527 | 591 | Toggle between continuous and single page view modes. | ||
1528 | 592 | .TP | ||
1529 | 593 | .B fullScreenMode | ||
1530 | 594 | Go to full-screen mode. | ||
1531 | 595 | .TP | ||
1532 | 596 | .B windowMode | ||
1533 | 597 | Go to window (non-full-screen) mode. | ||
1534 | 598 | .TP | ||
1535 | 599 | .B toggleFullScreenMode | ||
1536 | 600 | Toggle between full-screen and window modes. | ||
1537 | 601 | .TP | ||
1538 | 602 | .B open | ||
1539 | 603 | Open a PDF file in this window, using the open dialog. | ||
1540 | 604 | .TP | ||
1541 | 605 | .B openInNewWin | ||
1542 | 606 | Open a PDF file in a new window, using the open dialog. | ||
1543 | 607 | .TP | ||
1544 | 608 | .BI openFile( file ) | ||
1545 | 609 | Open a specified PDF file in this window. | ||
1546 | 610 | .TP | ||
1547 | 611 | .BI openFileInNewWin( file ) | ||
1548 | 612 | Open a specified PDF file in a new window. | ||
1549 | 613 | .TP | ||
1550 | 614 | .BI openFileAtDest( file , dest ) | ||
1551 | 615 | Open a specified PDF file in this window and go to a named | ||
1552 | 616 | destination. | ||
1553 | 617 | .TP | ||
1554 | 618 | .BI openFileAtDestInNewWin( file , dest ) | ||
1555 | 619 | Open a specified PDF file in a new window and go to a named | ||
1556 | 620 | destination. | ||
1557 | 621 | .TP | ||
1558 | 622 | .B reload | ||
1559 | 623 | Reload the current PDF file. | ||
1560 | 624 | .TP | ||
1561 | 625 | .B redraw | ||
1562 | 626 | Redraw the window. | ||
1563 | 627 | .TP | ||
1564 | 628 | .B raise | ||
1565 | 629 | Raise the window to the front. | ||
1566 | 630 | .TP | ||
1567 | 631 | .B closeWindow | ||
1568 | 632 | Close the window. | ||
1569 | 633 | .TP | ||
1570 | 634 | .BI run( external-command-string ) | ||
1571 | 635 | Run an external command. The following escapes are allowed in the | ||
1572 | 636 | command string: | ||
1573 | 637 | .nf | ||
1574 | 638 | |||
1575 | 639 | %f => PDF file name (or an empty string if no | ||
1576 | 640 | file is open) | ||
1577 | 641 | %b => PDF file base name, i.e., file name minus | ||
1578 | 642 | the extension (or an empty string if no | ||
1579 | 643 | file is open) | ||
1580 | 644 | %u => link URL (or an empty string if not over | ||
1581 | 645 | a URL link) | ||
1582 | 646 | %x => selection upper-left x coordinate | ||
1583 | 647 | (or 0 if there is no selection) | ||
1584 | 648 | %y => selection upper-left y coordinate | ||
1585 | 649 | (or 0 if there is no selection) | ||
1586 | 650 | %X => selection lower-right x coordinate | ||
1587 | 651 | (or 0 if there is no selection) | ||
1588 | 652 | %Y => selection lower-right y coordinate | ||
1589 | 653 | (or 0 if there is no selection) | ||
1590 | 654 | %% => % | ||
1591 | 655 | |||
1592 | 656 | .fi | ||
1593 | 657 | .TP | ||
1594 | 658 | .B openOutline | ||
1595 | 659 | Open the outline pane. | ||
1596 | 660 | .TP | ||
1597 | 661 | .B closeOutline | ||
1598 | 662 | Close the outline pane. | ||
1599 | 663 | .TP | ||
1600 | 664 | .B toggleOutline | ||
1601 | 665 | Toggle the outline pane between open and closed. | ||
1602 | 666 | .TP | ||
1603 | 667 | .BI scrollOutlineDown( n ) | ||
1604 | 668 | Scroll the outline down by | ||
1605 | 669 | .I n | ||
1606 | 670 | increments. | ||
1607 | 671 | .TP | ||
1608 | 672 | .BI scrollOutlineUp( n ) | ||
1609 | 673 | Scroll the outline up by | ||
1610 | 674 | .I n | ||
1611 | 675 | increments. | ||
1612 | 676 | .TP | ||
1613 | 677 | .B focusToDocWin | ||
1614 | 678 | Set the keyboard focus to the main document window. | ||
1615 | 679 | .TP | ||
1616 | 680 | .B focusToPageNum | ||
1617 | 681 | Set the keyboard focus to the page number text box. | ||
1618 | 682 | .TP | ||
1619 | 683 | .B find | ||
1620 | 684 | Open the 'find' dialog. | ||
1621 | 685 | .TP | ||
1622 | 686 | .B findNext | ||
1623 | 687 | Finds the next occurrence of the search string (no dialog). | ||
1624 | 688 | .TP | ||
1625 | 689 | .B print | ||
1626 | 690 | Open the 'print' dialog. | ||
1627 | 691 | .TP | ||
1628 | 692 | .B about | ||
1629 | 693 | Open the 'about' dialog. | ||
1630 | 694 | .TP | ||
1631 | 695 | .B quit | ||
1632 | 696 | Quit from xpdf. | ||
1633 | 697 | .PP | ||
1634 | 698 | The following commands depend on the current mouse position: | ||
1635 | 699 | .TP | ||
1636 | 700 | .B startSelection | ||
1637 | 701 | Start a selection, which will be extended as the mouse moves. | ||
1638 | 702 | .TP | ||
1639 | 703 | .B endSelection | ||
1640 | 704 | End a selection. | ||
1641 | 705 | .TP | ||
1642 | 706 | .B startPan | ||
1643 | 707 | Start a pan, which will scroll the document as the mouse moves | ||
1644 | 708 | .TP | ||
1645 | 709 | .B endPan | ||
1646 | 710 | End a pan. | ||
1647 | 711 | .TP | ||
1648 | 712 | .B postPopupMenu | ||
1649 | 713 | Display the popup menu. | ||
1650 | 714 | .TP | ||
1651 | 715 | .B followLink | ||
1652 | 716 | Follow a hyperlink (does nothing if the mouse is not over a link). | ||
1653 | 717 | .TP | ||
1654 | 718 | .B followLinkInNewWin | ||
1655 | 719 | Follow a hyperlink, opening PDF files in a new window (does nothing if | ||
1656 | 720 | the mouse is not over a link). For links to non-PDF files, this | ||
1657 | 721 | command is identical to followLink. | ||
1658 | 722 | .TP | ||
1659 | 723 | .B followLinkNoSel | ||
1660 | 724 | Same as followLink, but does nothing if there is a non-empty selection. | ||
1661 | 725 | (This is useful as a mouse button binding.) | ||
1662 | 726 | .TP | ||
1663 | 727 | .B followLinkInNewWinNoSel | ||
1664 | 728 | Same as followLinkInNewWin, but does nothing if there is a non-empty | ||
1665 | 729 | selection. (This is useful as a mouse button binding.) | ||
1666 | 730 | .SS Default Bindings | ||
1667 | 731 | The default mouse bindings are as follows: | ||
1668 | 732 | .nf | ||
1669 | 733 | |||
1670 | 734 | bind mousePress1 any startSelection | ||
1671 | 735 | bind mouseRelease1 any endSelection followLinkNoSel | ||
1672 | 736 | bind mousePress2 any startPan | ||
1673 | 737 | bind mouseRelease2 any endPan | ||
1674 | 738 | bind mousePress3 any postPopupMenu | ||
1675 | 739 | bind mousePress4 any scrollUpPrevPage(16) | ||
1676 | 740 | bind mousePress5 any scrollDownNextPage(16) | ||
1677 | 741 | bind mousePress6 any scrollLeft(16) | ||
1678 | 742 | bind mousePress7 any scrollRight(16) | ||
1679 | 743 | |||
1680 | 744 | .fi | ||
1681 | 745 | The default key bindings are as follows: | ||
1682 | 746 | .nf | ||
1683 | 747 | |||
1684 | 748 | bind ctrl-home any gotoPage(1) | ||
1685 | 749 | bind home any scrollToTopLeft | ||
1686 | 750 | bind ctrl-end any gotoLastPage | ||
1687 | 751 | bind end any scrollToBottomRight | ||
1688 | 752 | bind pgup any pageUp | ||
1689 | 753 | bind backspace any pageUp | ||
1690 | 754 | bind delete any pageUp | ||
1691 | 755 | bind pgdn any pageDown | ||
1692 | 756 | bind space any pageDown | ||
1693 | 757 | bind left any scrollLeft(16) | ||
1694 | 758 | bind right any scrollRight(16) | ||
1695 | 759 | bind up any scrollUp(16) | ||
1696 | 760 | bind down any scrollDown(16) | ||
1697 | 761 | bind o any open | ||
1698 | 762 | bind O any open | ||
1699 | 763 | bind r any reload | ||
1700 | 764 | bind R any reload | ||
1701 | 765 | bind f any find | ||
1702 | 766 | bind F any find | ||
1703 | 767 | bind ctrl-f any find | ||
1704 | 768 | bind ctrl-g any findNext | ||
1705 | 769 | bind ctrl-p any print | ||
1706 | 770 | bind n scrLockOff nextPage | ||
1707 | 771 | bind N scrLockOff nextPage | ||
1708 | 772 | bind n scrLockOn nextPageNoScroll | ||
1709 | 773 | bind N scrLockOn nextPageNoScroll | ||
1710 | 774 | bind p scrLockOff prevPage | ||
1711 | 775 | bind P scrLockOff prevPage | ||
1712 | 776 | bind p scrLockOn prevPageNoScroll | ||
1713 | 777 | bind P scrLockOn prevPageNoScroll | ||
1714 | 778 | bind v any goForward | ||
1715 | 779 | bind b any goBackward | ||
1716 | 780 | bind g any focusToPageNum | ||
1717 | 781 | bind 0 any zoomPercent(125) | ||
1718 | 782 | bind + any zoomIn | ||
1719 | 783 | bind - any zoomOut | ||
1720 | 784 | bind z any zoomFitPage | ||
1721 | 785 | bind w any zoomFitWidth | ||
1722 | 786 | bind alt-f any toggleFullScreenMode | ||
1723 | 787 | bind ctrl-l any redraw | ||
1724 | 788 | bind ctrl-w any closeWindow | ||
1725 | 789 | bind ? any about | ||
1726 | 790 | bind q any quit | ||
1727 | 791 | bind Q any quit | ||
1728 | 792 | |||
1729 | 793 | .fi | ||
1730 | 794 | Previous versions of xpdf included a "viKeys" X resource. It is no | ||
1731 | 795 | longer available, but the following bindings are equivalent: | ||
1732 | 796 | .nf | ||
1733 | 797 | |||
1734 | 798 | bind h any scrollLeft(16) | ||
1735 | 799 | bind l any scrollRight(16) | ||
1736 | 800 | bind k any scrollUp(16) | ||
1737 | 801 | bind j any scrollDown(16) | ||
1738 | 802 | |||
1739 | 803 | .fi | ||
1740 | 804 | .SH "REMOTE SERVER MODE" | ||
1741 | 805 | Xpdf can be started in remote server mode by specifying a server name | ||
1742 | 806 | (in addition to the file name and page number). For example: | ||
1743 | 807 | .PP | ||
1744 | 808 | .RS | ||
1745 | 809 | xpdf -remote myServer file.pdf | ||
1746 | 810 | .RE | ||
1747 | 811 | .PP | ||
1748 | 812 | If there is currently no xpdf running in server mode with the name | ||
1749 | 813 | \'myServer', a new xpdf window will be opened. If another command: | ||
1750 | 814 | .PP | ||
1751 | 815 | .RS | ||
1752 | 816 | xpdf -remote myServer another.pdf 9 | ||
1753 | 817 | .RE | ||
1754 | 818 | .PP | ||
1755 | 819 | is issued, a new copy of xpdf will not be started. Instead, the first | ||
1756 | 820 | xpdf (the server) will load | ||
1757 | 821 | .I another.pdf | ||
1758 | 822 | and display page nine. If the file name is the same: | ||
1759 | 823 | .PP | ||
1760 | 824 | .RS | ||
1761 | 825 | xpdf -remote myServer another.pdf 4 | ||
1762 | 826 | .RE | ||
1763 | 827 | .PP | ||
1764 | 828 | the xpdf server will simply display the specified page. | ||
1765 | 829 | .PP | ||
1766 | 830 | The -raise option tells the server to raise its window; it can be | ||
1767 | 831 | specified with or without a file name and page number. | ||
1768 | 832 | .PP | ||
1769 | 833 | The -quit option tells the server to close its window and exit. | ||
1770 | 834 | .SH EXIT CODES | ||
1771 | 835 | The Xpdf tools use the following exit codes: | ||
1772 | 836 | .TP | ||
1773 | 837 | 0 | ||
1774 | 838 | No error. | ||
1775 | 839 | .TP | ||
1776 | 840 | 1 | ||
1777 | 841 | Error opening a PDF file. | ||
1778 | 842 | .TP | ||
1779 | 843 | 2 | ||
1780 | 844 | Error opening an output file. | ||
1781 | 845 | .TP | ||
1782 | 846 | 3 | ||
1783 | 847 | Error related to PDF permissions. | ||
1784 | 848 | .TP | ||
1785 | 849 | 99 | ||
1786 | 850 | Other error. | ||
1787 | 851 | .SH AUTHOR | ||
1788 | 852 | The xpdf software and documentation are copyright 1996-2007 Glyph & | ||
1789 | 853 | Cog, LLC. | ||
1790 | 854 | .SH "SEE ALSO" | ||
1791 | 855 | .BR pdftops (1), | ||
1792 | 856 | .BR pdftotext (1), | ||
1793 | 857 | .BR pdfinfo (1), | ||
1794 | 858 | .BR pdffonts (1), | ||
1795 | 859 | .BR pdftoppm (1), | ||
1796 | 860 | .BR pdfimages (1), | ||
1797 | 861 | .BR xpdfrc (5) | ||
1798 | 862 | .br | ||
1799 | 863 | .B http://www.foolabs.com/xpdf/ | ||
1800 | 0 | 864 | ||
1801 | === added file '.pc/01_manpage.dpatch/doc/xpdfrc.5' | |||
1802 | --- .pc/01_manpage.dpatch/doc/xpdfrc.5 1970-01-01 00:00:00 +0000 | |||
1803 | +++ .pc/01_manpage.dpatch/doc/xpdfrc.5 2010-04-06 13:42:20 +0000 | |||
1804 | @@ -0,0 +1,617 @@ | |||
1805 | 1 | .\" Copyright 2002-2007 Glyph & Cog, LLC | ||
1806 | 2 | .TH xpdfrc 5 "27 February 2007" | ||
1807 | 3 | .SH NAME | ||
1808 | 4 | xpdfrc \- configuration file for Xpdf tools (version 3.02) | ||
1809 | 5 | .SH DESCRIPTION | ||
1810 | 6 | All of the Xpdf tools read a single configuration file. If you have a | ||
1811 | 7 | .I .xpdfrc | ||
1812 | 8 | file in your home directory, it will be read. Otherwise, a | ||
1813 | 9 | system-wide configuration file will be read from | ||
1814 | 10 | .IR /usr/local/etc/xpdfrc , | ||
1815 | 11 | if it exists. (This is its default location; depending on build | ||
1816 | 12 | options, it may be placed elsewhere.) On Win32 systems, the | ||
1817 | 13 | .I xpdfrc | ||
1818 | 14 | file should be placed in the same directory as the executables. | ||
1819 | 15 | .PP | ||
1820 | 16 | The xpdfrc file consists of a series of configuration options, one | ||
1821 | 17 | per line. Blank lines and lines starting with a \'#' (comments) are | ||
1822 | 18 | ignored. | ||
1823 | 19 | .PP | ||
1824 | 20 | The following sections list all of the configuration options, sorted | ||
1825 | 21 | into functional groups. There is an examples section at the end. | ||
1826 | 22 | .SH INCLUDE FILES | ||
1827 | 23 | .TP | ||
1828 | 24 | .BI include " config\-file" | ||
1829 | 25 | Includes the specified config file. The effect of this is equivalent | ||
1830 | 26 | to inserting the contents of | ||
1831 | 27 | .I config\-file | ||
1832 | 28 | directly into the parent config file in place of the | ||
1833 | 29 | .I include | ||
1834 | 30 | command. Config files can be nested arbitrarily deeply. | ||
1835 | 31 | .SH CHARACTER MAPPING | ||
1836 | 32 | .TP | ||
1837 | 33 | .BI nameToUnicode " map\-file" | ||
1838 | 34 | Specifies a file with the mapping from character names to Unicode. | ||
1839 | 35 | This is used to handle PDF fonts that have valid encodings but no | ||
1840 | 36 | ToUnicode entry. Each line of a nameToUnicode file looks like this: | ||
1841 | 37 | |||
1842 | 38 | .I " " hex\-string name | ||
1843 | 39 | |||
1844 | 40 | The | ||
1845 | 41 | .I hex\-string | ||
1846 | 42 | is the Unicode (UCS-2) character index, and | ||
1847 | 43 | .I name | ||
1848 | 44 | is the corresponding character name. Multiple nameToUnicode files can | ||
1849 | 45 | be used; if a character name is given more than once, the code in the | ||
1850 | 46 | last specified file is used. There is a built-in default | ||
1851 | 47 | nameToUnicode table with all of Adobe's standard character names. | ||
1852 | 48 | .TP | ||
1853 | 49 | .BI cidToUnicode " registry\-ordering map\-file" | ||
1854 | 50 | Specifies the file with the mapping from character collection to | ||
1855 | 51 | Unicode. Each line of a cidToUnicode file represents one character: | ||
1856 | 52 | |||
1857 | 53 | .I " " hex\-string | ||
1858 | 54 | |||
1859 | 55 | The | ||
1860 | 56 | .I hex\-string | ||
1861 | 57 | is the Unicode (UCS-2) index for that character. The first line maps | ||
1862 | 58 | CID 0, the second line CID 1, etc. File size is determined by size of | ||
1863 | 59 | the character collection. Only one file is allowed per character | ||
1864 | 60 | collection; the last specified file is used. There are no built-in | ||
1865 | 61 | cidToUnicode mappings. | ||
1866 | 62 | .TP | ||
1867 | 63 | .BI unicodeToUnicode " font\-name\-substring map\-file" | ||
1868 | 64 | This is used to work around PDF fonts which have incorrect Unicode | ||
1869 | 65 | information. It specifies a file which maps from the given | ||
1870 | 66 | (incorrect) Unicode indexes to the correct ones. The mapping will be | ||
1871 | 67 | used for any font whose name contains | ||
1872 | 68 | .IR font\-name\-substring . | ||
1873 | 69 | Each line of a unicodeToUnicode file represents one Unicode character: | ||
1874 | 70 | |||
1875 | 71 | .RI " " in\-hex " " out\-hex1 " " out\-hex2 " ..." | ||
1876 | 72 | |||
1877 | 73 | The | ||
1878 | 74 | .I in\-hex | ||
1879 | 75 | field is an input (incorrect) Unicode index, and the rest of the | ||
1880 | 76 | fields are one or more output (correct) Unicode indexes. Each | ||
1881 | 77 | occurrence of | ||
1882 | 78 | .I in\-hex | ||
1883 | 79 | will be converted to the specified output sequence. | ||
1884 | 80 | .TP | ||
1885 | 81 | .BI unicodeMap " encoding\-name map\-file" | ||
1886 | 82 | Specifies the file with mapping from Unicode to | ||
1887 | 83 | .IR encoding\-name . | ||
1888 | 84 | These encodings are used for X display fonts and text output (see | ||
1889 | 85 | below). Each line of a unicodeMap file represents a range of one or | ||
1890 | 86 | more Unicode characters which maps linearly to a range in the output | ||
1891 | 87 | encoding: | ||
1892 | 88 | .nf | ||
1893 | 89 | |||
1894 | 90 | .I " " in\-start\-hex in\-end\-hex out\-start\-hex | ||
1895 | 91 | |||
1896 | 92 | .fi | ||
1897 | 93 | Entries for single characters can be abbreviated to: | ||
1898 | 94 | .nf | ||
1899 | 95 | |||
1900 | 96 | .I " " in\-hex out\-hex | ||
1901 | 97 | |||
1902 | 98 | .fi | ||
1903 | 99 | The | ||
1904 | 100 | .I in\-start\-hex | ||
1905 | 101 | and | ||
1906 | 102 | .I in\-end\-hex | ||
1907 | 103 | fields (or the single | ||
1908 | 104 | .I in\-hex | ||
1909 | 105 | field) specify the Unicode range. The | ||
1910 | 106 | .I out\-start\-hex | ||
1911 | 107 | field (or the | ||
1912 | 108 | .I out\-hex | ||
1913 | 109 | field) specifies the start of the output encoding range. The length | ||
1914 | 110 | of the | ||
1915 | 111 | .I out\-start\-hex | ||
1916 | 112 | (or | ||
1917 | 113 | .IR out\-hex ) | ||
1918 | 114 | string determines the length of the output characters (e.g., UTF-8 | ||
1919 | 115 | uses different numbers of bytes to represent characters in different | ||
1920 | 116 | ranges). Entries must be given in increasing Unicode order. Only one | ||
1921 | 117 | file is allowed per encoding; the last specified file is used. The | ||
1922 | 118 | .IR Latin1 , | ||
1923 | 119 | .IR ASCII7 , | ||
1924 | 120 | .IR Symbol , | ||
1925 | 121 | .IR ZapfDingbats , | ||
1926 | 122 | .IR UTF-8 , | ||
1927 | 123 | and | ||
1928 | 124 | .I UCS-2 | ||
1929 | 125 | encodings are predefined. | ||
1930 | 126 | .TP | ||
1931 | 127 | .BI cMapDir " registry\-ordering dir" | ||
1932 | 128 | Specifies a search directory, | ||
1933 | 129 | .IR dir , | ||
1934 | 130 | for CMaps for the | ||
1935 | 131 | .I registry\-ordering | ||
1936 | 132 | character collection. There can be multiple directories for a | ||
1937 | 133 | particular collection. There are no default CMap directories. | ||
1938 | 134 | .TP | ||
1939 | 135 | .BI toUnicodeDir " dir" | ||
1940 | 136 | Specifies a search directory, | ||
1941 | 137 | .IR dir , | ||
1942 | 138 | for ToUnicode CMaps. There can be multiple ToUnicode directories. | ||
1943 | 139 | There are no default ToUnicode directories. | ||
1944 | 140 | .SH DISPLAY FONTS | ||
1945 | 141 | .TP | ||
1946 | 142 | .BI displayFontT1 " PDF\-font\-name T1\-file" | ||
1947 | 143 | Maps a PDF font, | ||
1948 | 144 | .IR PDF\-font\-name , | ||
1949 | 145 | to a Type 1 font for display. The Type 1 font file, | ||
1950 | 146 | .IR T1\-file , | ||
1951 | 147 | should be a standard .pfa or .pfb file. | ||
1952 | 148 | .TP | ||
1953 | 149 | .BI displayFontTT " PDF\-font\-name TT\-file" | ||
1954 | 150 | Maps a PDF font, | ||
1955 | 151 | .IR PDF\-font\-name , | ||
1956 | 152 | to a TrueType font for display. The TrueType font file, | ||
1957 | 153 | .IR TT\-file , | ||
1958 | 154 | should be a standard .ttf file. | ||
1959 | 155 | .TP | ||
1960 | 156 | .BI displayNamedCIDFontT1 " PDF\-font\-name T1\-file" | ||
1961 | 157 | Maps a specific PDF CID (16-bit) font, | ||
1962 | 158 | .IR PDF\-font\-name , | ||
1963 | 159 | to a CID font (16-bit PostScript font), for display. There are no | ||
1964 | 160 | default CID font mappings. | ||
1965 | 161 | .TP | ||
1966 | 162 | .BI displayCIDFontT1 " registry\-ordering T1\-file" | ||
1967 | 163 | Maps the | ||
1968 | 164 | .I registry\-ordering | ||
1969 | 165 | character collection to a CID font (16-bit PostScript font), for | ||
1970 | 166 | display. This mapping is used if the font name doesn't match any of | ||
1971 | 167 | the fonts declared with displayNamedCIDFont* commands. There are no | ||
1972 | 168 | default CID font mappings. | ||
1973 | 169 | .TP | ||
1974 | 170 | .BI displayNamedCIDFontTT " PDF\-font\-name TT\-file" | ||
1975 | 171 | Maps a specific PDF CID (16-bit) font, | ||
1976 | 172 | .IR PDF\-font\-name , | ||
1977 | 173 | to a (16-bit) TrueType font, for display. There are no default CID | ||
1978 | 174 | font mappings. | ||
1979 | 175 | .TP | ||
1980 | 176 | .BI displayCIDFontTT " registry\-ordering TT\-file" | ||
1981 | 177 | Maps the | ||
1982 | 178 | .I registry\-ordering | ||
1983 | 179 | character collection to a (16-bit) TrueType font, for display. This | ||
1984 | 180 | mapping is used if the font name doesn't match any of the fonts | ||
1985 | 181 | declared with displayNamedCIDFont* commands. There are no default CID | ||
1986 | 182 | font mappings. | ||
1987 | 183 | .TP | ||
1988 | 184 | .BI fontDir " dir" | ||
1989 | 185 | Specifies a search directory for external font files. There can be | ||
1990 | 186 | multiple fontDir directories. If a PDF file uses a font but doesn't | ||
1991 | 187 | embed it, these directories will be searched for a matching font file. | ||
1992 | 188 | These fonts are used by both xpdf (for display) and pdftops (for | ||
1993 | 189 | embedding in the generated PostScript). Type 1 fonts must have a | ||
1994 | 190 | suffix of ".pfa", ".pfb", ".ps", or no suffix at all. TrueType fonts | ||
1995 | 191 | must have a ".ttf" suffix. Other files in these directories will be | ||
1996 | 192 | ignored. There are no default fontDir directories. | ||
1997 | 193 | .SH POSTSCRIPT CONTROL | ||
1998 | 194 | .TP | ||
1999 | 195 | .BI psPaperSize " width(pts) height(pts)" | ||
2000 | 196 | Sets the paper size for PostScript output. The | ||
2001 | 197 | .I width | ||
2002 | 198 | and | ||
2003 | 199 | .I height | ||
2004 | 200 | parameters give the paper size in PostScript points (1 point = 1/72 | ||
2005 | 201 | inch). | ||
2006 | 202 | .TP | ||
2007 | 203 | .BR psPaperSize " letter | legal | A4 | A3 | match" | ||
2008 | 204 | Sets the paper size for PostScript output to a standard size. The | ||
2009 | 205 | default paper size is set when xpdf and pdftops are built, typically | ||
2010 | 206 | to "letter" or "A4". This can also be set to "match", which will set | ||
2011 | 207 | the paper size to match the size specified in the PDF file. | ||
2012 | 208 | .TP | ||
2013 | 209 | .BR psImageableArea " llx lly urx ury" | ||
2014 | 210 | Sets the imageable area for PostScript output. The four integers are | ||
2015 | 211 | the coordinates of the lower-left and upper-right corners of the | ||
2016 | 212 | imageable region, specified in points (with the origin being the | ||
2017 | 213 | lower-left corner of the paper). This defaults to the full paper | ||
2018 | 214 | size; the psPaperSize option will reset the imageable area | ||
2019 | 215 | coordinates. | ||
2020 | 216 | .TP | ||
2021 | 217 | .BR psCrop " yes | no" | ||
2022 | 218 | If set to "yes", PostScript output is cropped to the CropBox specified | ||
2023 | 219 | in the PDF file; otherwise no cropping is done. This defaults to | ||
2024 | 220 | "yes". | ||
2025 | 221 | .TP | ||
2026 | 222 | .BR psExpandSmaller " yes | no" | ||
2027 | 223 | If set to "yes", PDF pages smaller than the PostScript imageable area | ||
2028 | 224 | are expanded to fill the imageable area. Otherwise, no scalling is | ||
2029 | 225 | done on smaller pages. This defaults to "no". | ||
2030 | 226 | .TP | ||
2031 | 227 | .BR psShrinkLarger " yes | no" | ||
2032 | 228 | If set to yes, PDF pages larger than the PostScript imageable area are | ||
2033 | 229 | shrunk to fit the imageable area. Otherwise, no scaling is done on | ||
2034 | 230 | larger pages. This defaults to "yes". | ||
2035 | 231 | .TP | ||
2036 | 232 | .BR psCenter " yes | no" | ||
2037 | 233 | If set to yes, PDF pages smaller than the PostScript imageable area | ||
2038 | 234 | (after any scaling) are centered in the imageable area. Otherwise, | ||
2039 | 235 | they are aligned at the lower-left corner of the imageable area. This | ||
2040 | 236 | defaults to "yes". | ||
2041 | 237 | .TP | ||
2042 | 238 | .BR psDuplex " yes | no" | ||
2043 | 239 | If set to "yes", the generated PostScript will set the "Duplex" | ||
2044 | 240 | pagedevice entry. This tells duplex-capable printers to enable | ||
2045 | 241 | duplexing. This defaults to "no". | ||
2046 | 242 | .TP | ||
2047 | 243 | .BR psLevel " level1 | level1sep | level2 | level2sep | level3 | level3Sep" | ||
2048 | 244 | Sets the PostScript level to generate. This defaults to "level2". | ||
2049 | 245 | .TP | ||
2050 | 246 | .BI psFont " PDF\-font\-name PS\-font\-name" | ||
2051 | 247 | When the | ||
2052 | 248 | .I PDF\-font\-name | ||
2053 | 249 | font is used in a PDF file, it will be translated to the PostScript | ||
2054 | 250 | font | ||
2055 | 251 | .IR PS\-font\-name , | ||
2056 | 252 | which is assumed to be resident in the printer. Typically, | ||
2057 | 253 | .I PDF\-font\-name | ||
2058 | 254 | and | ||
2059 | 255 | .I PS\-font\-name | ||
2060 | 256 | are the same. By default, only the Base-14 fonts are assumed to be | ||
2061 | 257 | resident. | ||
2062 | 258 | .TP | ||
2063 | 259 | .BI psNamedFont16 " PDF\-font\-name wMode PS\-font\-name encoding" | ||
2064 | 260 | When the 16-bit font | ||
2065 | 261 | .I PDF\-font\-name | ||
2066 | 262 | is used in a PDF file with the | ||
2067 | 263 | .I wMode | ||
2068 | 264 | writing mode and is not embedded, the | ||
2069 | 265 | .I PS\-font\-name | ||
2070 | 266 | font is substituted for it. The writing mode must be either \'H' for | ||
2071 | 267 | horizontal or \'V' for vertical. The | ||
2072 | 268 | .I PS\-font\-name | ||
2073 | 269 | font is assumed to be resident in the printer and to use the specified | ||
2074 | 270 | encoding (which must have been defined with the unicodeMap command). | ||
2075 | 271 | .TP | ||
2076 | 272 | .BI psFont16 " registry\-ordering wMode PS\-font\-name encoding" | ||
2077 | 273 | When a 16-bit font using the | ||
2078 | 274 | .I registry\-ordering | ||
2079 | 275 | character collection and | ||
2080 | 276 | .I wMode | ||
2081 | 277 | writing mode is not embedded and does not match any of the fonts | ||
2082 | 278 | declared in psNamedFont16 commands, the | ||
2083 | 279 | .I PS\-font\-name | ||
2084 | 280 | font is substituted for it. The writing mode must be either \'H' for | ||
2085 | 281 | horizontal or \'V' for vertical. The | ||
2086 | 282 | .I PS\-font\-name | ||
2087 | 283 | font is assumed to be resident in the printer and to use the specified | ||
2088 | 284 | writing mode and encoding (which must have been defined with the | ||
2089 | 285 | unicodeMap command). | ||
2090 | 286 | .TP | ||
2091 | 287 | .BR psEmbedType1Fonts " yes | no" | ||
2092 | 288 | If set to "no", prevents embedding of Type 1 fonts in generated | ||
2093 | 289 | PostScript. This defaults to "yes". | ||
2094 | 290 | .TP | ||
2095 | 291 | .BR psEmbedTrueTypeFonts " yes | no" | ||
2096 | 292 | If set to "no", prevents embedding of TrueType fonts in generated | ||
2097 | 293 | PostScript. This defaults to "yes". | ||
2098 | 294 | .TP | ||
2099 | 295 | .BR psEmbedCIDTrueTypeFonts " yes | no" | ||
2100 | 296 | If set to "no", prevents embedding of CID TrueType fonts in generated | ||
2101 | 297 | PostScript. For Level 3 PostScript, this generates a CID font, for | ||
2102 | 298 | lower levels it generates a non-CID composite font. | ||
2103 | 299 | .TP | ||
2104 | 300 | .BR psEmbedCIDPostScriptFonts " yes | no" | ||
2105 | 301 | If set to "no", prevents embedding of CID PostScript fonts in | ||
2106 | 302 | generated PostScript. For Level 3 PostScript, this generates a CID | ||
2107 | 303 | font, for lower levels it generates a non-CID composite font. | ||
2108 | 304 | .TP | ||
2109 | 305 | .BR psPreload " yes | no" | ||
2110 | 306 | If set to "yes", PDF forms are converted to PS procedures, and image | ||
2111 | 307 | data is preloaded. This uses more memory in the PostScript | ||
2112 | 308 | interpreter, but generates significantly smaller PS files in | ||
2113 | 309 | situations where, e.g., the same image is drawn on every page of a | ||
2114 | 310 | long document. This defaults to "no". | ||
2115 | 311 | .TP | ||
2116 | 312 | .BR psOPI " yes | no" | ||
2117 | 313 | If set to "yes", generates PostScript OPI comments for all images and | ||
2118 | 314 | forms which have OPI information. This option is only available if | ||
2119 | 315 | the Xpdf tools were compiled with OPI support. This defaults to "no". | ||
2120 | 316 | .TP | ||
2121 | 317 | .BR psASCIIHex " yes | no" | ||
2122 | 318 | If set to "yes", the ASCIIHexEncode filter will be used instead of | ||
2123 | 319 | ASCII85Encode for binary data. This defaults to "no". | ||
2124 | 320 | .TP | ||
2125 | 321 | .BI psFile " file\-or\-command" | ||
2126 | 322 | Sets the default PostScript file or print command for xpdf. Commands | ||
2127 | 323 | start with a \'|' character; anything else is a file. If the file | ||
2128 | 324 | name or command contains spaces it must be quoted. This defaults to | ||
2129 | 325 | unset, which tells xpdf to generate a name of the form <file>.ps for a | ||
2130 | 326 | PDF file <file>.pdf. | ||
2131 | 327 | .TP | ||
2132 | 328 | .BI fontDir " dir" | ||
2133 | 329 | See the description above, in the DISPLAY FONTS section. | ||
2134 | 330 | .SH TEXT CONTROL | ||
2135 | 331 | .TP | ||
2136 | 332 | .BI textEncoding " encoding\-name" | ||
2137 | 333 | Sets the encoding to use for text output. (This can be overridden | ||
2138 | 334 | with the "-enc" switch on the command line.) The | ||
2139 | 335 | .I encoding\-name | ||
2140 | 336 | must be defined with the unicodeMap command (see above). This | ||
2141 | 337 | defaults to "Latin1". | ||
2142 | 338 | .TP | ||
2143 | 339 | .BR textEOL " unix | dos | mac" | ||
2144 | 340 | Sets the end-of-line convention to use for text output. The options | ||
2145 | 341 | are: | ||
2146 | 342 | .nf | ||
2147 | 343 | |||
2148 | 344 | unix = LF | ||
2149 | 345 | dos = CR+LF | ||
2150 | 346 | mac = CR | ||
2151 | 347 | |||
2152 | 348 | .fi | ||
2153 | 349 | (This can be overridden with the "-eol" switch on the command line.) | ||
2154 | 350 | The default value is based on the OS where xpdf and pdftotext were | ||
2155 | 351 | built. | ||
2156 | 352 | .TP | ||
2157 | 353 | .BR textPageBreaks " yes | no" | ||
2158 | 354 | If set to "yes", text extraction will insert page breaks (form feed | ||
2159 | 355 | characters) between pages. This defaults to "yes". | ||
2160 | 356 | .TP | ||
2161 | 357 | .BR textKeepTinyChars " yes | no" | ||
2162 | 358 | If set to "yes", text extraction will keep all characters. If set to | ||
2163 | 359 | "no", text extraction will discard tiny (smaller than 3 point) | ||
2164 | 360 | characters after the first 50000 per page, avoiding extremely slow run | ||
2165 | 361 | times for PDF files that use special fonts to do shading or | ||
2166 | 362 | cross-hatching. This defaults to "no". | ||
2167 | 363 | .SH MISCELLANEOUS SETTINGS | ||
2168 | 364 | .TP | ||
2169 | 365 | .BR initialZoom " \fIpercentage\fR | page | width" | ||
2170 | 366 | Sets the initial zoom factor. A number specifies a zoom percentage, | ||
2171 | 367 | where 100 means 72 dpi. You may also specify \'page', to fit the page | ||
2172 | 368 | to the window size, or \'width', to fit the page width to the window | ||
2173 | 369 | width. | ||
2174 | 370 | .TP | ||
2175 | 371 | .BR continuousView " yes | no" | ||
2176 | 372 | If set to "yes", xpdf will start in continuous view mode, i.e., with | ||
2177 | 373 | one vertical screoll bar for the whole document. This defaults to | ||
2178 | 374 | "no". | ||
2179 | 375 | .TP | ||
2180 | 376 | .BR enableT1lib " yes | no" | ||
2181 | 377 | Enables or disables use of t1lib (a Type 1 font rasterizer). This is | ||
2182 | 378 | only relevant if the Xpdf tools were built with t1lib support. | ||
2183 | 379 | ("enableT1lib" replaces the old "t1libControl" option.) This option | ||
2184 | 380 | defaults to "yes". | ||
2185 | 381 | .TP | ||
2186 | 382 | .BR enableFreeType " yes | no" | ||
2187 | 383 | Enables or disables use of FreeType (a TrueType / Type 1 font | ||
2188 | 384 | rasterizer). This is only relevant if the Xpdf tools were built with | ||
2189 | 385 | FreeType support. ("enableFreeType" replaces the old | ||
2190 | 386 | "freetypeControl" option.) This option defaults to "yes". | ||
2191 | 387 | .TP | ||
2192 | 388 | .BR antialias " yes | no" | ||
2193 | 389 | Enables or disables font anti-aliasing in the PDF rasterizer. This | ||
2194 | 390 | option affects all font rasterizers. ("antialias" replaces the | ||
2195 | 391 | anti-aliasing control provided by the old "t1libControl" and | ||
2196 | 392 | "freetypeControl" options.) This default to "yes". | ||
2197 | 393 | .TP | ||
2198 | 394 | .BR vectorAntialias " yes | no" | ||
2199 | 395 | Enables or disables anti-aliasing of vector graphics in the PDF | ||
2200 | 396 | rasterizer. This defaults to "yes". | ||
2201 | 397 | .TP | ||
2202 | 398 | .BR strokeAdjust " yes | no" | ||
2203 | 399 | Enables or disables stroke adjustment. This defaults to "yes". | ||
2204 | 400 | .TP | ||
2205 | 401 | .BR screenType " dispersed | clustered | stochasticClustered" | ||
2206 | 402 | Sets the halftone screen type, which will be used when generating a | ||
2207 | 403 | monochrome (1-bit) bitmap. The three options are dispersed-dot | ||
2208 | 404 | dithering, clustered-dot dithering (with a round dot and 45-degree | ||
2209 | 405 | screen angle), and stochastic clustered-dot dithering. By default, | ||
2210 | 406 | "stochasticClustered" is used for resolutions of 300 dpi and higher, | ||
2211 | 407 | and "dispersed" is used for resolutions lower then 300 dpi. | ||
2212 | 408 | .TP | ||
2213 | 409 | .BI screenSize " integer" | ||
2214 | 410 | Sets the size of the (square) halftone screen threshold matrix. By | ||
2215 | 411 | default, this is 4 for dispersed-dot dithering, 10 for clustered-dot | ||
2216 | 412 | dithering, and 100 for stochastic clustered-dot dithering. | ||
2217 | 413 | .TP | ||
2218 | 414 | .BI screenDotRadius " integer" | ||
2219 | 415 | Sets the halftone screen dot radius. This is only used when | ||
2220 | 416 | screenType is set to stochasticClustered, and it defaults to 2. In | ||
2221 | 417 | clustered-dot mode, the dot radius is half of the screen size. | ||
2222 | 418 | Dispersed-dot dithering doesn't have a dot radius. | ||
2223 | 419 | .TP | ||
2224 | 420 | .BI screenGamma " float" | ||
2225 | 421 | Sets the halftone screen gamma correction parameter. Gamma values | ||
2226 | 422 | greater than 1 make the output brighter; gamma values less than 1 make | ||
2227 | 423 | it darker. The default value is 1. | ||
2228 | 424 | .TP | ||
2229 | 425 | .BI screenBlackThreshold " float" | ||
2230 | 426 | When halftoning, all values below this threshold are forced to solid | ||
2231 | 427 | black. This parameter is a floating point value between 0 (black) and | ||
2232 | 428 | 1 (white). The default value is 0. | ||
2233 | 429 | .TP | ||
2234 | 430 | .BI screenWhiteThreshold " float" | ||
2235 | 431 | When halftoning, all values above this threshold are forced to solid | ||
2236 | 432 | white. This parameter is a floating point value between 0 (black) and | ||
2237 | 433 | 1 (white). The default value is 1. | ||
2238 | 434 | .TP | ||
2239 | 435 | .BI urlCommand " command" | ||
2240 | 436 | Sets the command executed when you click on a URL link. The string | ||
2241 | 437 | "%s" will be replaced with the URL. (See the example below.) This | ||
2242 | 438 | has no default value. | ||
2243 | 439 | .TP | ||
2244 | 440 | .BI movieCommand " command" | ||
2245 | 441 | Sets the command executed when you click on a movie annotation. The | ||
2246 | 442 | string "%s" will be replaced with the movie file name. This has no | ||
2247 | 443 | default value. | ||
2248 | 444 | .TP | ||
2249 | 445 | .BI mapNumericCharNames " yes | no" | ||
2250 | 446 | If set to "yes", the Xpdf tools will attempt to map various numeric | ||
2251 | 447 | character names sometimes used in font subsets. In some cases this | ||
2252 | 448 | leads to usable text, and in other cases it leads to gibberish -- | ||
2253 | 449 | there is no way for Xpdf to tell. This defaults to "yes". | ||
2254 | 450 | .TP | ||
2255 | 451 | .BI mapUnknownCharNames " yes | no" | ||
2256 | 452 | If set to "yes", and mapNumericCharNames is set to "no", the Xpdf | ||
2257 | 453 | tools will apply a simple pass-through mapping (Unicode index = | ||
2258 | 454 | character code) for all unrecognized glyph names. In some cases, this | ||
2259 | 455 | leads to usable text, and in other cases it leads to gibberish -- | ||
2260 | 456 | there is no way for Xpdf to tell. This defaults to "no". | ||
2261 | 457 | .TP | ||
2262 | 458 | .BI bind " modifiers-key context command ..." | ||
2263 | 459 | Add a key or mouse button binding. | ||
2264 | 460 | .I Modifiers | ||
2265 | 461 | can be zero or more of: | ||
2266 | 462 | .nf | ||
2267 | 463 | |||
2268 | 464 | shift- | ||
2269 | 465 | ctrl- | ||
2270 | 466 | alt- | ||
2271 | 467 | |||
2272 | 468 | .fi | ||
2273 | 469 | .I Key | ||
2274 | 470 | can be a regular ASCII character, or any one of: | ||
2275 | 471 | .nf | ||
2276 | 472 | |||
2277 | 473 | space | ||
2278 | 474 | tab | ||
2279 | 475 | return | ||
2280 | 476 | enter | ||
2281 | 477 | backspace | ||
2282 | 478 | insert | ||
2283 | 479 | delete | ||
2284 | 480 | home | ||
2285 | 481 | end | ||
2286 | 482 | pgup | ||
2287 | 483 | pgdn | ||
2288 | 484 | left / right / up / down (arrow keys) | ||
2289 | 485 | f1 .. f35 (function keys) | ||
2290 | 486 | mousePress1 .. mousePress7 (mouse buttons) | ||
2291 | 487 | mouseRelease1 .. mouseRelease7 (mouse buttons) | ||
2292 | 488 | |||
2293 | 489 | .fi | ||
2294 | 490 | .I Context | ||
2295 | 491 | is either "any" or a comma-separated combination of: | ||
2296 | 492 | .nf | ||
2297 | 493 | |||
2298 | 494 | fullScreen / window (full screen mode on/off) | ||
2299 | 495 | continuous / singlePage (continuous mode on/off) | ||
2300 | 496 | overLink / offLink (mouse over link or not) | ||
2301 | 497 | scrLockOn / scrLockOff (scroll lock on/off) | ||
2302 | 498 | |||
2303 | 499 | .fi | ||
2304 | 500 | The context string can include only one of each pair in the above | ||
2305 | 501 | list. | ||
2306 | 502 | |||
2307 | 503 | .I Command | ||
2308 | 504 | is an Xpdf command (see the COMMANDS section of the | ||
2309 | 505 | .BR xpdf (1) | ||
2310 | 506 | man page for details). Multiple commands are separated by whitespace. | ||
2311 | 507 | |||
2312 | 508 | The bind command replaces any existing binding, but only if it was | ||
2313 | 509 | defined for the exact same modifiers, key, and context. All tokens | ||
2314 | 510 | (modifiers, key, context, commands) are case-sensitive. | ||
2315 | 511 | |||
2316 | 512 | Example key bindings: | ||
2317 | 513 | .nf | ||
2318 | 514 | |||
2319 | 515 | # bind ctrl-a in any context to the nextPage | ||
2320 | 516 | # command | ||
2321 | 517 | bind ctrl-a any nextPage | ||
2322 | 518 | |||
2323 | 519 | # bind uppercase B, when in continuous mode | ||
2324 | 520 | # with scroll lock on, to the reload command | ||
2325 | 521 | # followed by the prevPage command | ||
2326 | 522 | bind B continuous,scrLockOn reload prevPage | ||
2327 | 523 | |||
2328 | 524 | .fi | ||
2329 | 525 | See the | ||
2330 | 526 | .BR xpdf (1) | ||
2331 | 527 | man page for more examples. | ||
2332 | 528 | .TP | ||
2333 | 529 | .BI unbind " modifiers-key context" | ||
2334 | 530 | Removes a key binding established with the bind command. This is most | ||
2335 | 531 | useful to remove default key bindings before establishing new ones | ||
2336 | 532 | (e.g., if the default key binding is given for "any" context, and you | ||
2337 | 533 | want to create new key bindings for multiple contexts). | ||
2338 | 534 | .TP | ||
2339 | 535 | .BI printCommands " yes | no" | ||
2340 | 536 | If set to "yes", drawing commands are printed as they're executed | ||
2341 | 537 | (useful for debugging). This defaults to "no". | ||
2342 | 538 | .TP | ||
2343 | 539 | .BI errQuiet " yes | no" | ||
2344 | 540 | If set to "yes", this suppresses all error and warning messages from | ||
2345 | 541 | all of the Xpdf tools. This defaults to "no". | ||
2346 | 542 | .SH EXAMPLES | ||
2347 | 543 | The following is a sample xpdfrc file. | ||
2348 | 544 | .nf | ||
2349 | 545 | |||
2350 | 546 | # from the Thai support package | ||
2351 | 547 | nameToUnicode /usr/local/share/xpdf/Thai.nameToUnicode | ||
2352 | 548 | |||
2353 | 549 | # from the Japanese support package | ||
2354 | 550 | cidToUnicode Adobe-Japan1 /usr/local/share/xpdf/Adobe-Japan1.cidToUnicode | ||
2355 | 551 | unicodeMap JISX0208 /usr/local/share/xpdf/JISX0208.unicodeMap | ||
2356 | 552 | cMapDir Adobe-Japan1 /usr/local/share/xpdf/cmap/Adobe-Japan1 | ||
2357 | 553 | |||
2358 | 554 | # use the Base-14 Type 1 fonts from ghostscript | ||
2359 | 555 | displayFontT1 Times-Roman /usr/local/share/ghostscript/fonts/n021003l.pfb | ||
2360 | 556 | displayFontT1 Times-Italic /usr/local/share/ghostscript/fonts/n021023l.pfb | ||
2361 | 557 | displayFontT1 Times-Bold /usr/local/share/ghostscript/fonts/n021004l.pfb | ||
2362 | 558 | displayFontT1 Times-BoldItalic /usr/local/share/ghostscript/fonts/n021024l.pfb | ||
2363 | 559 | displayFontT1 Helvetica /usr/local/share/ghostscript/fonts/n019003l.pfb | ||
2364 | 560 | displayFontT1 Helvetica-Oblique /usr/local/share/ghostscript/fonts/n019023l.pfb | ||
2365 | 561 | displayFontT1 Helvetica-Bold /usr/local/share/ghostscript/fonts/n019004l.pfb | ||
2366 | 562 | displayFontT1 Helvetica-BoldOblique /usr/local/share/ghostscript/fonts/n019024l.pfb | ||
2367 | 563 | displayFontT1 Courier /usr/local/share/ghostscript/fonts/n022003l.pfb | ||
2368 | 564 | displayFontT1 Courier-Oblique /usr/local/share/ghostscript/fonts/n022023l.pfb | ||
2369 | 565 | displayFontT1 Courier-Bold /usr/local/share/ghostscript/fonts/n022004l.pfb | ||
2370 | 566 | displayFontT1 Courier-BoldOblique /usr/local/share/ghostscript/fonts/n022024l.pfb | ||
2371 | 567 | displayFontT1 Symbol /usr/local/share/ghostscript/fonts/s050000l.pfb | ||
2372 | 568 | displayFontT1 ZapfDingbats /usr/local/share/ghostscript/fonts/d050000l.pfb | ||
2373 | 569 | |||
2374 | 570 | # use the Bakoma Type 1 fonts | ||
2375 | 571 | # (this assumes they happen to be installed in /usr/local/fonts/bakoma) | ||
2376 | 572 | fontDir /usr/local/fonts/bakoma | ||
2377 | 573 | |||
2378 | 574 | # set some PostScript options | ||
2379 | 575 | psPaperSize letter | ||
2380 | 576 | psDuplex no | ||
2381 | 577 | psLevel level2 | ||
2382 | 578 | psEmbedType1Fonts yes | ||
2383 | 579 | psEmbedTrueTypeFonts yes | ||
2384 | 580 | psFile "| lpr -Pprinter5" | ||
2385 | 581 | |||
2386 | 582 | # assume that the PostScript printer has the Univers and | ||
2387 | 583 | # Univers-Bold fonts | ||
2388 | 584 | psFont Univers Univers | ||
2389 | 585 | psFont Univers-Bold Univers-Bold | ||
2390 | 586 | |||
2391 | 587 | # set the text output options | ||
2392 | 588 | textEncoding UTF-8 | ||
2393 | 589 | textEOL unix | ||
2394 | 590 | |||
2395 | 591 | # misc options | ||
2396 | 592 | t1libControl low | ||
2397 | 593 | freetypeControl low | ||
2398 | 594 | urlCommand "netscape -remote 'openURL(%s)'" | ||
2399 | 595 | |||
2400 | 596 | .fi | ||
2401 | 597 | .SH FILES | ||
2402 | 598 | .TP | ||
2403 | 599 | .B /usr/local/etc/xpdfrc | ||
2404 | 600 | This is the default location for the system-wide configuration file. | ||
2405 | 601 | Depending on build options, it may be placed elsewhere. | ||
2406 | 602 | .TP | ||
2407 | 603 | .B $HOME/.xpdfrc | ||
2408 | 604 | This is the user's configuration file. If it exists, it will be read | ||
2409 | 605 | in place of the system-wide file. | ||
2410 | 606 | .SH AUTHOR | ||
2411 | 607 | The Xpdf software and documentation are copyright 1996-2007 Glyph & | ||
2412 | 608 | Cog, LLC. | ||
2413 | 609 | .SH "SEE ALSO" | ||
2414 | 610 | .BR xpdf (1), | ||
2415 | 611 | .BR pdftops (1), | ||
2416 | 612 | .BR pdftotext (1), | ||
2417 | 613 | .BR pdfinfo (1), | ||
2418 | 614 | .BR pdftoppm (1), | ||
2419 | 615 | .BR pdfimages (1) | ||
2420 | 616 | .br | ||
2421 | 617 | .B http://www.foolabs.com/xpdf/ | ||
2422 | 0 | 618 | ||
2423 | === added directory '.pc/02_permissions.dpatch' | |||
2424 | === added directory '.pc/02_permissions.dpatch/xpdf' | |||
2425 | === added file '.pc/02_permissions.dpatch/xpdf/PDFCore.cc' | |||
2426 | --- .pc/02_permissions.dpatch/xpdf/PDFCore.cc 1970-01-01 00:00:00 +0000 | |||
2427 | +++ .pc/02_permissions.dpatch/xpdf/PDFCore.cc 2010-04-06 13:42:20 +0000 | |||
2428 | @@ -0,0 +1,2044 @@ | |||
2429 | 1 | //======================================================================== | ||
2430 | 2 | // | ||
2431 | 3 | // PDFCore.cc | ||
2432 | 4 | // | ||
2433 | 5 | // Copyright 2004 Glyph & Cog, LLC | ||
2434 | 6 | // | ||
2435 | 7 | //======================================================================== | ||
2436 | 8 | |||
2437 | 9 | #include <aconf.h> | ||
2438 | 10 | |||
2439 | 11 | #ifdef USE_GCC_PRAGMAS | ||
2440 | 12 | #pragma implementation | ||
2441 | 13 | #endif | ||
2442 | 14 | |||
2443 | 15 | #include <math.h> | ||
2444 | 16 | #include "GString.h" | ||
2445 | 17 | #include "GList.h" | ||
2446 | 18 | #include "GlobalParams.h" | ||
2447 | 19 | #include "Splash.h" | ||
2448 | 20 | #include "SplashBitmap.h" | ||
2449 | 21 | #include "SplashPattern.h" | ||
2450 | 22 | #include "SplashPath.h" | ||
2451 | 23 | #include "Error.h" | ||
2452 | 24 | #include "ErrorCodes.h" | ||
2453 | 25 | #include "PDFDoc.h" | ||
2454 | 26 | #include "Link.h" | ||
2455 | 27 | #include "TextOutputDev.h" | ||
2456 | 28 | #include "CoreOutputDev.h" | ||
2457 | 29 | #include "PDFCore.h" | ||
2458 | 30 | |||
2459 | 31 | //------------------------------------------------------------------------ | ||
2460 | 32 | // PDFCorePage | ||
2461 | 33 | //------------------------------------------------------------------------ | ||
2462 | 34 | |||
2463 | 35 | PDFCorePage::PDFCorePage(int pageA, int wA, int hA, int tileWA, int tileHA) { | ||
2464 | 36 | page = pageA; | ||
2465 | 37 | tiles = new GList(); | ||
2466 | 38 | w = wA; | ||
2467 | 39 | h = hA; | ||
2468 | 40 | tileW = tileWA; | ||
2469 | 41 | tileH = tileHA; | ||
2470 | 42 | links = NULL; | ||
2471 | 43 | text = NULL; | ||
2472 | 44 | } | ||
2473 | 45 | |||
2474 | 46 | PDFCorePage::~PDFCorePage() { | ||
2475 | 47 | deleteGList(tiles, PDFCoreTile); | ||
2476 | 48 | if (links) { | ||
2477 | 49 | delete links; | ||
2478 | 50 | } | ||
2479 | 51 | if (text) { | ||
2480 | 52 | delete text; | ||
2481 | 53 | } | ||
2482 | 54 | } | ||
2483 | 55 | |||
2484 | 56 | //------------------------------------------------------------------------ | ||
2485 | 57 | // PDFCoreTile | ||
2486 | 58 | //------------------------------------------------------------------------ | ||
2487 | 59 | |||
2488 | 60 | PDFCoreTile::PDFCoreTile(int xDestA, int yDestA) { | ||
2489 | 61 | xMin = 0; | ||
2490 | 62 | yMin = 0; | ||
2491 | 63 | xMax = 0; | ||
2492 | 64 | yMax = 0; | ||
2493 | 65 | xDest = xDestA; | ||
2494 | 66 | yDest = yDestA; | ||
2495 | 67 | bitmap = NULL; | ||
2496 | 68 | } | ||
2497 | 69 | |||
2498 | 70 | PDFCoreTile::~PDFCoreTile() { | ||
2499 | 71 | if (bitmap) { | ||
2500 | 72 | delete bitmap; | ||
2501 | 73 | } | ||
2502 | 74 | } | ||
2503 | 75 | |||
2504 | 76 | |||
2505 | 77 | //------------------------------------------------------------------------ | ||
2506 | 78 | // PDFCore | ||
2507 | 79 | //------------------------------------------------------------------------ | ||
2508 | 80 | |||
2509 | 81 | PDFCore::PDFCore(SplashColorMode colorModeA, int bitmapRowPadA, | ||
2510 | 82 | GBool reverseVideoA, SplashColorPtr paperColorA, | ||
2511 | 83 | GBool incrementalUpdate) { | ||
2512 | 84 | int i; | ||
2513 | 85 | |||
2514 | 86 | doc = NULL; | ||
2515 | 87 | continuousMode = globalParams->getContinuousView(); | ||
2516 | 88 | drawAreaWidth = drawAreaHeight = 0; | ||
2517 | 89 | maxPageW = totalDocH = 0; | ||
2518 | 90 | pageY = NULL; | ||
2519 | 91 | topPage = 0; | ||
2520 | 92 | scrollX = scrollY = 0; | ||
2521 | 93 | zoom = defZoom; | ||
2522 | 94 | dpi = 0; | ||
2523 | 95 | rotate = 0; | ||
2524 | 96 | |||
2525 | 97 | selectPage = 0; | ||
2526 | 98 | selectULX = selectLRX = 0; | ||
2527 | 99 | selectULY = selectLRY = 0; | ||
2528 | 100 | dragging = gFalse; | ||
2529 | 101 | lastDragLeft = lastDragTop = gTrue; | ||
2530 | 102 | |||
2531 | 103 | historyCur = pdfHistorySize - 1; | ||
2532 | 104 | historyBLen = historyFLen = 0; | ||
2533 | 105 | for (i = 0; i < pdfHistorySize; ++i) { | ||
2534 | 106 | history[i].fileName = NULL; | ||
2535 | 107 | } | ||
2536 | 108 | |||
2537 | 109 | |||
2538 | 110 | pages = new GList(); | ||
2539 | 111 | curTile = NULL; | ||
2540 | 112 | |||
2541 | 113 | splashColorCopy(paperColor, paperColorA); | ||
2542 | 114 | out = new CoreOutputDev(colorModeA, bitmapRowPadA, | ||
2543 | 115 | reverseVideoA, paperColorA, incrementalUpdate, | ||
2544 | 116 | &redrawCbk, this); | ||
2545 | 117 | out->startDoc(NULL); | ||
2546 | 118 | } | ||
2547 | 119 | |||
2548 | 120 | PDFCore::~PDFCore() { | ||
2549 | 121 | int i; | ||
2550 | 122 | |||
2551 | 123 | if (doc) { | ||
2552 | 124 | delete doc; | ||
2553 | 125 | } | ||
2554 | 126 | for (i = 0; i < pdfHistorySize; ++i) { | ||
2555 | 127 | if (history[i].fileName) { | ||
2556 | 128 | delete history[i].fileName; | ||
2557 | 129 | } | ||
2558 | 130 | } | ||
2559 | 131 | gfree(pageY); | ||
2560 | 132 | deleteGList(pages, PDFCorePage); | ||
2561 | 133 | delete out; | ||
2562 | 134 | } | ||
2563 | 135 | |||
2564 | 136 | int PDFCore::loadFile(GString *fileName, GString *ownerPassword, | ||
2565 | 137 | GString *userPassword) { | ||
2566 | 138 | int err; | ||
2567 | 139 | |||
2568 | 140 | setBusyCursor(gTrue); | ||
2569 | 141 | err = loadFile2(new PDFDoc(fileName->copy(), ownerPassword, userPassword, | ||
2570 | 142 | this)); | ||
2571 | 143 | setBusyCursor(gFalse); | ||
2572 | 144 | return err; | ||
2573 | 145 | } | ||
2574 | 146 | |||
2575 | 147 | #ifdef WIN32 | ||
2576 | 148 | int PDFCore::loadFile(wchar_t *fileName, int fileNameLen, | ||
2577 | 149 | GString *ownerPassword, GString *userPassword) { | ||
2578 | 150 | int err; | ||
2579 | 151 | |||
2580 | 152 | setBusyCursor(gTrue); | ||
2581 | 153 | err = loadFile2(new PDFDoc(fileName, fileNameLen, | ||
2582 | 154 | ownerPassword, userPassword, this)); | ||
2583 | 155 | setBusyCursor(gFalse); | ||
2584 | 156 | return err; | ||
2585 | 157 | } | ||
2586 | 158 | #endif | ||
2587 | 159 | |||
2588 | 160 | int PDFCore::loadFile(BaseStream *stream, GString *ownerPassword, | ||
2589 | 161 | GString *userPassword) { | ||
2590 | 162 | int err; | ||
2591 | 163 | |||
2592 | 164 | setBusyCursor(gTrue); | ||
2593 | 165 | err = loadFile2(new PDFDoc(stream, ownerPassword, userPassword, this)); | ||
2594 | 166 | setBusyCursor(gFalse); | ||
2595 | 167 | return err; | ||
2596 | 168 | } | ||
2597 | 169 | |||
2598 | 170 | void PDFCore::loadDoc(PDFDoc *docA) { | ||
2599 | 171 | setBusyCursor(gTrue); | ||
2600 | 172 | loadFile2(docA); | ||
2601 | 173 | setBusyCursor(gFalse); | ||
2602 | 174 | } | ||
2603 | 175 | |||
2604 | 176 | int PDFCore::loadFile2(PDFDoc *newDoc) { | ||
2605 | 177 | int err; | ||
2606 | 178 | double w, h, t; | ||
2607 | 179 | int i; | ||
2608 | 180 | |||
2609 | 181 | // open the PDF file | ||
2610 | 182 | if (!newDoc->isOk()) { | ||
2611 | 183 | err = newDoc->getErrorCode(); | ||
2612 | 184 | delete newDoc; | ||
2613 | 185 | return err; | ||
2614 | 186 | } | ||
2615 | 187 | |||
2616 | 188 | // replace old document | ||
2617 | 189 | if (doc) { | ||
2618 | 190 | delete doc; | ||
2619 | 191 | } | ||
2620 | 192 | doc = newDoc; | ||
2621 | 193 | if (out) { | ||
2622 | 194 | out->startDoc(doc->getXRef()); | ||
2623 | 195 | } | ||
2624 | 196 | |||
2625 | 197 | // nothing displayed yet | ||
2626 | 198 | topPage = -99; | ||
2627 | 199 | while (pages->getLength() > 0) { | ||
2628 | 200 | delete (PDFCorePage *)pages->del(0); | ||
2629 | 201 | } | ||
2630 | 202 | |||
2631 | 203 | // compute the max unscaled page size | ||
2632 | 204 | maxUnscaledPageW = maxUnscaledPageH = 0; | ||
2633 | 205 | for (i = 1; i <= doc->getNumPages(); ++i) { | ||
2634 | 206 | w = doc->getPageCropWidth(i); | ||
2635 | 207 | h = doc->getPageCropHeight(i); | ||
2636 | 208 | if (doc->getPageRotate(i) == 90 || doc->getPageRotate(i) == 270) { | ||
2637 | 209 | t = w; w = h; h = t; | ||
2638 | 210 | } | ||
2639 | 211 | if (w > maxUnscaledPageW) { | ||
2640 | 212 | maxUnscaledPageW = w; | ||
2641 | 213 | } | ||
2642 | 214 | if (h > maxUnscaledPageH) { | ||
2643 | 215 | maxUnscaledPageH = h; | ||
2644 | 216 | } | ||
2645 | 217 | } | ||
2646 | 218 | |||
2647 | 219 | return errNone; | ||
2648 | 220 | } | ||
2649 | 221 | |||
2650 | 222 | void PDFCore::clear() { | ||
2651 | 223 | if (!doc) { | ||
2652 | 224 | return; | ||
2653 | 225 | } | ||
2654 | 226 | |||
2655 | 227 | // no document | ||
2656 | 228 | delete doc; | ||
2657 | 229 | doc = NULL; | ||
2658 | 230 | out->clear(); | ||
2659 | 231 | |||
2660 | 232 | // no page displayed | ||
2661 | 233 | topPage = -99; | ||
2662 | 234 | while (pages->getLength() > 0) { | ||
2663 | 235 | delete (PDFCorePage *)pages->del(0); | ||
2664 | 236 | } | ||
2665 | 237 | |||
2666 | 238 | // redraw | ||
2667 | 239 | scrollX = scrollY = 0; | ||
2668 | 240 | redrawWindow(0, 0, drawAreaWidth, drawAreaHeight, gTrue); | ||
2669 | 241 | updateScrollbars(); | ||
2670 | 242 | } | ||
2671 | 243 | |||
2672 | 244 | PDFDoc *PDFCore::takeDoc(GBool redraw) { | ||
2673 | 245 | PDFDoc *docA; | ||
2674 | 246 | |||
2675 | 247 | if (!doc) { | ||
2676 | 248 | return NULL; | ||
2677 | 249 | } | ||
2678 | 250 | |||
2679 | 251 | // no document | ||
2680 | 252 | docA = doc; | ||
2681 | 253 | doc = NULL; | ||
2682 | 254 | out->clear(); | ||
2683 | 255 | |||
2684 | 256 | // no page displayed | ||
2685 | 257 | topPage = -99; | ||
2686 | 258 | while (pages->getLength() > 0) { | ||
2687 | 259 | delete (PDFCorePage *)pages->del(0); | ||
2688 | 260 | } | ||
2689 | 261 | |||
2690 | 262 | // redraw | ||
2691 | 263 | scrollX = scrollY = 0; | ||
2692 | 264 | if (redraw) { | ||
2693 | 265 | redrawWindow(0, 0, drawAreaWidth, drawAreaHeight, gTrue); | ||
2694 | 266 | updateScrollbars(); | ||
2695 | 267 | } | ||
2696 | 268 | |||
2697 | 269 | return docA; | ||
2698 | 270 | } | ||
2699 | 271 | |||
2700 | 272 | void PDFCore::displayPage(int topPageA, double zoomA, int rotateA, | ||
2701 | 273 | GBool scrollToTop, GBool addToHist) { | ||
2702 | 274 | int scrollXA, scrollYA; | ||
2703 | 275 | |||
2704 | 276 | scrollXA = scrollX; | ||
2705 | 277 | if (continuousMode) { | ||
2706 | 278 | scrollYA = -1; | ||
2707 | 279 | } else if (scrollToTop) { | ||
2708 | 280 | scrollYA = 0; | ||
2709 | 281 | } else { | ||
2710 | 282 | scrollYA = scrollY; | ||
2711 | 283 | } | ||
2712 | 284 | if (zoomA != zoom) { | ||
2713 | 285 | scrollXA = 0; | ||
2714 | 286 | scrollYA = continuousMode ? -1 : 0; | ||
2715 | 287 | } | ||
2716 | 288 | |||
2717 | 289 | dragging = gFalse; | ||
2718 | 290 | lastDragLeft = lastDragTop = gTrue; | ||
2719 | 291 | |||
2720 | 292 | update(topPageA, scrollXA, scrollYA, zoomA, rotateA, gTrue, addToHist); | ||
2721 | 293 | } | ||
2722 | 294 | |||
2723 | 295 | void PDFCore::displayDest(LinkDest *dest, double zoomA, int rotateA, | ||
2724 | 296 | GBool addToHist) { | ||
2725 | 297 | Ref pageRef; | ||
2726 | 298 | int topPageA; | ||
2727 | 299 | int dx, dy, scrollXA, scrollYA; | ||
2728 | 300 | |||
2729 | 301 | if (dest->isPageRef()) { | ||
2730 | 302 | pageRef = dest->getPageRef(); | ||
2731 | 303 | topPageA = doc->findPage(pageRef.num, pageRef.gen); | ||
2732 | 304 | } else { | ||
2733 | 305 | topPageA = dest->getPageNum(); | ||
2734 | 306 | } | ||
2735 | 307 | if (topPageA <= 0 || topPageA > doc->getNumPages()) { | ||
2736 | 308 | topPageA = 1; | ||
2737 | 309 | } | ||
2738 | 310 | scrollXA = scrollX; | ||
2739 | 311 | scrollYA = continuousMode ? -1 : scrollY; | ||
2740 | 312 | switch (dest->getKind()) { | ||
2741 | 313 | case destXYZ: | ||
2742 | 314 | cvtUserToDev(topPageA, dest->getLeft(), dest->getTop(), &dx, &dy); | ||
2743 | 315 | scrollXA = dest->getChangeLeft() ? dx : scrollX; | ||
2744 | 316 | if (dest->getChangeTop()) { | ||
2745 | 317 | scrollYA = dy; | ||
2746 | 318 | } else { | ||
2747 | 319 | if (topPage <= 0) { | ||
2748 | 320 | scrollYA = 0; | ||
2749 | 321 | } else if (continuousMode) { | ||
2750 | 322 | scrollYA = scrollY - pageY[topPage - 1]; | ||
2751 | 323 | } else { | ||
2752 | 324 | scrollYA = scrollY; | ||
2753 | 325 | } | ||
2754 | 326 | } | ||
2755 | 327 | if (continuousMode && topPage > 0) { | ||
2756 | 328 | scrollYA += pageY[topPageA - 1]; | ||
2757 | 329 | } | ||
2758 | 330 | //~ what is the zoom parameter? | ||
2759 | 331 | break; | ||
2760 | 332 | case destFit: | ||
2761 | 333 | case destFitB: | ||
2762 | 334 | //~ do fit | ||
2763 | 335 | scrollXA = 0; | ||
2764 | 336 | scrollYA = continuousMode ? -1 : 0; | ||
2765 | 337 | break; | ||
2766 | 338 | case destFitH: | ||
2767 | 339 | case destFitBH: | ||
2768 | 340 | //~ do fit | ||
2769 | 341 | cvtUserToDev(topPageA, 0, dest->getTop(), &dx, &dy); | ||
2770 | 342 | if (continuousMode && topPage > 0) { | ||
2771 | 343 | dy += pageY[topPageA - 1]; | ||
2772 | 344 | } | ||
2773 | 345 | scrollXA = 0; | ||
2774 | 346 | scrollYA = dy; | ||
2775 | 347 | break; | ||
2776 | 348 | case destFitV: | ||
2777 | 349 | case destFitBV: | ||
2778 | 350 | //~ do fit | ||
2779 | 351 | cvtUserToDev(topPageA, dest->getLeft(), 0, &dx, &dy); | ||
2780 | 352 | scrollXA = dx; | ||
2781 | 353 | scrollYA = continuousMode ? -1 : 0; | ||
2782 | 354 | break; | ||
2783 | 355 | case destFitR: | ||
2784 | 356 | //~ do fit | ||
2785 | 357 | cvtUserToDev(topPageA, dest->getLeft(), dest->getTop(), &dx, &dy); | ||
2786 | 358 | if (continuousMode && topPage > 0) { | ||
2787 | 359 | dy += pageY[topPageA - 1]; | ||
2788 | 360 | } | ||
2789 | 361 | scrollXA = dx; | ||
2790 | 362 | scrollYA = dy; | ||
2791 | 363 | break; | ||
2792 | 364 | } | ||
2793 | 365 | update(topPageA, scrollXA, scrollYA, zoom, rotate, gFalse, | ||
2794 | 366 | addToHist && topPageA != topPage); | ||
2795 | 367 | } | ||
2796 | 368 | |||
2797 | 369 | void PDFCore::update(int topPageA, int scrollXA, int scrollYA, | ||
2798 | 370 | double zoomA, int rotateA, GBool force, GBool addToHist) { | ||
2799 | 371 | double hDPI, vDPI, dpiA, uw, uh, ut; | ||
2800 | 372 | int w, h, t, x0, x1, y0, y1, x, y; | ||
2801 | 373 | int rot; | ||
2802 | 374 | int pg0, pg1; | ||
2803 | 375 | PDFCoreTile *tile; | ||
2804 | 376 | PDFCorePage *page; | ||
2805 | 377 | PDFHistory *hist; | ||
2806 | 378 | SplashColor xorColor; | ||
2807 | 379 | GBool needUpdate; | ||
2808 | 380 | int i, j; | ||
2809 | 381 | |||
2810 | 382 | // check for document and valid page number | ||
2811 | 383 | if (!doc) { | ||
2812 | 384 | // save the new settings | ||
2813 | 385 | zoom = zoomA; | ||
2814 | 386 | rotate = rotateA; | ||
2815 | 387 | return; | ||
2816 | 388 | } | ||
2817 | 389 | if (topPageA <= 0 || topPageA > doc->getNumPages()) { | ||
2818 | 390 | return; | ||
2819 | 391 | } | ||
2820 | 392 | |||
2821 | 393 | needUpdate = gFalse; | ||
2822 | 394 | |||
2823 | 395 | // check for changes to the PDF file | ||
2824 | 396 | if ((force || (!continuousMode && topPage != topPageA)) && | ||
2825 | 397 | checkForNewFile()) { | ||
2826 | 398 | if (loadFile(doc->getFileName()) == errNone) { | ||
2827 | 399 | if (topPageA > doc->getNumPages()) { | ||
2828 | 400 | topPageA = doc->getNumPages(); | ||
2829 | 401 | } | ||
2830 | 402 | needUpdate = gTrue; | ||
2831 | 403 | } | ||
2832 | 404 | } | ||
2833 | 405 | |||
2834 | 406 | // compute the DPI | ||
2835 | 407 | if (continuousMode) { | ||
2836 | 408 | uw = maxUnscaledPageW; | ||
2837 | 409 | uh = maxUnscaledPageH; | ||
2838 | 410 | rot = rotateA; | ||
2839 | 411 | } else { | ||
2840 | 412 | uw = doc->getPageCropWidth(topPageA); | ||
2841 | 413 | uh = doc->getPageCropHeight(topPageA); | ||
2842 | 414 | rot = rotateA + doc->getPageRotate(topPageA); | ||
2843 | 415 | if (rot >= 360) { | ||
2844 | 416 | rot -= 360; | ||
2845 | 417 | } else if (rot < 0) { | ||
2846 | 418 | rot += 360; | ||
2847 | 419 | } | ||
2848 | 420 | } | ||
2849 | 421 | if (rot == 90 || rot == 270) { | ||
2850 | 422 | ut = uw; uw = uh; uh = ut; | ||
2851 | 423 | } | ||
2852 | 424 | if (zoomA == zoomPage) { | ||
2853 | 425 | hDPI = (drawAreaWidth / uw) * 72; | ||
2854 | 426 | if (continuousMode) { | ||
2855 | 427 | vDPI = ((drawAreaHeight - continuousModePageSpacing) / uh) * 72; | ||
2856 | 428 | } else { | ||
2857 | 429 | vDPI = (drawAreaHeight / uh) * 72; | ||
2858 | 430 | } | ||
2859 | 431 | dpiA = (hDPI < vDPI) ? hDPI : vDPI; | ||
2860 | 432 | } else if (zoomA == zoomWidth) { | ||
2861 | 433 | dpiA = (drawAreaWidth / uw) * 72; | ||
2862 | 434 | } else { | ||
2863 | 435 | dpiA = 0.01 * zoomA * 72; | ||
2864 | 436 | } | ||
2865 | 437 | // this can happen if the window hasn't been sized yet | ||
2866 | 438 | if (dpiA <= 0) { | ||
2867 | 439 | dpiA = 1; | ||
2868 | 440 | } | ||
2869 | 441 | |||
2870 | 442 | // if the display properties have changed, create a new PDFCorePage | ||
2871 | 443 | // object | ||
2872 | 444 | if (force || pages->getLength() == 0 || | ||
2873 | 445 | (!continuousMode && topPageA != topPage) || | ||
2874 | 446 | zoomA != zoom || dpiA != dpi || rotateA != rotate) { | ||
2875 | 447 | needUpdate = gTrue; | ||
2876 | 448 | setSelection(0, 0, 0, 0, 0); | ||
2877 | 449 | while (pages->getLength() > 0) { | ||
2878 | 450 | delete (PDFCorePage *)pages->del(0); | ||
2879 | 451 | } | ||
2880 | 452 | zoom = zoomA; | ||
2881 | 453 | rotate = rotateA; | ||
2882 | 454 | dpi = dpiA; | ||
2883 | 455 | if (continuousMode) { | ||
2884 | 456 | maxPageW = totalDocH = 0; | ||
2885 | 457 | pageY = (int *)greallocn(pageY, doc->getNumPages(), sizeof(int)); | ||
2886 | 458 | for (i = 1; i <= doc->getNumPages(); ++i) { | ||
2887 | 459 | pageY[i-1] = totalDocH; | ||
2888 | 460 | w = (int)((doc->getPageCropWidth(i) * dpi) / 72 + 0.5); | ||
2889 | 461 | h = (int)((doc->getPageCropHeight(i) * dpi) / 72 + 0.5); | ||
2890 | 462 | rot = rotate + doc->getPageRotate(i); | ||
2891 | 463 | if (rot >= 360) { | ||
2892 | 464 | rot -= 360; | ||
2893 | 465 | } else if (rot < 0) { | ||
2894 | 466 | rot += 360; | ||
2895 | 467 | } | ||
2896 | 468 | if (rot == 90 || rot == 270) { | ||
2897 | 469 | t = w; w = h; h = t; | ||
2898 | 470 | } | ||
2899 | 471 | if (w > maxPageW) { | ||
2900 | 472 | maxPageW = w; | ||
2901 | 473 | } | ||
2902 | 474 | totalDocH += h; | ||
2903 | 475 | if (i < doc->getNumPages()) { | ||
2904 | 476 | totalDocH += continuousModePageSpacing; | ||
2905 | 477 | } | ||
2906 | 478 | } | ||
2907 | 479 | } else { | ||
2908 | 480 | rot = rotate + doc->getPageRotate(topPageA); | ||
2909 | 481 | if (rot >= 360) { | ||
2910 | 482 | rot -= 360; | ||
2911 | 483 | } else if (rot < 0) { | ||
2912 | 484 | rot += 360; | ||
2913 | 485 | } | ||
2914 | 486 | addPage(topPageA, rot); | ||
2915 | 487 | } | ||
2916 | 488 | } else { | ||
2917 | 489 | // erase the selection | ||
2918 | 490 | if (selectULX != selectLRX && selectULY != selectLRY) { | ||
2919 | 491 | xorColor[0] = xorColor[1] = xorColor[2] = 0xff; | ||
2920 | 492 | xorRectangle(selectPage, selectULX, selectULY, selectLRX, selectLRY, | ||
2921 | 493 | new SplashSolidColor(xorColor)); | ||
2922 | 494 | } | ||
2923 | 495 | } | ||
2924 | 496 | if (continuousMode) { | ||
2925 | 497 | page = NULL; // make gcc happy | ||
2926 | 498 | } else { | ||
2927 | 499 | page = (PDFCorePage *)pages->get(0); | ||
2928 | 500 | } | ||
2929 | 501 | topPage = topPageA; | ||
2930 | 502 | |||
2931 | 503 | // adjust the scroll position | ||
2932 | 504 | scrollX = scrollXA; | ||
2933 | 505 | if (continuousMode && scrollYA < 0) { | ||
2934 | 506 | scrollY = pageY[topPage - 1]; | ||
2935 | 507 | } else { | ||
2936 | 508 | scrollY = scrollYA; | ||
2937 | 509 | } | ||
2938 | 510 | w = continuousMode ? maxPageW : page->w; | ||
2939 | 511 | if (scrollX > w - drawAreaWidth) { | ||
2940 | 512 | scrollX = w - drawAreaWidth; | ||
2941 | 513 | } | ||
2942 | 514 | if (scrollX < 0) { | ||
2943 | 515 | scrollX = 0; | ||
2944 | 516 | } | ||
2945 | 517 | h = continuousMode ? totalDocH : page->h; | ||
2946 | 518 | if (scrollY > h - drawAreaHeight) { | ||
2947 | 519 | scrollY = h - drawAreaHeight; | ||
2948 | 520 | } | ||
2949 | 521 | if (scrollY < 0) { | ||
2950 | 522 | scrollY = 0; | ||
2951 | 523 | } | ||
2952 | 524 | |||
2953 | 525 | // find topPage, and the first and last pages to be rasterized | ||
2954 | 526 | if (continuousMode) { | ||
2955 | 527 | //~ should use a binary search | ||
2956 | 528 | for (i = 2; i <= doc->getNumPages(); ++i) { | ||
2957 | 529 | if (pageY[i-1] > scrollY - drawAreaHeight / 2) { | ||
2958 | 530 | break; | ||
2959 | 531 | } | ||
2960 | 532 | } | ||
2961 | 533 | pg0 = i - 1; | ||
2962 | 534 | for (i = pg0 + 1; i <= doc->getNumPages(); ++i) { | ||
2963 | 535 | if (pageY[i-1] > scrollY) { | ||
2964 | 536 | break; | ||
2965 | 537 | } | ||
2966 | 538 | } | ||
2967 | 539 | topPage = i - 1; | ||
2968 | 540 | for (i = topPage + 1; i <= doc->getNumPages(); ++i) { | ||
2969 | 541 | if (pageY[i-1] > scrollY + drawAreaHeight + drawAreaHeight / 2) { | ||
2970 | 542 | break; | ||
2971 | 543 | } | ||
2972 | 544 | } | ||
2973 | 545 | pg1 = i - 1; | ||
2974 | 546 | |||
2975 | 547 | // delete pages that are no longer needed and insert new pages | ||
2976 | 548 | // objects that are needed | ||
2977 | 549 | while (pages->getLength() > 0 && | ||
2978 | 550 | ((PDFCorePage *)pages->get(0))->page < pg0) { | ||
2979 | 551 | delete (PDFCorePage *)pages->del(0); | ||
2980 | 552 | } | ||
2981 | 553 | i = pages->getLength() - 1; | ||
2982 | 554 | while (i > 0 && ((PDFCorePage *)pages->get(i))->page > pg1) { | ||
2983 | 555 | delete (PDFCorePage *)pages->del(i--); | ||
2984 | 556 | } | ||
2985 | 557 | j = pages->getLength() > 0 ? ((PDFCorePage *)pages->get(0))->page - 1 | ||
2986 | 558 | : pg1; | ||
2987 | 559 | for (i = pg0; i <= j; ++i) { | ||
2988 | 560 | rot = rotate + doc->getPageRotate(i); | ||
2989 | 561 | if (rot >= 360) { | ||
2990 | 562 | rot -= 360; | ||
2991 | 563 | } else if (rot < 0) { | ||
2992 | 564 | rot += 360; | ||
2993 | 565 | } | ||
2994 | 566 | addPage(i, rot); | ||
2995 | 567 | } | ||
2996 | 568 | j = ((PDFCorePage *)pages->get(pages->getLength() - 1))->page; | ||
2997 | 569 | for (i = j + 1; i <= pg1; ++i) { | ||
2998 | 570 | rot = rotate + doc->getPageRotate(i); | ||
2999 | 571 | if (rot >= 360) { | ||
3000 | 572 | rot -= 360; | ||
3001 | 573 | } else if (rot < 0) { | ||
3002 | 574 | rot += 360; | ||
3003 | 575 | } | ||
3004 | 576 | addPage(i, rot); | ||
3005 | 577 | } | ||
3006 | 578 | |||
3007 | 579 | } else { | ||
3008 | 580 | pg0 = pg1 = topPage; | ||
3009 | 581 | } | ||
3010 | 582 | |||
3011 | 583 | // delete tiles that are no longer needed | ||
3012 | 584 | for (i = 0; i < pages->getLength(); ++i) { | ||
3013 | 585 | page = (PDFCorePage *)pages->get(i); | ||
3014 | 586 | j = 0; | ||
3015 | 587 | while (j < page->tiles->getLength()) { | ||
3016 | 588 | tile = (PDFCoreTile *)page->tiles->get(j); | ||
3017 | 589 | if (continuousMode) { | ||
3018 | 590 | y0 = pageY[page->page - 1] + tile->yMin; | ||
3019 | 591 | y1 = pageY[page->page - 1] + tile->yMax; | ||
3020 | 592 | } else { | ||
3021 | 593 | y0 = tile->yMin; | ||
3022 | 594 | y1 = tile->yMax; | ||
3023 | 595 | } | ||
3024 | 596 | if (tile->xMax < scrollX - drawAreaWidth / 2 || | ||
3025 | 597 | tile->xMin > scrollX + drawAreaWidth + drawAreaWidth / 2 || | ||
3026 | 598 | y1 < scrollY - drawAreaHeight / 2 || | ||
3027 | 599 | y0 > scrollY + drawAreaHeight + drawAreaHeight / 2) { | ||
3028 | 600 | delete (PDFCoreTile *)page->tiles->del(j); | ||
3029 | 601 | } else { | ||
3030 | 602 | ++j; | ||
3031 | 603 | } | ||
3032 | 604 | } | ||
3033 | 605 | } | ||
3034 | 606 | |||
3035 | 607 | // update page positions | ||
3036 | 608 | for (i = 0; i < pages->getLength(); ++i) { | ||
3037 | 609 | page = (PDFCorePage *)pages->get(i); | ||
3038 | 610 | page->xDest = -scrollX; | ||
3039 | 611 | if (continuousMode) { | ||
3040 | 612 | page->yDest = pageY[page->page - 1] - scrollY; | ||
3041 | 613 | } else { | ||
3042 | 614 | page->yDest = -scrollY; | ||
3043 | 615 | } | ||
3044 | 616 | if (continuousMode) { | ||
3045 | 617 | if (page->w < maxPageW) { | ||
3046 | 618 | page->xDest += (maxPageW - page->w) / 2; | ||
3047 | 619 | } | ||
3048 | 620 | if (maxPageW < drawAreaWidth) { | ||
3049 | 621 | page->xDest += (drawAreaWidth - maxPageW) / 2; | ||
3050 | 622 | } | ||
3051 | 623 | } else if (page->w < drawAreaWidth) { | ||
3052 | 624 | page->xDest += (drawAreaWidth - page->w) / 2; | ||
3053 | 625 | } | ||
3054 | 626 | if (continuousMode && totalDocH < drawAreaHeight) { | ||
3055 | 627 | page->yDest += (drawAreaHeight - totalDocH) / 2; | ||
3056 | 628 | } else if (!continuousMode && page->h < drawAreaHeight) { | ||
3057 | 629 | page->yDest += (drawAreaHeight - page->h) / 2; | ||
3058 | 630 | } | ||
3059 | 631 | } | ||
3060 | 632 | |||
3061 | 633 | // rasterize any new tiles | ||
3062 | 634 | for (i = 0; i < pages->getLength(); ++i) { | ||
3063 | 635 | page = (PDFCorePage *)pages->get(i); | ||
3064 | 636 | x0 = page->xDest; | ||
3065 | 637 | x1 = x0 + page->w - 1; | ||
3066 | 638 | if (x0 < -drawAreaWidth / 2) { | ||
3067 | 639 | x0 = -drawAreaWidth / 2; | ||
3068 | 640 | } | ||
3069 | 641 | if (x1 > drawAreaWidth + drawAreaWidth / 2) { | ||
3070 | 642 | x1 = drawAreaWidth + drawAreaWidth / 2; | ||
3071 | 643 | } | ||
3072 | 644 | x0 = ((x0 - page->xDest) / page->tileW) * page->tileW; | ||
3073 | 645 | x1 = ((x1 - page->xDest) / page->tileW) * page->tileW; | ||
3074 | 646 | y0 = page->yDest; | ||
3075 | 647 | y1 = y0 + page->h - 1; | ||
3076 | 648 | if (y0 < -drawAreaHeight / 2) { | ||
3077 | 649 | y0 = -drawAreaHeight / 2; | ||
3078 | 650 | } | ||
3079 | 651 | if (y1 > drawAreaHeight + drawAreaHeight / 2) { | ||
3080 | 652 | y1 = drawAreaHeight + drawAreaHeight / 2; | ||
3081 | 653 | } | ||
3082 | 654 | y0 = ((y0 - page->yDest) / page->tileH) * page->tileH; | ||
3083 | 655 | y1 = ((y1 - page->yDest) / page->tileH) * page->tileH; | ||
3084 | 656 | for (y = y0; y <= y1; y += page->tileH) { | ||
3085 | 657 | for (x = x0; x <= x1; x += page->tileW) { | ||
3086 | 658 | needTile(page, x, y); | ||
3087 | 659 | } | ||
3088 | 660 | } | ||
3089 | 661 | } | ||
3090 | 662 | |||
3091 | 663 | // update tile positions | ||
3092 | 664 | for (i = 0; i < pages->getLength(); ++i) { | ||
3093 | 665 | page = (PDFCorePage *)pages->get(i); | ||
3094 | 666 | for (j = 0; j < page->tiles->getLength(); ++j) { | ||
3095 | 667 | tile = (PDFCoreTile *)page->tiles->get(j); | ||
3096 | 668 | tile->xDest = tile->xMin - scrollX; | ||
3097 | 669 | if (continuousMode) { | ||
3098 | 670 | tile->yDest = tile->yMin + pageY[page->page - 1] - scrollY; | ||
3099 | 671 | } else { | ||
3100 | 672 | tile->yDest = tile->yMin - scrollY; | ||
3101 | 673 | } | ||
3102 | 674 | if (continuousMode) { | ||
3103 | 675 | if (page->w < maxPageW) { | ||
3104 | 676 | tile->xDest += (maxPageW - page->w) / 2; | ||
3105 | 677 | } | ||
3106 | 678 | if (maxPageW < drawAreaWidth) { | ||
3107 | 679 | tile->xDest += (drawAreaWidth - maxPageW) / 2; | ||
3108 | 680 | } | ||
3109 | 681 | } else if (page->w < drawAreaWidth) { | ||
3110 | 682 | tile->xDest += (drawAreaWidth - page->w) / 2; | ||
3111 | 683 | } | ||
3112 | 684 | if (continuousMode && totalDocH < drawAreaHeight) { | ||
3113 | 685 | tile->yDest += (drawAreaHeight - totalDocH) / 2; | ||
3114 | 686 | } else if (!continuousMode && page->h < drawAreaHeight) { | ||
3115 | 687 | tile->yDest += (drawAreaHeight - page->h) / 2; | ||
3116 | 688 | } | ||
3117 | 689 | } | ||
3118 | 690 | } | ||
3119 | 691 | |||
3120 | 692 | // redraw the selection | ||
3121 | 693 | if (selectULX != selectLRX && selectULY != selectLRY) { | ||
3122 | 694 | xorColor[0] = xorColor[1] = xorColor[2] = 0xff; | ||
3123 | 695 | xorRectangle(selectPage, selectULX, selectULY, selectLRX, selectLRY, | ||
3124 | 696 | new SplashSolidColor(xorColor)); | ||
3125 | 697 | } | ||
3126 | 698 | |||
3127 | 699 | // redraw the window | ||
3128 | 700 | redrawWindow(0, 0, drawAreaWidth, drawAreaHeight, needUpdate); | ||
3129 | 701 | updateScrollbars(); | ||
3130 | 702 | |||
3131 | 703 | // add to history | ||
3132 | 704 | if (addToHist) { | ||
3133 | 705 | if (++historyCur == pdfHistorySize) { | ||
3134 | 706 | historyCur = 0; | ||
3135 | 707 | } | ||
3136 | 708 | hist = &history[historyCur]; | ||
3137 | 709 | if (hist->fileName) { | ||
3138 | 710 | delete hist->fileName; | ||
3139 | 711 | } | ||
3140 | 712 | if (doc->getFileName()) { | ||
3141 | 713 | hist->fileName = doc->getFileName()->copy(); | ||
3142 | 714 | } else { | ||
3143 | 715 | hist->fileName = NULL; | ||
3144 | 716 | } | ||
3145 | 717 | hist->page = topPage; | ||
3146 | 718 | if (historyBLen < pdfHistorySize) { | ||
3147 | 719 | ++historyBLen; | ||
3148 | 720 | } | ||
3149 | 721 | historyFLen = 0; | ||
3150 | 722 | } | ||
3151 | 723 | } | ||
3152 | 724 | |||
3153 | 725 | void PDFCore::addPage(int pg, int rot) { | ||
3154 | 726 | PDFCorePage *page; | ||
3155 | 727 | int w, h, t, tileW, tileH, i; | ||
3156 | 728 | |||
3157 | 729 | w = (int)((doc->getPageCropWidth(pg) * dpi) / 72 + 0.5); | ||
3158 | 730 | h = (int)((doc->getPageCropHeight(pg) * dpi) / 72 + 0.5); | ||
3159 | 731 | if (rot == 90 || rot == 270) { | ||
3160 | 732 | t = w; w = h; h = t; | ||
3161 | 733 | } | ||
3162 | 734 | tileW = 2 * drawAreaWidth; | ||
3163 | 735 | if (tileW < 1500) { | ||
3164 | 736 | tileW = 1500; | ||
3165 | 737 | } | ||
3166 | 738 | if (tileW > w) { | ||
3167 | 739 | tileW = w; | ||
3168 | 740 | } | ||
3169 | 741 | tileH = 2 * drawAreaHeight; | ||
3170 | 742 | if (tileH < 1500) { | ||
3171 | 743 | tileH = 1500; | ||
3172 | 744 | } | ||
3173 | 745 | if (tileH > h) { | ||
3174 | 746 | tileH = h; | ||
3175 | 747 | } | ||
3176 | 748 | page = new PDFCorePage(pg, w, h, tileW, tileH); | ||
3177 | 749 | for (i = 0; | ||
3178 | 750 | i < pages->getLength() && pg > ((PDFCorePage *)pages->get(i))->page; | ||
3179 | 751 | ++i) ; | ||
3180 | 752 | pages->insert(i, page); | ||
3181 | 753 | } | ||
3182 | 754 | |||
3183 | 755 | void PDFCore::needTile(PDFCorePage *page, int x, int y) { | ||
3184 | 756 | PDFCoreTile *tile; | ||
3185 | 757 | TextOutputDev *textOut; | ||
3186 | 758 | int xDest, yDest, sliceW, sliceH; | ||
3187 | 759 | int i; | ||
3188 | 760 | |||
3189 | 761 | for (i = 0; i < page->tiles->getLength(); ++i) { | ||
3190 | 762 | tile = (PDFCoreTile *)page->tiles->get(i); | ||
3191 | 763 | if (x == tile->xMin && y == tile->yMin) { | ||
3192 | 764 | return; | ||
3193 | 765 | } | ||
3194 | 766 | } | ||
3195 | 767 | |||
3196 | 768 | setBusyCursor(gTrue); | ||
3197 | 769 | |||
3198 | 770 | sliceW = page->tileW; | ||
3199 | 771 | if (x + sliceW > page->w) { | ||
3200 | 772 | sliceW = page->w - x; | ||
3201 | 773 | } | ||
3202 | 774 | sliceH = page->tileH; | ||
3203 | 775 | if (y + sliceH > page->h) { | ||
3204 | 776 | sliceH = page->h - y; | ||
3205 | 777 | } | ||
3206 | 778 | |||
3207 | 779 | xDest = x - scrollX; | ||
3208 | 780 | if (continuousMode) { | ||
3209 | 781 | yDest = y + pageY[page->page - 1] - scrollY; | ||
3210 | 782 | } else { | ||
3211 | 783 | yDest = y - scrollY; | ||
3212 | 784 | } | ||
3213 | 785 | if (continuousMode) { | ||
3214 | 786 | if (page->w < maxPageW) { | ||
3215 | 787 | xDest += (maxPageW - page->w) / 2; | ||
3216 | 788 | } | ||
3217 | 789 | if (maxPageW < drawAreaWidth) { | ||
3218 | 790 | xDest += (drawAreaWidth - maxPageW) / 2; | ||
3219 | 791 | } | ||
3220 | 792 | } else if (page->w < drawAreaWidth) { | ||
3221 | 793 | xDest += (drawAreaWidth - page->w) / 2; | ||
3222 | 794 | } | ||
3223 | 795 | if (continuousMode && totalDocH < drawAreaHeight) { | ||
3224 | 796 | yDest += (drawAreaHeight - totalDocH) / 2; | ||
3225 | 797 | } else if (!continuousMode && page->h < drawAreaHeight) { | ||
3226 | 798 | yDest += (drawAreaHeight - page->h) / 2; | ||
3227 | 799 | } | ||
3228 | 800 | curTile = tile = newTile(xDest, yDest); | ||
3229 | 801 | curPage = page; | ||
3230 | 802 | tile->xMin = x; | ||
3231 | 803 | tile->yMin = y; | ||
3232 | 804 | tile->xMax = x + sliceW; | ||
3233 | 805 | tile->yMax = y + sliceH; | ||
3234 | 806 | tile->edges = 0; | ||
3235 | 807 | if (tile->xMin == 0) { | ||
3236 | 808 | tile->edges |= pdfCoreTileLeftEdge; | ||
3237 | 809 | } | ||
3238 | 810 | if (tile->xMax == page->w) { | ||
3239 | 811 | tile->edges |= pdfCoreTileRightEdge; | ||
3240 | 812 | } | ||
3241 | 813 | if (continuousMode) { | ||
3242 | 814 | if (tile->yMin == 0) { | ||
3243 | 815 | tile->edges |= pdfCoreTileTopSpace; | ||
3244 | 816 | if (page->page == 1) { | ||
3245 | 817 | tile->edges |= pdfCoreTileTopEdge; | ||
3246 | 818 | } | ||
3247 | 819 | } | ||
3248 | 820 | if (tile->yMax == page->h) { | ||
3249 | 821 | tile->edges |= pdfCoreTileBottomSpace; | ||
3250 | 822 | if (page->page == doc->getNumPages()) { | ||
3251 | 823 | tile->edges |= pdfCoreTileBottomEdge; | ||
3252 | 824 | } | ||
3253 | 825 | } | ||
3254 | 826 | } else { | ||
3255 | 827 | if (tile->yMin == 0) { | ||
3256 | 828 | tile->edges |= pdfCoreTileTopEdge; | ||
3257 | 829 | } | ||
3258 | 830 | if (tile->yMax == page->h) { | ||
3259 | 831 | tile->edges |= pdfCoreTileBottomEdge; | ||
3260 | 832 | } | ||
3261 | 833 | } | ||
3262 | 834 | doc->displayPageSlice(out, page->page, dpi, dpi, rotate, | ||
3263 | 835 | gFalse, gTrue, gFalse, x, y, sliceW, sliceH); | ||
3264 | 836 | tile->bitmap = out->takeBitmap(); | ||
3265 | 837 | memcpy(tile->ctm, out->getDefCTM(), 6 * sizeof(double)); | ||
3266 | 838 | memcpy(tile->ictm, out->getDefICTM(), 6 * sizeof(double)); | ||
3267 | 839 | if (!page->links) { | ||
3268 | 840 | page->links = doc->getLinks(page->page); | ||
3269 | 841 | } | ||
3270 | 842 | if (!page->text) { | ||
3271 | 843 | if ((textOut = new TextOutputDev(NULL, gTrue, gFalse, gFalse))) { | ||
3272 | 844 | doc->displayPage(textOut, page->page, dpi, dpi, rotate, | ||
3273 | 845 | gFalse, gTrue, gFalse); | ||
3274 | 846 | page->text = textOut->takeText(); | ||
3275 | 847 | delete textOut; | ||
3276 | 848 | } | ||
3277 | 849 | } | ||
3278 | 850 | page->tiles->append(tile); | ||
3279 | 851 | curTile = NULL; | ||
3280 | 852 | curPage = NULL; | ||
3281 | 853 | |||
3282 | 854 | setBusyCursor(gFalse); | ||
3283 | 855 | } | ||
3284 | 856 | |||
3285 | 857 | GBool PDFCore::gotoNextPage(int inc, GBool top) { | ||
3286 | 858 | int pg, scrollYA; | ||
3287 | 859 | |||
3288 | 860 | if (!doc || doc->getNumPages() == 0 || topPage >= doc->getNumPages()) { | ||
3289 | 861 | return gFalse; | ||
3290 | 862 | } | ||
3291 | 863 | if ((pg = topPage + inc) > doc->getNumPages()) { | ||
3292 | 864 | pg = doc->getNumPages(); | ||
3293 | 865 | } | ||
3294 | 866 | if (continuousMode) { | ||
3295 | 867 | scrollYA = -1; | ||
3296 | 868 | } else if (top) { | ||
3297 | 869 | scrollYA = 0; | ||
3298 | 870 | } else { | ||
3299 | 871 | scrollYA = scrollY; | ||
3300 | 872 | } | ||
3301 | 873 | update(pg, scrollX, scrollYA, zoom, rotate, gFalse, gTrue); | ||
3302 | 874 | return gTrue; | ||
3303 | 875 | } | ||
3304 | 876 | |||
3305 | 877 | GBool PDFCore::gotoPrevPage(int dec, GBool top, GBool bottom) { | ||
3306 | 878 | int pg, scrollYA; | ||
3307 | 879 | |||
3308 | 880 | if (!doc || doc->getNumPages() == 0 || topPage <= 1) { | ||
3309 | 881 | return gFalse; | ||
3310 | 882 | } | ||
3311 | 883 | if ((pg = topPage - dec) < 1) { | ||
3312 | 884 | pg = 1; | ||
3313 | 885 | } | ||
3314 | 886 | if (continuousMode) { | ||
3315 | 887 | scrollYA = -1; | ||
3316 | 888 | } else if (top) { | ||
3317 | 889 | scrollYA = 0; | ||
3318 | 890 | } else if (bottom) { | ||
3319 | 891 | scrollYA = ((PDFCorePage *)pages->get(0))->h - drawAreaHeight; | ||
3320 | 892 | if (scrollYA < 0) { | ||
3321 | 893 | scrollYA = 0; | ||
3322 | 894 | } | ||
3323 | 895 | } else { | ||
3324 | 896 | scrollYA = scrollY; | ||
3325 | 897 | } | ||
3326 | 898 | update(pg, scrollX, scrollYA, zoom, rotate, gFalse, gTrue); | ||
3327 | 899 | return gTrue; | ||
3328 | 900 | } | ||
3329 | 901 | |||
3330 | 902 | GBool PDFCore::gotoNamedDestination(GString *dest) { | ||
3331 | 903 | LinkDest *d; | ||
3332 | 904 | |||
3333 | 905 | if (!doc) { | ||
3334 | 906 | return gFalse; | ||
3335 | 907 | } | ||
3336 | 908 | if (!(d = doc->findDest(dest))) { | ||
3337 | 909 | return gFalse; | ||
3338 | 910 | } | ||
3339 | 911 | displayDest(d, zoom, rotate, gTrue); | ||
3340 | 912 | delete d; | ||
3341 | 913 | return gTrue; | ||
3342 | 914 | } | ||
3343 | 915 | |||
3344 | 916 | GBool PDFCore::goForward() { | ||
3345 | 917 | int pg; | ||
3346 | 918 | |||
3347 | 919 | if (historyFLen == 0) { | ||
3348 | 920 | return gFalse; | ||
3349 | 921 | } | ||
3350 | 922 | if (++historyCur == pdfHistorySize) { | ||
3351 | 923 | historyCur = 0; | ||
3352 | 924 | } | ||
3353 | 925 | --historyFLen; | ||
3354 | 926 | ++historyBLen; | ||
3355 | 927 | if (!doc || history[historyCur].fileName->cmp(doc->getFileName()) != 0) { | ||
3356 | 928 | if (loadFile(history[historyCur].fileName) != errNone) { | ||
3357 | 929 | return gFalse; | ||
3358 | 930 | } | ||
3359 | 931 | } | ||
3360 | 932 | pg = history[historyCur].page; | ||
3361 | 933 | update(pg, scrollX, continuousMode ? -1 : scrollY, | ||
3362 | 934 | zoom, rotate, gFalse, gFalse); | ||
3363 | 935 | return gTrue; | ||
3364 | 936 | } | ||
3365 | 937 | |||
3366 | 938 | GBool PDFCore::goBackward() { | ||
3367 | 939 | int pg; | ||
3368 | 940 | |||
3369 | 941 | if (historyBLen <= 1) { | ||
3370 | 942 | return gFalse; | ||
3371 | 943 | } | ||
3372 | 944 | if (--historyCur < 0) { | ||
3373 | 945 | historyCur = pdfHistorySize - 1; | ||
3374 | 946 | } | ||
3375 | 947 | --historyBLen; | ||
3376 | 948 | ++historyFLen; | ||
3377 | 949 | if (!doc || history[historyCur].fileName->cmp(doc->getFileName()) != 0) { | ||
3378 | 950 | if (loadFile(history[historyCur].fileName) != errNone) { | ||
3379 | 951 | return gFalse; | ||
3380 | 952 | } | ||
3381 | 953 | } | ||
3382 | 954 | pg = history[historyCur].page; | ||
3383 | 955 | update(pg, scrollX, continuousMode ? -1 : scrollY, | ||
3384 | 956 | zoom, rotate, gFalse, gFalse); | ||
3385 | 957 | return gTrue; | ||
3386 | 958 | } | ||
3387 | 959 | |||
3388 | 960 | void PDFCore::scrollLeft(int nCols) { | ||
3389 | 961 | scrollTo(scrollX - nCols, scrollY); | ||
3390 | 962 | } | ||
3391 | 963 | |||
3392 | 964 | void PDFCore::scrollRight(int nCols) { | ||
3393 | 965 | scrollTo(scrollX + nCols, scrollY); | ||
3394 | 966 | } | ||
3395 | 967 | |||
3396 | 968 | void PDFCore::scrollUp(int nLines) { | ||
3397 | 969 | scrollTo(scrollX, scrollY - nLines); | ||
3398 | 970 | } | ||
3399 | 971 | |||
3400 | 972 | void PDFCore::scrollUpPrevPage(int nLines) { | ||
3401 | 973 | if (!continuousMode && scrollY == 0) { | ||
3402 | 974 | gotoPrevPage(1, gFalse, gTrue); | ||
3403 | 975 | } else { | ||
3404 | 976 | scrollTo(scrollX, scrollY - nLines); | ||
3405 | 977 | } | ||
3406 | 978 | } | ||
3407 | 979 | |||
3408 | 980 | void PDFCore::scrollDown(int nLines) { | ||
3409 | 981 | scrollTo(scrollX, scrollY + nLines); | ||
3410 | 982 | } | ||
3411 | 983 | |||
3412 | 984 | void PDFCore::scrollDownNextPage(int nLines) { | ||
3413 | 985 | if (!continuousMode && | ||
3414 | 986 | scrollY >= ((PDFCorePage *)pages->get(0))->h - drawAreaHeight) { | ||
3415 | 987 | gotoNextPage(1, gTrue); | ||
3416 | 988 | } else { | ||
3417 | 989 | scrollTo(scrollX, scrollY + nLines); | ||
3418 | 990 | } | ||
3419 | 991 | } | ||
3420 | 992 | |||
3421 | 993 | void PDFCore::scrollPageUp() { | ||
3422 | 994 | if (!continuousMode && scrollY == 0) { | ||
3423 | 995 | gotoPrevPage(1, gFalse, gTrue); | ||
3424 | 996 | } else { | ||
3425 | 997 | scrollTo(scrollX, scrollY - drawAreaHeight); | ||
3426 | 998 | } | ||
3427 | 999 | } | ||
3428 | 1000 | |||
3429 | 1001 | void PDFCore::scrollPageDown() { | ||
3430 | 1002 | if (!continuousMode && | ||
3431 | 1003 | scrollY >= ((PDFCorePage *)pages->get(0))->h - drawAreaHeight) { | ||
3432 | 1004 | gotoNextPage(1, gTrue); | ||
3433 | 1005 | } else { | ||
3434 | 1006 | scrollTo(scrollX, scrollY + drawAreaHeight); | ||
3435 | 1007 | } | ||
3436 | 1008 | } | ||
3437 | 1009 | |||
3438 | 1010 | void PDFCore::scrollTo(int x, int y) { | ||
3439 | 1011 | update(topPage, x, y < 0 ? 0 : y, zoom, rotate, gFalse, gFalse); | ||
3440 | 1012 | } | ||
3441 | 1013 | |||
3442 | 1014 | void PDFCore::scrollToLeftEdge() { | ||
3443 | 1015 | update(topPage, 0, scrollY, zoom, rotate, gFalse, gFalse); | ||
3444 | 1016 | } | ||
3445 | 1017 | |||
3446 | 1018 | void PDFCore::scrollToRightEdge() { | ||
3447 | 1019 | PDFCorePage *page; | ||
3448 | 1020 | |||
3449 | 1021 | page = (PDFCorePage *)pages->get(0); | ||
3450 | 1022 | update(topPage, page->w - drawAreaWidth, scrollY, | ||
3451 | 1023 | zoom, rotate, gFalse, gFalse); | ||
3452 | 1024 | } | ||
3453 | 1025 | |||
3454 | 1026 | void PDFCore::scrollToTopEdge() { | ||
3455 | 1027 | int y; | ||
3456 | 1028 | |||
3457 | 1029 | y = continuousMode ? pageY[topPage - 1] : 0; | ||
3458 | 1030 | update(topPage, scrollX, y, zoom, rotate, gFalse, gFalse); | ||
3459 | 1031 | } | ||
3460 | 1032 | |||
3461 | 1033 | void PDFCore::scrollToBottomEdge() { | ||
3462 | 1034 | PDFCorePage *page; | ||
3463 | 1035 | int y, i; | ||
3464 | 1036 | |||
3465 | 1037 | for (i = pages->getLength() - 1; i > 0; --i) { | ||
3466 | 1038 | page = (PDFCorePage *)pages->get(i); | ||
3467 | 1039 | if (page->yDest < drawAreaHeight) { | ||
3468 | 1040 | break; | ||
3469 | 1041 | } | ||
3470 | 1042 | } | ||
3471 | 1043 | page = (PDFCorePage *)pages->get(i); | ||
3472 | 1044 | if (continuousMode) { | ||
3473 | 1045 | y = pageY[page->page - 1] + page->h - drawAreaHeight; | ||
3474 | 1046 | } else { | ||
3475 | 1047 | y = page->h - drawAreaHeight; | ||
3476 | 1048 | } | ||
3477 | 1049 | update(topPage, scrollX, y, zoom, rotate, gFalse, gFalse); | ||
3478 | 1050 | } | ||
3479 | 1051 | |||
3480 | 1052 | void PDFCore::scrollToTopLeft() { | ||
3481 | 1053 | int y; | ||
3482 | 1054 | |||
3483 | 1055 | y = continuousMode ? pageY[topPage - 1] : 0; | ||
3484 | 1056 | update(topPage, 0, y, zoom, rotate, gFalse, gFalse); | ||
3485 | 1057 | } | ||
3486 | 1058 | |||
3487 | 1059 | void PDFCore::scrollToBottomRight() { | ||
3488 | 1060 | PDFCorePage *page; | ||
3489 | 1061 | int x, y, i; | ||
3490 | 1062 | |||
3491 | 1063 | for (i = pages->getLength() - 1; i > 0; --i) { | ||
3492 | 1064 | page = (PDFCorePage *)pages->get(i); | ||
3493 | 1065 | if (page->yDest < drawAreaHeight) { | ||
3494 | 1066 | break; | ||
3495 | 1067 | } | ||
3496 | 1068 | } | ||
3497 | 1069 | page = (PDFCorePage *)pages->get(i); | ||
3498 | 1070 | x = page->w - drawAreaWidth; | ||
3499 | 1071 | if (continuousMode) { | ||
3500 | 1072 | y = pageY[page->page - 1] + page->h - drawAreaHeight; | ||
3501 | 1073 | } else { | ||
3502 | 1074 | y = page->h - drawAreaHeight; | ||
3503 | 1075 | } | ||
3504 | 1076 | update(topPage, x, y, zoom, rotate, gFalse, gFalse); | ||
3505 | 1077 | } | ||
3506 | 1078 | |||
3507 | 1079 | void PDFCore::zoomToRect(int pg, double ulx, double uly, | ||
3508 | 1080 | double lrx, double lry) { | ||
3509 | 1081 | int x0, y0, x1, y1, u, sx, sy; | ||
3510 | 1082 | double rx, ry, newZoom, t; | ||
3511 | 1083 | PDFCorePage *p; | ||
3512 | 1084 | |||
3513 | 1085 | cvtUserToDev(pg, ulx, uly, &x0, &y0); | ||
3514 | 1086 | cvtUserToDev(pg, lrx, lry, &x1, &y1); | ||
3515 | 1087 | if (x0 > x1) { | ||
3516 | 1088 | u = x0; x0 = x1; x1 = u; | ||
3517 | 1089 | } | ||
3518 | 1090 | if (y0 > y1) { | ||
3519 | 1091 | u = y0; y0 = y1; y1 = u; | ||
3520 | 1092 | } | ||
3521 | 1093 | rx = (double)drawAreaWidth / (double)(x1 - x0); | ||
3522 | 1094 | ry = (double)drawAreaHeight / (double)(y1 - y0); | ||
3523 | 1095 | if (rx < ry) { | ||
3524 | 1096 | newZoom = rx * (dpi / (0.01 * 72)); | ||
3525 | 1097 | sx = (int)(rx * x0); | ||
3526 | 1098 | t = (drawAreaHeight * (x1 - x0)) / drawAreaWidth; | ||
3527 | 1099 | sy = (int)(rx * (y0 + y1 - t) / 2); | ||
3528 | 1100 | if (continuousMode) { | ||
3529 | 1101 | if ((p = findPage(pg)) && p->w < maxPageW) { | ||
3530 | 1102 | sx += (int)(0.5 * rx * (maxPageW - p->w)); | ||
3531 | 1103 | } | ||
3532 | 1104 | u = (pg - 1) * continuousModePageSpacing; | ||
3533 | 1105 | sy += (int)(rx * (pageY[pg - 1] - u)) + u; | ||
3534 | 1106 | } | ||
3535 | 1107 | } else { | ||
3536 | 1108 | newZoom = ry * (dpi / (0.01 * 72)); | ||
3537 | 1109 | t = (drawAreaWidth * (y1 - y0)) / drawAreaHeight; | ||
3538 | 1110 | sx = (int)(ry * (x0 + x1 - t) / 2); | ||
3539 | 1111 | sy = (int)(ry * y0); | ||
3540 | 1112 | if (continuousMode) { | ||
3541 | 1113 | if ((p = findPage(pg)) && p->w < maxPageW) { | ||
3542 | 1114 | sx += (int)(0.5 * rx * (maxPageW - p->w)); | ||
3543 | 1115 | } | ||
3544 | 1116 | u = (pg - 1) * continuousModePageSpacing; | ||
3545 | 1117 | sy += (int)(ry * (pageY[pg - 1] - u)) + u; | ||
3546 | 1118 | } | ||
3547 | 1119 | } | ||
3548 | 1120 | update(pg, sx, sy, newZoom, rotate, gFalse, gFalse); | ||
3549 | 1121 | } | ||
3550 | 1122 | |||
3551 | 1123 | void PDFCore::zoomCentered(double zoomA) { | ||
3552 | 1124 | int sx, sy, rot, hAdjust, vAdjust, i; | ||
3553 | 1125 | double dpi1, dpi2, pageW, pageH; | ||
3554 | 1126 | PDFCorePage *page; | ||
3555 | 1127 | |||
3556 | 1128 | if (zoomA == zoomPage) { | ||
3557 | 1129 | if (continuousMode) { | ||
3558 | 1130 | pageW = (rotate == 90 || rotate == 270) ? maxUnscaledPageH | ||
3559 | 1131 | : maxUnscaledPageW; | ||
3560 | 1132 | pageH = (rotate == 90 || rotate == 270) ? maxUnscaledPageW | ||
3561 | 1133 | : maxUnscaledPageH; | ||
3562 | 1134 | dpi1 = 72.0 * (double)drawAreaWidth / pageW; | ||
3563 | 1135 | dpi2 = 72.0 * (double)(drawAreaHeight - continuousModePageSpacing) / | ||
3564 | 1136 | pageH; | ||
3565 | 1137 | if (dpi2 < dpi1) { | ||
3566 | 1138 | dpi1 = dpi2; | ||
3567 | 1139 | } | ||
3568 | 1140 | } else { | ||
3569 | 1141 | // in single-page mode, sx=sy=0 -- so dpi1 is irrelevant | ||
3570 | 1142 | dpi1 = dpi; | ||
3571 | 1143 | } | ||
3572 | 1144 | sx = 0; | ||
3573 | 1145 | |||
3574 | 1146 | } else if (zoomA == zoomWidth) { | ||
3575 | 1147 | if (continuousMode) { | ||
3576 | 1148 | pageW = (rotate == 90 || rotate == 270) ? maxUnscaledPageH | ||
3577 | 1149 | : maxUnscaledPageW; | ||
3578 | 1150 | } else { | ||
3579 | 1151 | rot = rotate + doc->getPageRotate(topPage); | ||
3580 | 1152 | if (rot >= 360) { | ||
3581 | 1153 | rot -= 360; | ||
3582 | 1154 | } else if (rot < 0) { | ||
3583 | 1155 | rot += 360; | ||
3584 | 1156 | } | ||
3585 | 1157 | pageW = (rot == 90 || rot == 270) ? doc->getPageCropHeight(topPage) | ||
3586 | 1158 | : doc->getPageCropWidth(topPage); | ||
3587 | 1159 | } | ||
3588 | 1160 | dpi1 = 72.0 * (double)drawAreaWidth / pageW; | ||
3589 | 1161 | sx = 0; | ||
3590 | 1162 | |||
3591 | 1163 | } else if (zoomA <= 0) { | ||
3592 | 1164 | return; | ||
3593 | 1165 | |||
3594 | 1166 | } else { | ||
3595 | 1167 | dpi1 = 72.0 * zoomA / 100.0; | ||
3596 | 1168 | if ((page = (PDFCorePage *)pages->get(0)) && page->xDest > 0) { | ||
3597 | 1169 | hAdjust = page->xDest; | ||
3598 | 1170 | } else { | ||
3599 | 1171 | hAdjust = 0; | ||
3600 | 1172 | } | ||
3601 | 1173 | sx = (int)((scrollX - hAdjust + drawAreaWidth / 2) * (dpi1 / dpi)) - | ||
3602 | 1174 | drawAreaWidth / 2; | ||
3603 | 1175 | if (sx < 0) { | ||
3604 | 1176 | sx = 0; | ||
3605 | 1177 | } | ||
3606 | 1178 | } | ||
3607 | 1179 | |||
3608 | 1180 | if (continuousMode) { | ||
3609 | 1181 | // we can't just multiply scrollY by dpi1/dpi -- the rounding | ||
3610 | 1182 | // errors add up (because the pageY values are integers) -- so | ||
3611 | 1183 | // we compute the pageY values at the new zoom level instead | ||
3612 | 1184 | sy = 0; | ||
3613 | 1185 | for (i = 1; i < topPage; ++i) { | ||
3614 | 1186 | rot = rotate + doc->getPageRotate(i); | ||
3615 | 1187 | if (rot >= 360) { | ||
3616 | 1188 | rot -= 360; | ||
3617 | 1189 | } else if (rot < 0) { | ||
3618 | 1190 | rot += 360; | ||
3619 | 1191 | } | ||
3620 | 1192 | if (rot == 90 || rot == 270) { | ||
3621 | 1193 | sy += (int)((doc->getPageCropWidth(i) * dpi1) / 72 + 0.5); | ||
3622 | 1194 | } else { | ||
3623 | 1195 | sy += (int)((doc->getPageCropHeight(i) * dpi1) / 72 + 0.5); | ||
3624 | 1196 | } | ||
3625 | 1197 | } | ||
3626 | 1198 | vAdjust = (topPage - 1) * continuousModePageSpacing; | ||
3627 | 1199 | sy = sy + (int)((scrollY - pageY[topPage - 1] + drawAreaHeight / 2) | ||
3628 | 1200 | * (dpi1 / dpi)) | ||
3629 | 1201 | + vAdjust - drawAreaHeight / 2; | ||
3630 | 1202 | } else { | ||
3631 | 1203 | sy = (int)((scrollY + drawAreaHeight / 2) * (dpi1 / dpi)) | ||
3632 | 1204 | - drawAreaHeight / 2; | ||
3633 | 1205 | } | ||
3634 | 1206 | |||
3635 | 1207 | update(topPage, sx, sy, zoomA, rotate, gFalse, gFalse); | ||
3636 | 1208 | } | ||
3637 | 1209 | |||
3638 | 1210 | // Zoom so that the current page(s) fill the window width. Maintain | ||
3639 | 1211 | // the vertical center. | ||
3640 | 1212 | void PDFCore::zoomToCurrentWidth() { | ||
3641 | 1213 | double w, maxW, dpi1; | ||
3642 | 1214 | int sx, sy, vAdjust, rot, i; | ||
3643 | 1215 | |||
3644 | 1216 | // compute the maximum page width of visible pages | ||
3645 | 1217 | rot = rotate + doc->getPageRotate(topPage); | ||
3646 | 1218 | if (rot >= 360) { | ||
3647 | 1219 | rot -= 360; | ||
3648 | 1220 | } else if (rot < 0) { | ||
3649 | 1221 | rot += 360; | ||
3650 | 1222 | } | ||
3651 | 1223 | if (rot == 90 || rot == 270) { | ||
3652 | 1224 | maxW = doc->getPageCropHeight(topPage); | ||
3653 | 1225 | } else { | ||
3654 | 1226 | maxW = doc->getPageCropWidth(topPage); | ||
3655 | 1227 | } | ||
3656 | 1228 | if (continuousMode) { | ||
3657 | 1229 | for (i = topPage + 1; | ||
3658 | 1230 | i < doc->getNumPages() && pageY[i-1] < scrollY + drawAreaHeight; | ||
3659 | 1231 | ++i) { | ||
3660 | 1232 | rot = rotate + doc->getPageRotate(i); | ||
3661 | 1233 | if (rot >= 360) { | ||
3662 | 1234 | rot -= 360; | ||
3663 | 1235 | } else if (rot < 0) { | ||
3664 | 1236 | rot += 360; | ||
3665 | 1237 | } | ||
3666 | 1238 | if (rot == 90 || rot == 270) { | ||
3667 | 1239 | w = doc->getPageCropHeight(i); | ||
3668 | 1240 | } else { | ||
3669 | 1241 | w = doc->getPageCropWidth(i); | ||
3670 | 1242 | } | ||
3671 | 1243 | if (w > maxW) { | ||
3672 | 1244 | maxW = w; | ||
3673 | 1245 | } | ||
3674 | 1246 | } | ||
3675 | 1247 | } | ||
3676 | 1248 | |||
3677 | 1249 | // compute the resolution | ||
3678 | 1250 | dpi1 = (drawAreaWidth / maxW) * 72; | ||
3679 | 1251 | |||
3680 | 1252 | // compute the horizontal scroll position | ||
3681 | 1253 | if (continuousMode) { | ||
3682 | 1254 | sx = ((int)(maxPageW * dpi1 / dpi) - drawAreaWidth) / 2; | ||
3683 | 1255 | } else { | ||
3684 | 1256 | sx = 0; | ||
3685 | 1257 | } | ||
3686 | 1258 | |||
3687 | 1259 | // compute the vertical scroll position | ||
3688 | 1260 | if (continuousMode) { | ||
3689 | 1261 | // we can't just multiply scrollY by dpi1/dpi -- the rounding | ||
3690 | 1262 | // errors add up (because the pageY values are integers) -- so | ||
3691 | 1263 | // we compute the pageY values at the new zoom level instead | ||
3692 | 1264 | sy = 0; | ||
3693 | 1265 | for (i = 1; i < topPage; ++i) { | ||
3694 | 1266 | rot = rotate + doc->getPageRotate(i); | ||
3695 | 1267 | if (rot >= 360) { | ||
3696 | 1268 | rot -= 360; | ||
3697 | 1269 | } else if (rot < 0) { | ||
3698 | 1270 | rot += 360; | ||
3699 | 1271 | } | ||
3700 | 1272 | if (rot == 90 || rot == 270) { | ||
3701 | 1273 | sy += (int)((doc->getPageCropWidth(i) * dpi1) / 72 + 0.5); | ||
3702 | 1274 | } else { | ||
3703 | 1275 | sy += (int)((doc->getPageCropHeight(i) * dpi1) / 72 + 0.5); | ||
3704 | 1276 | } | ||
3705 | 1277 | } | ||
3706 | 1278 | vAdjust = (topPage - 1) * continuousModePageSpacing; | ||
3707 | 1279 | sy = sy + (int)((scrollY - pageY[topPage - 1] + drawAreaHeight / 2) | ||
3708 | 1280 | * (dpi1 / dpi)) | ||
3709 | 1281 | + vAdjust - drawAreaHeight / 2; | ||
3710 | 1282 | } else { | ||
3711 | 1283 | sy = (int)((scrollY + drawAreaHeight / 2) * (dpi1 / dpi)) | ||
3712 | 1284 | - drawAreaHeight / 2; | ||
3713 | 1285 | } | ||
3714 | 1286 | |||
3715 | 1287 | update(topPage, sx, sy, (dpi1 * 100) / 72, rotate, gFalse, gFalse); | ||
3716 | 1288 | } | ||
3717 | 1289 | |||
3718 | 1290 | void PDFCore::setContinuousMode(GBool cm) { | ||
3719 | 1291 | if (continuousMode != cm) { | ||
3720 | 1292 | continuousMode = cm; | ||
3721 | 1293 | update(topPage, scrollX, -1, zoom, rotate, gTrue, gFalse); | ||
3722 | 1294 | } | ||
3723 | 1295 | } | ||
3724 | 1296 | |||
3725 | 1297 | void PDFCore::setSelection(int newSelectPage, | ||
3726 | 1298 | int newSelectULX, int newSelectULY, | ||
3727 | 1299 | int newSelectLRX, int newSelectLRY) { | ||
3728 | 1300 | int x0, y0, x1, y1, py; | ||
3729 | 1301 | GBool haveSel, newHaveSel; | ||
3730 | 1302 | GBool needRedraw, needScroll; | ||
3731 | 1303 | GBool moveLeft, moveRight, moveTop, moveBottom; | ||
3732 | 1304 | SplashColor xorColor; | ||
3733 | 1305 | PDFCorePage *page; | ||
3734 | 1306 | |||
3735 | 1307 | |||
3736 | 1308 | haveSel = selectULX != selectLRX && selectULY != selectLRY; | ||
3737 | 1309 | newHaveSel = newSelectULX != newSelectLRX && newSelectULY != newSelectLRY; | ||
3738 | 1310 | |||
3739 | 1311 | // erase old selection on off-screen bitmap | ||
3740 | 1312 | needRedraw = gFalse; | ||
3741 | 1313 | if (haveSel) { | ||
3742 | 1314 | xorColor[0] = xorColor[1] = xorColor[2] = 0xff; | ||
3743 | 1315 | xorRectangle(selectPage, selectULX, selectULY, selectLRX, selectLRY, | ||
3744 | 1316 | new SplashSolidColor(xorColor)); | ||
3745 | 1317 | needRedraw = gTrue; | ||
3746 | 1318 | } | ||
3747 | 1319 | |||
3748 | 1320 | // draw new selection on off-screen bitmap | ||
3749 | 1321 | if (newHaveSel) { | ||
3750 | 1322 | xorColor[0] = xorColor[1] = xorColor[2] = 0xff; | ||
3751 | 1323 | xorRectangle(newSelectPage, newSelectULX, newSelectULY, | ||
3752 | 1324 | newSelectLRX, newSelectLRY, | ||
3753 | 1325 | new SplashSolidColor(xorColor)); | ||
3754 | 1326 | needRedraw = gTrue; | ||
3755 | 1327 | } | ||
3756 | 1328 | |||
3757 | 1329 | // check which edges moved | ||
3758 | 1330 | if (!haveSel || newSelectPage != selectPage) { | ||
3759 | 1331 | moveLeft = moveTop = moveRight = moveBottom = gTrue; | ||
3760 | 1332 | } else { | ||
3761 | 1333 | moveLeft = newSelectULX != selectULX; | ||
3762 | 1334 | moveTop = newSelectULY != selectULY; | ||
3763 | 1335 | moveRight = newSelectLRX != selectLRX; | ||
3764 | 1336 | moveBottom = newSelectLRY != selectLRY; | ||
3765 | 1337 | } | ||
3766 | 1338 | |||
3767 | 1339 | // redraw currently visible part of bitmap | ||
3768 | 1340 | if (needRedraw) { | ||
3769 | 1341 | if (!haveSel) { | ||
3770 | 1342 | page = findPage(newSelectPage); | ||
3771 | 1343 | x0 = newSelectULX; | ||
3772 | 1344 | y0 = newSelectULY; | ||
3773 | 1345 | x1 = newSelectLRX; | ||
3774 | 1346 | y1 = newSelectLRY; | ||
3775 | 1347 | redrawWindow(page->xDest + x0, page->yDest + y0, | ||
3776 | 1348 | x1 - x0 + 1, y1 - y0 + 1, gFalse); | ||
3777 | 1349 | } else if (!newHaveSel) { | ||
3778 | 1350 | if ((page = findPage(selectPage))) { | ||
3779 | 1351 | x0 = selectULX; | ||
3780 | 1352 | y0 = selectULY; | ||
3781 | 1353 | x1 = selectLRX; | ||
3782 | 1354 | y1 = selectLRY; | ||
3783 | 1355 | redrawWindow(page->xDest + x0, page->yDest + y0, | ||
3784 | 1356 | x1 - x0 + 1, y1 - y0 + 1, gFalse); | ||
3785 | 1357 | } | ||
3786 | 1358 | } else { | ||
3787 | 1359 | page = findPage(newSelectPage); | ||
3788 | 1360 | if (moveLeft) { | ||
3789 | 1361 | x0 = newSelectULX < selectULX ? newSelectULX : selectULX; | ||
3790 | 1362 | y0 = newSelectULY < selectULY ? newSelectULY : selectULY; | ||
3791 | 1363 | x1 = newSelectULX > selectULX ? newSelectULX : selectULX; | ||
3792 | 1364 | y1 = newSelectLRY > selectLRY ? newSelectLRY : selectLRY; | ||
3793 | 1365 | redrawWindow(page->xDest + x0, page->yDest + y0, | ||
3794 | 1366 | x1 - x0 + 1, y1 - y0 + 1, gFalse); | ||
3795 | 1367 | } | ||
3796 | 1368 | if (moveRight) { | ||
3797 | 1369 | x0 = newSelectLRX < selectLRX ? newSelectLRX : selectLRX; | ||
3798 | 1370 | y0 = newSelectULY < selectULY ? newSelectULY : selectULY; | ||
3799 | 1371 | x1 = newSelectLRX > selectLRX ? newSelectLRX : selectLRX; | ||
3800 | 1372 | y1 = newSelectLRY > selectLRY ? newSelectLRY : selectLRY; | ||
3801 | 1373 | redrawWindow(page->xDest + x0, page->yDest + y0, | ||
3802 | 1374 | x1 - x0 + 1, y1 - y0 + 1, gFalse); | ||
3803 | 1375 | } | ||
3804 | 1376 | if (moveTop) { | ||
3805 | 1377 | x0 = newSelectULX < selectULX ? newSelectULX : selectULX; | ||
3806 | 1378 | y0 = newSelectULY < selectULY ? newSelectULY : selectULY; | ||
3807 | 1379 | x1 = newSelectLRX > selectLRX ? newSelectLRX : selectLRX; | ||
3808 | 1380 | y1 = newSelectULY > selectULY ? newSelectULY : selectULY; | ||
3809 | 1381 | redrawWindow(page->xDest + x0, page->yDest + y0, | ||
3810 | 1382 | x1 - x0 + 1, y1 - y0 + 1, gFalse); | ||
3811 | 1383 | } | ||
3812 | 1384 | if (moveBottom) { | ||
3813 | 1385 | x0 = newSelectULX < selectULX ? newSelectULX : selectULX; | ||
3814 | 1386 | y0 = newSelectLRY < selectLRY ? newSelectLRY : selectLRY; | ||
3815 | 1387 | x1 = newSelectLRX > selectLRX ? newSelectLRX : selectLRX; | ||
3816 | 1388 | y1 = newSelectLRY > selectLRY ? newSelectLRY : selectLRY; | ||
3817 | 1389 | redrawWindow(page->xDest + x0, page->yDest + y0, | ||
3818 | 1390 | x1 - x0 + 1, y1 - y0 + 1, gFalse); | ||
3819 | 1391 | } | ||
3820 | 1392 | } | ||
3821 | 1393 | } | ||
3822 | 1394 | |||
3823 | 1395 | // switch to new selection coords | ||
3824 | 1396 | selectPage = newSelectPage; | ||
3825 | 1397 | selectULX = newSelectULX; | ||
3826 | 1398 | selectULY = newSelectULY; | ||
3827 | 1399 | selectLRX = newSelectLRX; | ||
3828 | 1400 | selectLRY = newSelectLRY; | ||
3829 | 1401 | |||
3830 | 1402 | // scroll if necessary | ||
3831 | 1403 | if (newHaveSel) { | ||
3832 | 1404 | page = findPage(selectPage); | ||
3833 | 1405 | needScroll = gFalse; | ||
3834 | 1406 | x0 = scrollX; | ||
3835 | 1407 | y0 = scrollY; | ||
3836 | 1408 | if (moveLeft && page->xDest + selectULX < 0) { | ||
3837 | 1409 | x0 += page->xDest + selectULX; | ||
3838 | 1410 | needScroll = gTrue; | ||
3839 | 1411 | } else if (moveRight && page->xDest + selectLRX >= drawAreaWidth) { | ||
3840 | 1412 | x0 += page->xDest + selectLRX - drawAreaWidth; | ||
3841 | 1413 | needScroll = gTrue; | ||
3842 | 1414 | } else if (moveLeft && page->xDest + selectULX >= drawAreaWidth) { | ||
3843 | 1415 | x0 += page->xDest + selectULX - drawAreaWidth; | ||
3844 | 1416 | needScroll = gTrue; | ||
3845 | 1417 | } else if (moveRight && page->xDest + selectLRX < 0) { | ||
3846 | 1418 | x0 += page->xDest + selectLRX; | ||
3847 | 1419 | needScroll = gTrue; | ||
3848 | 1420 | } | ||
3849 | 1421 | py = continuousMode ? pageY[selectPage - 1] : 0; | ||
3850 | 1422 | if (moveTop && py + selectULY < y0) { | ||
3851 | 1423 | y0 = py + selectULY; | ||
3852 | 1424 | needScroll = gTrue; | ||
3853 | 1425 | } else if (moveBottom && py + selectLRY >= y0 + drawAreaHeight) { | ||
3854 | 1426 | y0 = py + selectLRY - drawAreaHeight; | ||
3855 | 1427 | needScroll = gTrue; | ||
3856 | 1428 | } else if (moveTop && py + selectULY >= y0 + drawAreaHeight) { | ||
3857 | 1429 | y0 = py + selectULY - drawAreaHeight; | ||
3858 | 1430 | needScroll = gTrue; | ||
3859 | 1431 | } else if (moveBottom && py + selectLRY < y0) { | ||
3860 | 1432 | y0 = py + selectLRY; | ||
3861 | 1433 | needScroll = gTrue; | ||
3862 | 1434 | } | ||
3863 | 1435 | if (needScroll) { | ||
3864 | 1436 | scrollTo(x0, y0); | ||
3865 | 1437 | } | ||
3866 | 1438 | } | ||
3867 | 1439 | } | ||
3868 | 1440 | |||
3869 | 1441 | void PDFCore::moveSelection(int pg, int x, int y) { | ||
3870 | 1442 | int newSelectULX, newSelectULY, newSelectLRX, newSelectLRY; | ||
3871 | 1443 | |||
3872 | 1444 | // don't allow selections to span multiple pages | ||
3873 | 1445 | if (pg != selectPage) { | ||
3874 | 1446 | return; | ||
3875 | 1447 | } | ||
3876 | 1448 | |||
3877 | 1449 | // move appropriate edges of selection | ||
3878 | 1450 | if (lastDragLeft) { | ||
3879 | 1451 | if (x < selectLRX) { | ||
3880 | 1452 | newSelectULX = x; | ||
3881 | 1453 | newSelectLRX = selectLRX; | ||
3882 | 1454 | } else { | ||
3883 | 1455 | newSelectULX = selectLRX; | ||
3884 | 1456 | newSelectLRX = x; | ||
3885 | 1457 | lastDragLeft = gFalse; | ||
3886 | 1458 | } | ||
3887 | 1459 | } else { | ||
3888 | 1460 | if (x > selectULX) { | ||
3889 | 1461 | newSelectULX = selectULX; | ||
3890 | 1462 | newSelectLRX = x; | ||
3891 | 1463 | } else { | ||
3892 | 1464 | newSelectULX = x; | ||
3893 | 1465 | newSelectLRX = selectULX; | ||
3894 | 1466 | lastDragLeft = gTrue; | ||
3895 | 1467 | } | ||
3896 | 1468 | } | ||
3897 | 1469 | if (lastDragTop) { | ||
3898 | 1470 | if (y < selectLRY) { | ||
3899 | 1471 | newSelectULY = y; | ||
3900 | 1472 | newSelectLRY = selectLRY; | ||
3901 | 1473 | } else { | ||
3902 | 1474 | newSelectULY = selectLRY; | ||
3903 | 1475 | newSelectLRY = y; | ||
3904 | 1476 | lastDragTop = gFalse; | ||
3905 | 1477 | } | ||
3906 | 1478 | } else { | ||
3907 | 1479 | if (y > selectULY) { | ||
3908 | 1480 | newSelectULY = selectULY; | ||
3909 | 1481 | newSelectLRY = y; | ||
3910 | 1482 | } else { | ||
3911 | 1483 | newSelectULY = y; | ||
3912 | 1484 | newSelectLRY = selectULY; | ||
3913 | 1485 | lastDragTop = gTrue; | ||
3914 | 1486 | } | ||
3915 | 1487 | } | ||
3916 | 1488 | |||
3917 | 1489 | // redraw the selection | ||
3918 | 1490 | setSelection(selectPage, newSelectULX, newSelectULY, | ||
3919 | 1491 | newSelectLRX, newSelectLRY); | ||
3920 | 1492 | } | ||
3921 | 1493 | |||
3922 | 1494 | void PDFCore::xorRectangle(int pg, int x0, int y0, int x1, int y1, | ||
3923 | 1495 | SplashPattern *pattern, PDFCoreTile *oneTile) { | ||
3924 | 1496 | Splash *splash; | ||
3925 | 1497 | SplashPath *path; | ||
3926 | 1498 | PDFCorePage *page; | ||
3927 | 1499 | PDFCoreTile *tile; | ||
3928 | 1500 | SplashCoord xx0, yy0, xx1, yy1; | ||
3929 | 1501 | int xi, yi, wi, hi; | ||
3930 | 1502 | int i; | ||
3931 | 1503 | |||
3932 | 1504 | if ((page = findPage(pg))) { | ||
3933 | 1505 | for (i = 0; i < page->tiles->getLength(); ++i) { | ||
3934 | 1506 | tile = (PDFCoreTile *)page->tiles->get(i); | ||
3935 | 1507 | if (!oneTile || tile == oneTile) { | ||
3936 | 1508 | splash = new Splash(tile->bitmap, gFalse); | ||
3937 | 1509 | splash->setFillPattern(pattern->copy()); | ||
3938 | 1510 | xx0 = (SplashCoord)(x0 - tile->xMin); | ||
3939 | 1511 | yy0 = (SplashCoord)(y0 - tile->yMin); | ||
3940 | 1512 | xx1 = (SplashCoord)(x1 - tile->xMin); | ||
3941 | 1513 | yy1 = (SplashCoord)(y1 - tile->yMin); | ||
3942 | 1514 | path = new SplashPath(); | ||
3943 | 1515 | path->moveTo(xx0, yy0); | ||
3944 | 1516 | path->lineTo(xx1, yy0); | ||
3945 | 1517 | path->lineTo(xx1, yy1); | ||
3946 | 1518 | path->lineTo(xx0, yy1); | ||
3947 | 1519 | path->close(); | ||
3948 | 1520 | splash->xorFill(path, gTrue); | ||
3949 | 1521 | delete path; | ||
3950 | 1522 | delete splash; | ||
3951 | 1523 | xi = x0 - tile->xMin; | ||
3952 | 1524 | wi = x1 - x0; | ||
3953 | 1525 | if (xi < 0) { | ||
3954 | 1526 | wi += xi; | ||
3955 | 1527 | xi = 0; | ||
3956 | 1528 | } | ||
3957 | 1529 | if (xi + wi > tile->bitmap->getWidth()) { | ||
3958 | 1530 | wi = tile->bitmap->getWidth() - xi; | ||
3959 | 1531 | } | ||
3960 | 1532 | yi = y0 - tile->yMin; | ||
3961 | 1533 | hi = y1 - y0; | ||
3962 | 1534 | if (yi < 0) { | ||
3963 | 1535 | hi += yi; | ||
3964 | 1536 | yi = 0; | ||
3965 | 1537 | } | ||
3966 | 1538 | if (yi + hi > tile->bitmap->getHeight()) { | ||
3967 | 1539 | hi = tile->bitmap->getHeight() - yi; | ||
3968 | 1540 | } | ||
3969 | 1541 | updateTileData(tile, xi, yi, wi, hi, gTrue); | ||
3970 | 1542 | } | ||
3971 | 1543 | } | ||
3972 | 1544 | } | ||
3973 | 1545 | delete pattern; | ||
3974 | 1546 | } | ||
3975 | 1547 | |||
3976 | 1548 | GBool PDFCore::getSelection(int *pg, double *ulx, double *uly, | ||
3977 | 1549 | double *lrx, double *lry) { | ||
3978 | 1550 | if (selectULX == selectLRX || selectULY == selectLRY) { | ||
3979 | 1551 | return gFalse; | ||
3980 | 1552 | } | ||
3981 | 1553 | *pg = selectPage; | ||
3982 | 1554 | cvtDevToUser(selectPage, selectULX, selectULY, ulx, uly); | ||
3983 | 1555 | cvtDevToUser(selectPage, selectLRX, selectLRY, lrx, lry); | ||
3984 | 1556 | return gTrue; | ||
3985 | 1557 | } | ||
3986 | 1558 | |||
3987 | 1559 | GString *PDFCore::extractText(int pg, double xMin, double yMin, | ||
3988 | 1560 | double xMax, double yMax) { | ||
3989 | 1561 | PDFCorePage *page; | ||
3990 | 1562 | TextOutputDev *textOut; | ||
3991 | 1563 | int x0, y0, x1, y1, t; | ||
3992 | 1564 | GString *s; | ||
3993 | 1565 | |||
3994 | 1566 | if (!doc->okToCopy()) { | ||
3995 | 1567 | return NULL; | ||
3996 | 1568 | } | ||
3997 | 1569 | if ((page = findPage(pg))) { | ||
3998 | 1570 | cvtUserToDev(pg, xMin, yMin, &x0, &y0); | ||
3999 | 1571 | cvtUserToDev(pg, xMax, yMax, &x1, &y1); | ||
4000 | 1572 | if (x0 > x1) { | ||
4001 | 1573 | t = x0; x0 = x1; x1 = t; | ||
4002 | 1574 | } | ||
4003 | 1575 | if (y0 > y1) { | ||
4004 | 1576 | t = y0; y0 = y1; y1 = t; | ||
4005 | 1577 | } | ||
4006 | 1578 | s = page->text->getText(x0, y0, x1, y1); | ||
4007 | 1579 | } else { | ||
4008 | 1580 | textOut = new TextOutputDev(NULL, gTrue, gFalse, gFalse); | ||
4009 | 1581 | if (textOut->isOk()) { | ||
4010 | 1582 | doc->displayPage(textOut, pg, dpi, dpi, rotate, gFalse, gTrue, gFalse); | ||
4011 | 1583 | textOut->cvtUserToDev(xMin, yMin, &x0, &y0); | ||
4012 | 1584 | textOut->cvtUserToDev(xMax, yMax, &x1, &y1); | ||
4013 | 1585 | if (x0 > x1) { | ||
4014 | 1586 | t = x0; x0 = x1; x1 = t; | ||
4015 | 1587 | } | ||
4016 | 1588 | if (y0 > y1) { | ||
4017 | 1589 | t = y0; y0 = y1; y1 = t; | ||
4018 | 1590 | } | ||
4019 | 1591 | s = textOut->getText(x0, y0, x1, y1); | ||
4020 | 1592 | } else { | ||
4021 | 1593 | s = new GString(); | ||
4022 | 1594 | } | ||
4023 | 1595 | delete textOut; | ||
4024 | 1596 | } | ||
4025 | 1597 | return s; | ||
4026 | 1598 | } | ||
4027 | 1599 | |||
4028 | 1600 | GBool PDFCore::find(char *s, GBool caseSensitive, GBool next, GBool backward, | ||
4029 | 1601 | GBool onePageOnly) { | ||
4030 | 1602 | Unicode *u; | ||
4031 | 1603 | int len, i; | ||
4032 | 1604 | GBool ret; | ||
4033 | 1605 | |||
4034 | 1606 | // convert to Unicode | ||
4035 | 1607 | len = strlen(s); | ||
4036 | 1608 | u = (Unicode *)gmallocn(len, sizeof(Unicode)); | ||
4037 | 1609 | for (i = 0; i < len; ++i) { | ||
4038 | 1610 | u[i] = (Unicode)(s[i] & 0xff); | ||
4039 | 1611 | } | ||
4040 | 1612 | |||
4041 | 1613 | ret = findU(u, len, caseSensitive, next, backward, onePageOnly); | ||
4042 | 1614 | |||
4043 | 1615 | gfree(u); | ||
4044 | 1616 | return ret; | ||
4045 | 1617 | } | ||
4046 | 1618 | |||
4047 | 1619 | GBool PDFCore::findU(Unicode *u, int len, GBool caseSensitive, | ||
4048 | 1620 | GBool next, GBool backward, GBool onePageOnly) { | ||
4049 | 1621 | TextOutputDev *textOut; | ||
4050 | 1622 | double xMin, yMin, xMax, yMax; | ||
4051 | 1623 | PDFCorePage *page; | ||
4052 | 1624 | PDFCoreTile *tile; | ||
4053 | 1625 | int pg; | ||
4054 | 1626 | GBool startAtTop, startAtLast, stopAtLast; | ||
4055 | 1627 | |||
4056 | 1628 | // check for zero-length string | ||
4057 | 1629 | if (len == 0) { | ||
4058 | 1630 | return gFalse; | ||
4059 | 1631 | } | ||
4060 | 1632 | |||
4061 | 1633 | setBusyCursor(gTrue); | ||
4062 | 1634 | |||
4063 | 1635 | // search current page starting at previous result, current | ||
4064 | 1636 | // selection, or top/bottom of page | ||
4065 | 1637 | startAtTop = startAtLast = gFalse; | ||
4066 | 1638 | xMin = yMin = xMax = yMax = 0; | ||
4067 | 1639 | pg = topPage; | ||
4068 | 1640 | if (next) { | ||
4069 | 1641 | startAtLast = gTrue; | ||
4070 | 1642 | } else if (selectULX != selectLRX && selectULY != selectLRY) { | ||
4071 | 1643 | pg = selectPage; | ||
4072 | 1644 | if (backward) { | ||
4073 | 1645 | xMin = selectULX - 1; | ||
4074 | 1646 | yMin = selectULY - 1; | ||
4075 | 1647 | } else { | ||
4076 | 1648 | xMin = selectULX + 1; | ||
4077 | 1649 | yMin = selectULY + 1; | ||
4078 | 1650 | } | ||
4079 | 1651 | } else { | ||
4080 | 1652 | startAtTop = gTrue; | ||
4081 | 1653 | } | ||
4082 | 1654 | if (!(page = findPage(pg))) { | ||
4083 | 1655 | displayPage(pg, zoom, rotate, gTrue, gFalse); | ||
4084 | 1656 | page = findPage(pg); | ||
4085 | 1657 | } | ||
4086 | 1658 | if (page->text->findText(u, len, startAtTop, gTrue, startAtLast, gFalse, | ||
4087 | 1659 | caseSensitive, backward, | ||
4088 | 1660 | &xMin, &yMin, &xMax, &yMax)) { | ||
4089 | 1661 | goto found; | ||
4090 | 1662 | } | ||
4091 | 1663 | |||
4092 | 1664 | if (!onePageOnly) { | ||
4093 | 1665 | |||
4094 | 1666 | // search following/previous pages | ||
4095 | 1667 | textOut = new TextOutputDev(NULL, gTrue, gFalse, gFalse); | ||
4096 | 1668 | if (!textOut->isOk()) { | ||
4097 | 1669 | delete textOut; | ||
4098 | 1670 | goto notFound; | ||
4099 | 1671 | } | ||
4100 | 1672 | for (pg = backward ? pg - 1 : pg + 1; | ||
4101 | 1673 | backward ? pg >= 1 : pg <= doc->getNumPages(); | ||
4102 | 1674 | pg += backward ? -1 : 1) { | ||
4103 | 1675 | doc->displayPage(textOut, pg, 72, 72, 0, gFalse, gTrue, gFalse); | ||
4104 | 1676 | if (textOut->findText(u, len, gTrue, gTrue, gFalse, gFalse, | ||
4105 | 1677 | caseSensitive, backward, | ||
4106 | 1678 | &xMin, &yMin, &xMax, &yMax)) { | ||
4107 | 1679 | delete textOut; | ||
4108 | 1680 | goto foundPage; | ||
4109 | 1681 | } | ||
4110 | 1682 | } | ||
4111 | 1683 | |||
4112 | 1684 | // search previous/following pages | ||
4113 | 1685 | for (pg = backward ? doc->getNumPages() : 1; | ||
4114 | 1686 | backward ? pg > topPage : pg < topPage; | ||
4115 | 1687 | pg += backward ? -1 : 1) { | ||
4116 | 1688 | doc->displayPage(textOut, pg, 72, 72, 0, gFalse, gTrue, gFalse); | ||
4117 | 1689 | if (textOut->findText(u, len, gTrue, gTrue, gFalse, gFalse, | ||
4118 | 1690 | caseSensitive, backward, | ||
4119 | 1691 | &xMin, &yMin, &xMax, &yMax)) { | ||
4120 | 1692 | delete textOut; | ||
4121 | 1693 | goto foundPage; | ||
4122 | 1694 | } | ||
4123 | 1695 | } | ||
4124 | 1696 | delete textOut; | ||
4125 | 1697 | |||
4126 | 1698 | } | ||
4127 | 1699 | |||
4128 | 1700 | // search current page ending at previous result, current selection, | ||
4129 | 1701 | // or bottom/top of page | ||
4130 | 1702 | if (!startAtTop) { | ||
4131 | 1703 | xMin = yMin = xMax = yMax = 0; | ||
4132 | 1704 | if (next) { | ||
4133 | 1705 | stopAtLast = gTrue; | ||
4134 | 1706 | } else { | ||
4135 | 1707 | stopAtLast = gFalse; | ||
4136 | 1708 | xMax = selectLRX; | ||
4137 | 1709 | yMax = selectLRY; | ||
4138 | 1710 | } | ||
4139 | 1711 | if (page->text->findText(u, len, gTrue, gFalse, gFalse, stopAtLast, | ||
4140 | 1712 | caseSensitive, backward, | ||
4141 | 1713 | &xMin, &yMin, &xMax, &yMax)) { | ||
4142 | 1714 | goto found; | ||
4143 | 1715 | } | ||
4144 | 1716 | } | ||
4145 | 1717 | |||
4146 | 1718 | // not found | ||
4147 | 1719 | notFound: | ||
4148 | 1720 | setBusyCursor(gFalse); | ||
4149 | 1721 | return gFalse; | ||
4150 | 1722 | |||
4151 | 1723 | // found on a different page | ||
4152 | 1724 | foundPage: | ||
4153 | 1725 | update(pg, scrollX, continuousMode ? -1 : 0, zoom, rotate, gFalse, gTrue); | ||
4154 | 1726 | page = findPage(pg); | ||
4155 | 1727 | if (!page->text->findText(u, len, gTrue, gTrue, gFalse, gFalse, | ||
4156 | 1728 | caseSensitive, backward, | ||
4157 | 1729 | &xMin, &yMin, &xMax, &yMax)) { | ||
4158 | 1730 | // this can happen if coalescing is bad | ||
4159 | 1731 | goto notFound; | ||
4160 | 1732 | } | ||
4161 | 1733 | |||
4162 | 1734 | // found: change the selection | ||
4163 | 1735 | found: | ||
4164 | 1736 | tile = (PDFCoreTile *)page->tiles->get(0); | ||
4165 | 1737 | setSelection(pg, (int)floor(xMin), (int)floor(yMin), | ||
4166 | 1738 | (int)ceil(xMax), (int)ceil(yMax)); | ||
4167 | 1739 | |||
4168 | 1740 | setBusyCursor(gFalse); | ||
4169 | 1741 | return gTrue; | ||
4170 | 1742 | } | ||
4171 | 1743 | |||
4172 | 1744 | |||
4173 | 1745 | GBool PDFCore::cvtWindowToUser(int xw, int yw, | ||
4174 | 1746 | int *pg, double *xu, double *yu) { | ||
4175 | 1747 | PDFCorePage *page; | ||
4176 | 1748 | PDFCoreTile *tile; | ||
4177 | 1749 | int i; | ||
4178 | 1750 | |||
4179 | 1751 | for (i = 0; i < pages->getLength(); ++i) { | ||
4180 | 1752 | page = (PDFCorePage *)pages->get(i); | ||
4181 | 1753 | if (xw >= page->xDest && xw < page->xDest + page->w && | ||
4182 | 1754 | yw >= page->yDest && yw < page->yDest + page->h) { | ||
4183 | 1755 | tile = (PDFCoreTile *)page->tiles->get(0); | ||
4184 | 1756 | *pg = page->page; | ||
4185 | 1757 | xw -= tile->xDest; | ||
4186 | 1758 | yw -= tile->yDest; | ||
4187 | 1759 | *xu = tile->ictm[0] * xw + tile->ictm[2] * yw + tile->ictm[4]; | ||
4188 | 1760 | *yu = tile->ictm[1] * xw + tile->ictm[3] * yw + tile->ictm[5]; | ||
4189 | 1761 | return gTrue; | ||
4190 | 1762 | } | ||
4191 | 1763 | } | ||
4192 | 1764 | *pg = 0; | ||
4193 | 1765 | *xu = *yu = 0; | ||
4194 | 1766 | return gFalse; | ||
4195 | 1767 | } | ||
4196 | 1768 | |||
4197 | 1769 | GBool PDFCore::cvtWindowToDev(int xw, int yw, int *pg, int *xd, int *yd) { | ||
4198 | 1770 | PDFCorePage *page; | ||
4199 | 1771 | int i; | ||
4200 | 1772 | |||
4201 | 1773 | for (i = 0; i < pages->getLength(); ++i) { | ||
4202 | 1774 | page = (PDFCorePage *)pages->get(i); | ||
4203 | 1775 | if (xw >= page->xDest && xw < page->xDest + page->w && | ||
4204 | 1776 | yw >= page->yDest && yw < page->yDest + page->h) { | ||
4205 | 1777 | *pg = page->page; | ||
4206 | 1778 | *xd = xw - page->xDest; | ||
4207 | 1779 | *yd = yw - page->yDest; | ||
4208 | 1780 | return gTrue; | ||
4209 | 1781 | } | ||
4210 | 1782 | } | ||
4211 | 1783 | *pg = 0; | ||
4212 | 1784 | *xd = *yd = 0; | ||
4213 | 1785 | return gFalse; | ||
4214 | 1786 | } | ||
4215 | 1787 | |||
4216 | 1788 | void PDFCore::cvtUserToWindow(int pg, double xu, double yu, int *xw, int *yw) { | ||
4217 | 1789 | PDFCorePage *page; | ||
4218 | 1790 | PDFCoreTile *tile; | ||
4219 | 1791 | |||
4220 | 1792 | if ((page = findPage(pg)) && | ||
4221 | 1793 | page->tiles->getLength() > 0) { | ||
4222 | 1794 | tile = (PDFCoreTile *)page->tiles->get(0); | ||
4223 | 1795 | } else if (curTile && curPage->page == pg) { | ||
4224 | 1796 | tile = curTile; | ||
4225 | 1797 | } else { | ||
4226 | 1798 | tile = NULL; | ||
4227 | 1799 | } | ||
4228 | 1800 | if (tile) { | ||
4229 | 1801 | *xw = tile->xDest + (int)(tile->ctm[0] * xu + tile->ctm[2] * yu + | ||
4230 | 1802 | tile->ctm[4] + 0.5); | ||
4231 | 1803 | *yw = tile->yDest + (int)(tile->ctm[1] * xu + tile->ctm[3] * yu + | ||
4232 | 1804 | tile->ctm[5] + 0.5); | ||
4233 | 1805 | } else { | ||
4234 | 1806 | // this should never happen | ||
4235 | 1807 | *xw = *yw = 0; | ||
4236 | 1808 | } | ||
4237 | 1809 | } | ||
4238 | 1810 | |||
4239 | 1811 | void PDFCore::cvtUserToDev(int pg, double xu, double yu, int *xd, int *yd) { | ||
4240 | 1812 | PDFCorePage *page; | ||
4241 | 1813 | PDFCoreTile *tile; | ||
4242 | 1814 | double ctm[6]; | ||
4243 | 1815 | |||
4244 | 1816 | if ((page = findPage(pg)) && | ||
4245 | 1817 | page->tiles->getLength() > 0) { | ||
4246 | 1818 | tile = (PDFCoreTile *)page->tiles->get(0); | ||
4247 | 1819 | } else if (curTile && curPage->page == pg) { | ||
4248 | 1820 | tile = curTile; | ||
4249 | 1821 | } else { | ||
4250 | 1822 | tile = NULL; | ||
4251 | 1823 | } | ||
4252 | 1824 | if (tile) { | ||
4253 | 1825 | *xd = (int)(tile->xMin + tile->ctm[0] * xu + | ||
4254 | 1826 | tile->ctm[2] * yu + tile->ctm[4] + 0.5); | ||
4255 | 1827 | *yd = (int)(tile->yMin + tile->ctm[1] * xu + | ||
4256 | 1828 | tile->ctm[3] * yu + tile->ctm[5] + 0.5); | ||
4257 | 1829 | } else { | ||
4258 | 1830 | doc->getCatalog()->getPage(pg)->getDefaultCTM(ctm, dpi, dpi, rotate, | ||
4259 | 1831 | gFalse, out->upsideDown()); | ||
4260 | 1832 | *xd = (int)(ctm[0] * xu + ctm[2] * yu + ctm[4] + 0.5); | ||
4261 | 1833 | *yd = (int)(ctm[1] * xu + ctm[3] * yu + ctm[5] + 0.5); | ||
4262 | 1834 | } | ||
4263 | 1835 | } | ||
4264 | 1836 | |||
4265 | 1837 | void PDFCore::cvtDevToWindow(int pg, int xd, int yd, int *xw, int *yw) { | ||
4266 | 1838 | PDFCorePage *page; | ||
4267 | 1839 | |||
4268 | 1840 | if ((page = findPage(pg))) { | ||
4269 | 1841 | *xw = page->xDest + xd; | ||
4270 | 1842 | *yw = page->yDest + yd; | ||
4271 | 1843 | } else { | ||
4272 | 1844 | // this should never happen | ||
4273 | 1845 | *xw = *yw = 0; | ||
4274 | 1846 | } | ||
4275 | 1847 | } | ||
4276 | 1848 | |||
4277 | 1849 | void PDFCore::cvtDevToUser(int pg, int xd, int yd, double *xu, double *yu) { | ||
4278 | 1850 | PDFCorePage *page; | ||
4279 | 1851 | PDFCoreTile *tile; | ||
4280 | 1852 | |||
4281 | 1853 | if ((page = findPage(pg)) && | ||
4282 | 1854 | page->tiles->getLength() > 0) { | ||
4283 | 1855 | tile = (PDFCoreTile *)page->tiles->get(0); | ||
4284 | 1856 | } else if (curTile && curPage->page == pg) { | ||
4285 | 1857 | tile = curTile; | ||
4286 | 1858 | } else { | ||
4287 | 1859 | tile = NULL; | ||
4288 | 1860 | } | ||
4289 | 1861 | if (tile) { | ||
4290 | 1862 | xd -= tile->xMin; | ||
4291 | 1863 | yd -= tile->yMin; | ||
4292 | 1864 | *xu = tile->ictm[0] * xd + tile->ictm[2] * yd + tile->ictm[4]; | ||
4293 | 1865 | *yu = tile->ictm[1] * xd + tile->ictm[3] * yd + tile->ictm[5]; | ||
4294 | 1866 | } else { | ||
4295 | 1867 | // this should never happen | ||
4296 | 1868 | *xu = *yu = 0; | ||
4297 | 1869 | } | ||
4298 | 1870 | } | ||
4299 | 1871 | |||
4300 | 1872 | void PDFCore::setReverseVideo(GBool reverseVideoA) { | ||
4301 | 1873 | out->setReverseVideo(reverseVideoA); | ||
4302 | 1874 | update(topPage, scrollX, scrollY, zoom, rotate, gTrue, gFalse); | ||
4303 | 1875 | } | ||
4304 | 1876 | |||
4305 | 1877 | LinkAction *PDFCore::findLink(int pg, double x, double y) { | ||
4306 | 1878 | PDFCorePage *page; | ||
4307 | 1879 | |||
4308 | 1880 | if ((page = findPage(pg))) { | ||
4309 | 1881 | return page->links ? page->links->find(x, y) : (LinkAction *)NULL; | ||
4310 | 1882 | } | ||
4311 | 1883 | return NULL; | ||
4312 | 1884 | } | ||
4313 | 1885 | |||
4314 | 1886 | PDFCorePage *PDFCore::findPage(int pg) { | ||
4315 | 1887 | PDFCorePage *page; | ||
4316 | 1888 | int i; | ||
4317 | 1889 | |||
4318 | 1890 | for (i = 0; i < pages->getLength(); ++i) { | ||
4319 | 1891 | page = (PDFCorePage *)pages->get(i); | ||
4320 | 1892 | if (page->page == pg) { | ||
4321 | 1893 | return page; | ||
4322 | 1894 | } | ||
4323 | 1895 | } | ||
4324 | 1896 | return NULL; | ||
4325 | 1897 | } | ||
4326 | 1898 | |||
4327 | 1899 | void PDFCore::redrawCbk(void *data, int x0, int y0, int x1, int y1, | ||
4328 | 1900 | GBool composited) { | ||
4329 | 1901 | PDFCore *core = (PDFCore *)data; | ||
4330 | 1902 | |||
4331 | 1903 | core->curTile->bitmap = core->out->getBitmap(); | ||
4332 | 1904 | |||
4333 | 1905 | // the default CTM is set by the Gfx constructor; tile->ctm is | ||
4334 | 1906 | // needed by the coordinate conversion functions (which may be | ||
4335 | 1907 | // called during redraw) | ||
4336 | 1908 | memcpy(core->curTile->ctm, core->out->getDefCTM(), 6 * sizeof(double)); | ||
4337 | 1909 | memcpy(core->curTile->ictm, core->out->getDefICTM(), 6 * sizeof(double)); | ||
4338 | 1910 | |||
4339 | 1911 | // the bitmap created by Gfx and SplashOutputDev can be a slightly | ||
4340 | 1912 | // different size due to rounding errors | ||
4341 | 1913 | if (x1 >= core->curTile->xMax) { | ||
4342 | 1914 | x1 = core->curTile->xMax - 1; | ||
4343 | 1915 | } | ||
4344 | 1916 | if (y1 >= core->curTile->yMax) { | ||
4345 | 1917 | y1 = core->curTile->yMax - 1; | ||
4346 | 1918 | } | ||
4347 | 1919 | |||
4348 | 1920 | core->clippedRedrawRect(core->curTile, x0, y0, | ||
4349 | 1921 | core->curTile->xDest + x0, core->curTile->yDest + y0, | ||
4350 | 1922 | x1 - x0 + 1, y1 - y0 + 1, | ||
4351 | 1923 | 0, 0, core->drawAreaWidth, core->drawAreaHeight, | ||
4352 | 1924 | gTrue, composited); | ||
4353 | 1925 | } | ||
4354 | 1926 | |||
4355 | 1927 | void PDFCore::redrawWindow(int x, int y, int width, int height, | ||
4356 | 1928 | GBool needUpdate) { | ||
4357 | 1929 | PDFCorePage *page; | ||
4358 | 1930 | PDFCoreTile *tile; | ||
4359 | 1931 | int xDest, yDest, w, i, j; | ||
4360 | 1932 | |||
4361 | 1933 | if (pages->getLength() == 0) { | ||
4362 | 1934 | redrawRect(NULL, 0, 0, x, y, width, height, gTrue); | ||
4363 | 1935 | return; | ||
4364 | 1936 | } | ||
4365 | 1937 | |||
4366 | 1938 | for (i = 0; i < pages->getLength(); ++i) { | ||
4367 | 1939 | page = (PDFCorePage *)pages->get(i); | ||
4368 | 1940 | for (j = 0; j < page->tiles->getLength(); ++j) { | ||
4369 | 1941 | tile = (PDFCoreTile *)page->tiles->get(j); | ||
4370 | 1942 | if (tile->edges & pdfCoreTileTopEdge) { | ||
4371 | 1943 | if (tile->edges & pdfCoreTileLeftEdge) { | ||
4372 | 1944 | xDest = 0; | ||
4373 | 1945 | } else { | ||
4374 | 1946 | xDest = tile->xDest; | ||
4375 | 1947 | } | ||
4376 | 1948 | if (tile->edges & pdfCoreTileRightEdge) { | ||
4377 | 1949 | w = drawAreaWidth - xDest; | ||
4378 | 1950 | } else { | ||
4379 | 1951 | w = tile->xDest + (tile->xMax - tile->xMin) - xDest; | ||
4380 | 1952 | } | ||
4381 | 1953 | clippedRedrawRect(NULL, 0, 0, | ||
4382 | 1954 | xDest, 0, w, tile->yDest, | ||
4383 | 1955 | x, y, width, height, gFalse); | ||
4384 | 1956 | } | ||
4385 | 1957 | if (tile->edges & pdfCoreTileBottomEdge) { | ||
4386 | 1958 | if (tile->edges & pdfCoreTileLeftEdge) { | ||
4387 | 1959 | xDest = 0; | ||
4388 | 1960 | } else { | ||
4389 | 1961 | xDest = tile->xDest; | ||
4390 | 1962 | } | ||
4391 | 1963 | if (tile->edges & pdfCoreTileRightEdge) { | ||
4392 | 1964 | w = drawAreaWidth - xDest; | ||
4393 | 1965 | } else { | ||
4394 | 1966 | w = tile->xDest + (tile->xMax - tile->xMin) - xDest; | ||
4395 | 1967 | } | ||
4396 | 1968 | yDest = tile->yDest + (tile->yMax - tile->yMin); | ||
4397 | 1969 | clippedRedrawRect(NULL, 0, 0, | ||
4398 | 1970 | xDest, yDest, w, drawAreaHeight - yDest, | ||
4399 | 1971 | x, y, width, height, gFalse); | ||
4400 | 1972 | } else if ((tile->edges & pdfCoreTileBottomSpace) && | ||
4401 | 1973 | i+1 < pages->getLength()) { | ||
4402 | 1974 | if (tile->edges & pdfCoreTileLeftEdge) { | ||
4403 | 1975 | xDest = 0; | ||
4404 | 1976 | } else { | ||
4405 | 1977 | xDest = tile->xDest; | ||
4406 | 1978 | } | ||
4407 | 1979 | if (tile->edges & pdfCoreTileRightEdge) { | ||
4408 | 1980 | w = drawAreaWidth - xDest; | ||
4409 | 1981 | } else { | ||
4410 | 1982 | w = tile->xDest + (tile->xMax - tile->xMin) - xDest; | ||
4411 | 1983 | } | ||
4412 | 1984 | yDest = tile->yDest + (tile->yMax - tile->yMin); | ||
4413 | 1985 | clippedRedrawRect(NULL, 0, 0, | ||
4414 | 1986 | xDest, yDest, | ||
4415 | 1987 | w, ((PDFCorePage *)pages->get(i+1))->yDest - yDest, | ||
4416 | 1988 | x, y, width, height, gFalse); | ||
4417 | 1989 | } | ||
4418 | 1990 | if (tile->edges & pdfCoreTileLeftEdge) { | ||
4419 | 1991 | clippedRedrawRect(NULL, 0, 0, | ||
4420 | 1992 | 0, tile->yDest, | ||
4421 | 1993 | tile->xDest, tile->yMax - tile->yMin, | ||
4422 | 1994 | x, y, width, height, gFalse); | ||
4423 | 1995 | } | ||
4424 | 1996 | if (tile->edges & pdfCoreTileRightEdge) { | ||
4425 | 1997 | xDest = tile->xDest + (tile->xMax - tile->xMin); | ||
4426 | 1998 | clippedRedrawRect(NULL, 0, 0, | ||
4427 | 1999 | xDest, tile->yDest, | ||
4428 | 2000 | drawAreaWidth - xDest, tile->yMax - tile->yMin, | ||
4429 | 2001 | x, y, width, height, gFalse); | ||
4430 | 2002 | } | ||
4431 | 2003 | clippedRedrawRect(tile, 0, 0, tile->xDest, tile->yDest, | ||
4432 | 2004 | tile->bitmap->getWidth(), tile->bitmap->getHeight(), | ||
4433 | 2005 | x, y, width, height, needUpdate); | ||
4434 | 2006 | } | ||
4435 | 2007 | } | ||
4436 | 2008 | } | ||
4437 | 2009 | |||
4438 | 2010 | PDFCoreTile *PDFCore::newTile(int xDestA, int yDestA) { | ||
4439 | 2011 | return new PDFCoreTile(xDestA, yDestA); | ||
4440 | 2012 | } | ||
4441 | 2013 | |||
4442 | 2014 | void PDFCore::updateTileData(PDFCoreTile *tileA, int xSrc, int ySrc, | ||
4443 | 2015 | int width, int height, GBool composited) { | ||
4444 | 2016 | } | ||
4445 | 2017 | |||
4446 | 2018 | void PDFCore::clippedRedrawRect(PDFCoreTile *tile, int xSrc, int ySrc, | ||
4447 | 2019 | int xDest, int yDest, int width, int height, | ||
4448 | 2020 | int xClip, int yClip, int wClip, int hClip, | ||
4449 | 2021 | GBool needUpdate, GBool composited) { | ||
4450 | 2022 | if (tile && needUpdate) { | ||
4451 | 2023 | updateTileData(tile, xSrc, ySrc, width, height, composited); | ||
4452 | 2024 | } | ||
4453 | 2025 | if (xDest < xClip) { | ||
4454 | 2026 | xSrc += xClip - xDest; | ||
4455 | 2027 | width -= xClip - xDest; | ||
4456 | 2028 | xDest = xClip; | ||
4457 | 2029 | } | ||
4458 | 2030 | if (xDest + width > xClip + wClip) { | ||
4459 | 2031 | width = xClip + wClip - xDest; | ||
4460 | 2032 | } | ||
4461 | 2033 | if (yDest < yClip) { | ||
4462 | 2034 | ySrc += yClip - yDest; | ||
4463 | 2035 | height -= yClip - yDest; | ||
4464 | 2036 | yDest = yClip; | ||
4465 | 2037 | } | ||
4466 | 2038 | if (yDest + height > yClip + hClip) { | ||
4467 | 2039 | height = yClip + hClip - yDest; | ||
4468 | 2040 | } | ||
4469 | 2041 | if (width > 0 && height > 0) { | ||
4470 | 2042 | redrawRect(tile, xSrc, ySrc, xDest, yDest, width, height, composited); | ||
4471 | 2043 | } | ||
4472 | 2044 | } | ||
4473 | 0 | 2045 | ||
4474 | === added file '.pc/02_permissions.dpatch/xpdf/XPDFCore.cc' | |||
4475 | --- .pc/02_permissions.dpatch/xpdf/XPDFCore.cc 1970-01-01 00:00:00 +0000 | |||
4476 | +++ .pc/02_permissions.dpatch/xpdf/XPDFCore.cc 2010-04-06 13:42:20 +0000 | |||
4477 | @@ -0,0 +1,1655 @@ | |||
4478 | 1 | //======================================================================== | ||
4479 | 2 | // | ||
4480 | 3 | // XPDFCore.cc | ||
4481 | 4 | // | ||
4482 | 5 | // Copyright 2002-2003 Glyph & Cog, LLC | ||
4483 | 6 | // | ||
4484 | 7 | //======================================================================== | ||
4485 | 8 | |||
4486 | 9 | #include <aconf.h> | ||
4487 | 10 | |||
4488 | 11 | #ifdef USE_GCC_PRAGMAS | ||
4489 | 12 | #pragma implementation | ||
4490 | 13 | #endif | ||
4491 | 14 | |||
4492 | 15 | #include <X11/keysym.h> | ||
4493 | 16 | #include <X11/cursorfont.h> | ||
4494 | 17 | #include <string.h> | ||
4495 | 18 | #include "gmem.h" | ||
4496 | 19 | #include "GString.h" | ||
4497 | 20 | #include "GList.h" | ||
4498 | 21 | #include "Error.h" | ||
4499 | 22 | #include "GlobalParams.h" | ||
4500 | 23 | #include "PDFDoc.h" | ||
4501 | 24 | #include "Link.h" | ||
4502 | 25 | #include "ErrorCodes.h" | ||
4503 | 26 | #include "GfxState.h" | ||
4504 | 27 | #include "CoreOutputDev.h" | ||
4505 | 28 | #include "PSOutputDev.h" | ||
4506 | 29 | #include "TextOutputDev.h" | ||
4507 | 30 | #include "SplashBitmap.h" | ||
4508 | 31 | #include "SplashPattern.h" | ||
4509 | 32 | #include "XPDFApp.h" | ||
4510 | 33 | #include "XPDFCore.h" | ||
4511 | 34 | |||
4512 | 35 | // these macro defns conflict with xpdf's Object class | ||
4513 | 36 | #ifdef LESSTIF_VERSION | ||
4514 | 37 | #undef XtDisplay | ||
4515 | 38 | #undef XtScreen | ||
4516 | 39 | #undef XtWindow | ||
4517 | 40 | #undef XtParent | ||
4518 | 41 | #undef XtIsRealized | ||
4519 | 42 | #endif | ||
4520 | 43 | |||
4521 | 44 | //------------------------------------------------------------------------ | ||
4522 | 45 | |||
4523 | 46 | // Divide a 16-bit value (in [0, 255*255]) by 255, returning an 8-bit result. | ||
4524 | 47 | static inline Guchar div255(int x) { | ||
4525 | 48 | return (Guchar)((x + (x >> 8) + 0x80) >> 8); | ||
4526 | 49 | } | ||
4527 | 50 | |||
4528 | 51 | //------------------------------------------------------------------------ | ||
4529 | 52 | |||
4530 | 53 | GString *XPDFCore::currentSelection = NULL; | ||
4531 | 54 | XPDFCore *XPDFCore::currentSelectionOwner = NULL; | ||
4532 | 55 | Atom XPDFCore::targetsAtom; | ||
4533 | 56 | |||
4534 | 57 | //------------------------------------------------------------------------ | ||
4535 | 58 | // XPDFCoreTile | ||
4536 | 59 | //------------------------------------------------------------------------ | ||
4537 | 60 | |||
4538 | 61 | class XPDFCoreTile: public PDFCoreTile { | ||
4539 | 62 | public: | ||
4540 | 63 | XPDFCoreTile(int xDestA, int yDestA); | ||
4541 | 64 | virtual ~XPDFCoreTile(); | ||
4542 | 65 | XImage *image; | ||
4543 | 66 | }; | ||
4544 | 67 | |||
4545 | 68 | XPDFCoreTile::XPDFCoreTile(int xDestA, int yDestA): | ||
4546 | 69 | PDFCoreTile(xDestA, yDestA) | ||
4547 | 70 | { | ||
4548 | 71 | image = NULL; | ||
4549 | 72 | } | ||
4550 | 73 | |||
4551 | 74 | XPDFCoreTile::~XPDFCoreTile() { | ||
4552 | 75 | if (image) { | ||
4553 | 76 | gfree(image->data); | ||
4554 | 77 | image->data = NULL; | ||
4555 | 78 | XDestroyImage(image); | ||
4556 | 79 | } | ||
4557 | 80 | } | ||
4558 | 81 | |||
4559 | 82 | //------------------------------------------------------------------------ | ||
4560 | 83 | // XPDFCore | ||
4561 | 84 | //------------------------------------------------------------------------ | ||
4562 | 85 | |||
4563 | 86 | XPDFCore::XPDFCore(Widget shellA, Widget parentWidgetA, | ||
4564 | 87 | SplashColorPtr paperColorA, Gulong paperPixelA, | ||
4565 | 88 | Gulong mattePixelA, GBool fullScreenA, GBool reverseVideoA, | ||
4566 | 89 | GBool installCmap, int rgbCubeSizeA): | ||
4567 | 90 | PDFCore(splashModeRGB8, 4, reverseVideoA, paperColorA, !fullScreenA) | ||
4568 | 91 | { | ||
4569 | 92 | GString *initialZoom; | ||
4570 | 93 | |||
4571 | 94 | shell = shellA; | ||
4572 | 95 | parentWidget = parentWidgetA; | ||
4573 | 96 | display = XtDisplay(parentWidget); | ||
4574 | 97 | screenNum = XScreenNumberOfScreen(XtScreen(parentWidget)); | ||
4575 | 98 | targetsAtom = XInternAtom(display, "TARGETS", False); | ||
4576 | 99 | |||
4577 | 100 | paperPixel = paperPixelA; | ||
4578 | 101 | mattePixel = mattePixelA; | ||
4579 | 102 | fullScreen = fullScreenA; | ||
4580 | 103 | |||
4581 | 104 | setupX(installCmap, rgbCubeSizeA); | ||
4582 | 105 | |||
4583 | 106 | scrolledWin = NULL; | ||
4584 | 107 | hScrollBar = NULL; | ||
4585 | 108 | vScrollBar = NULL; | ||
4586 | 109 | drawAreaFrame = NULL; | ||
4587 | 110 | drawArea = NULL; | ||
4588 | 111 | |||
4589 | 112 | // get the initial zoom value | ||
4590 | 113 | if (fullScreen) { | ||
4591 | 114 | zoom = zoomPage; | ||
4592 | 115 | } else { | ||
4593 | 116 | initialZoom = globalParams->getInitialZoom(); | ||
4594 | 117 | if (!initialZoom->cmp("page")) { | ||
4595 | 118 | zoom = zoomPage; | ||
4596 | 119 | } else if (!initialZoom->cmp("width")) { | ||
4597 | 120 | zoom = zoomWidth; | ||
4598 | 121 | } else { | ||
4599 | 122 | zoom = atoi(initialZoom->getCString()); | ||
4600 | 123 | if (zoom <= 0) { | ||
4601 | 124 | zoom = defZoom; | ||
4602 | 125 | } | ||
4603 | 126 | } | ||
4604 | 127 | delete initialZoom; | ||
4605 | 128 | } | ||
4606 | 129 | |||
4607 | 130 | linkAction = NULL; | ||
4608 | 131 | |||
4609 | 132 | panning = gFalse; | ||
4610 | 133 | |||
4611 | 134 | updateCbk = NULL; | ||
4612 | 135 | actionCbk = NULL; | ||
4613 | 136 | keyPressCbk = NULL; | ||
4614 | 137 | mouseCbk = NULL; | ||
4615 | 138 | |||
4616 | 139 | // optional features default to on | ||
4617 | 140 | hyperlinksEnabled = gTrue; | ||
4618 | 141 | selectEnabled = gTrue; | ||
4619 | 142 | |||
4620 | 143 | // do X-specific initialization and create the widgets | ||
4621 | 144 | initWindow(); | ||
4622 | 145 | initPasswordDialog(); | ||
4623 | 146 | } | ||
4624 | 147 | |||
4625 | 148 | XPDFCore::~XPDFCore() { | ||
4626 | 149 | if (currentSelectionOwner == this && currentSelection) { | ||
4627 | 150 | delete currentSelection; | ||
4628 | 151 | currentSelection = NULL; | ||
4629 | 152 | currentSelectionOwner = NULL; | ||
4630 | 153 | } | ||
4631 | 154 | if (drawAreaGC) { | ||
4632 | 155 | XFreeGC(display, drawAreaGC); | ||
4633 | 156 | } | ||
4634 | 157 | if (scrolledWin) { | ||
4635 | 158 | XtDestroyWidget(scrolledWin); | ||
4636 | 159 | } | ||
4637 | 160 | if (busyCursor) { | ||
4638 | 161 | XFreeCursor(display, busyCursor); | ||
4639 | 162 | } | ||
4640 | 163 | if (linkCursor) { | ||
4641 | 164 | XFreeCursor(display, linkCursor); | ||
4642 | 165 | } | ||
4643 | 166 | if (selectCursor) { | ||
4644 | 167 | XFreeCursor(display, selectCursor); | ||
4645 | 168 | } | ||
4646 | 169 | } | ||
4647 | 170 | |||
4648 | 171 | //------------------------------------------------------------------------ | ||
4649 | 172 | // loadFile / displayPage / displayDest | ||
4650 | 173 | //------------------------------------------------------------------------ | ||
4651 | 174 | |||
4652 | 175 | int XPDFCore::loadFile(GString *fileName, GString *ownerPassword, | ||
4653 | 176 | GString *userPassword) { | ||
4654 | 177 | int err; | ||
4655 | 178 | |||
4656 | 179 | err = PDFCore::loadFile(fileName, ownerPassword, userPassword); | ||
4657 | 180 | if (err == errNone) { | ||
4658 | 181 | // save the modification time | ||
4659 | 182 | modTime = getModTime(doc->getFileName()->getCString()); | ||
4660 | 183 | |||
4661 | 184 | // update the parent window | ||
4662 | 185 | if (updateCbk) { | ||
4663 | 186 | (*updateCbk)(updateCbkData, doc->getFileName(), -1, | ||
4664 | 187 | doc->getNumPages(), NULL); | ||
4665 | 188 | } | ||
4666 | 189 | } | ||
4667 | 190 | return err; | ||
4668 | 191 | } | ||
4669 | 192 | |||
4670 | 193 | int XPDFCore::loadFile(BaseStream *stream, GString *ownerPassword, | ||
4671 | 194 | GString *userPassword) { | ||
4672 | 195 | int err; | ||
4673 | 196 | |||
4674 | 197 | err = PDFCore::loadFile(stream, ownerPassword, userPassword); | ||
4675 | 198 | if (err == errNone) { | ||
4676 | 199 | // no file | ||
4677 | 200 | modTime = 0; | ||
4678 | 201 | |||
4679 | 202 | // update the parent window | ||
4680 | 203 | if (updateCbk) { | ||
4681 | 204 | (*updateCbk)(updateCbkData, doc->getFileName(), -1, | ||
4682 | 205 | doc->getNumPages(), NULL); | ||
4683 | 206 | } | ||
4684 | 207 | } | ||
4685 | 208 | return err; | ||
4686 | 209 | } | ||
4687 | 210 | |||
4688 | 211 | void XPDFCore::loadDoc(PDFDoc *docA) { | ||
4689 | 212 | PDFCore::loadDoc(docA); | ||
4690 | 213 | |||
4691 | 214 | // save the modification time | ||
4692 | 215 | if (doc->getFileName()) { | ||
4693 | 216 | modTime = getModTime(doc->getFileName()->getCString()); | ||
4694 | 217 | } | ||
4695 | 218 | |||
4696 | 219 | // update the parent window | ||
4697 | 220 | if (updateCbk) { | ||
4698 | 221 | (*updateCbk)(updateCbkData, doc->getFileName(), -1, | ||
4699 | 222 | doc->getNumPages(), NULL); | ||
4700 | 223 | } | ||
4701 | 224 | } | ||
4702 | 225 | |||
4703 | 226 | void XPDFCore::resizeToPage(int pg) { | ||
4704 | 227 | Dimension width, height; | ||
4705 | 228 | double width1, height1; | ||
4706 | 229 | Dimension topW, topH, topBorder, daW, daH; | ||
4707 | 230 | Dimension displayW, displayH; | ||
4708 | 231 | |||
4709 | 232 | displayW = DisplayWidth(display, screenNum); | ||
4710 | 233 | displayH = DisplayHeight(display, screenNum); | ||
4711 | 234 | if (fullScreen) { | ||
4712 | 235 | width = displayW; | ||
4713 | 236 | height = displayH; | ||
4714 | 237 | } else { | ||
4715 | 238 | if (!doc || pg <= 0 || pg > doc->getNumPages()) { | ||
4716 | 239 | width1 = 612; | ||
4717 | 240 | height1 = 792; | ||
4718 | 241 | } else if (doc->getPageRotate(pg) == 90 || | ||
4719 | 242 | doc->getPageRotate(pg) == 270) { | ||
4720 | 243 | width1 = doc->getPageCropHeight(pg); | ||
4721 | 244 | height1 = doc->getPageCropWidth(pg); | ||
4722 | 245 | } else { | ||
4723 | 246 | width1 = doc->getPageCropWidth(pg); | ||
4724 | 247 | height1 = doc->getPageCropHeight(pg); | ||
4725 | 248 | } | ||
4726 | 249 | if (zoom == zoomPage || zoom == zoomWidth) { | ||
4727 | 250 | width = (Dimension)(width1 * 0.01 * defZoom + 0.5); | ||
4728 | 251 | height = (Dimension)(height1 * 0.01 * defZoom + 0.5); | ||
4729 | 252 | } else { | ||
4730 | 253 | width = (Dimension)(width1 * 0.01 * zoom + 0.5); | ||
4731 | 254 | height = (Dimension)(height1 * 0.01 * zoom + 0.5); | ||
4732 | 255 | } | ||
4733 | 256 | if (continuousMode) { | ||
4734 | 257 | height += continuousModePageSpacing; | ||
4735 | 258 | } | ||
4736 | 259 | if (width > displayW - 100) { | ||
4737 | 260 | width = displayW - 100; | ||
4738 | 261 | } | ||
4739 | 262 | if (height > displayH - 100) { | ||
4740 | 263 | height = displayH - 100; | ||
4741 | 264 | } | ||
4742 | 265 | } | ||
4743 | 266 | |||
4744 | 267 | if (XtIsRealized(shell)) { | ||
4745 | 268 | XtVaGetValues(shell, XmNwidth, &topW, XmNheight, &topH, | ||
4746 | 269 | XmNborderWidth, &topBorder, NULL); | ||
4747 | 270 | XtVaGetValues(drawArea, XmNwidth, &daW, XmNheight, &daH, NULL); | ||
4748 | 271 | XtVaSetValues(shell, XmNwidth, width + (topW - daW), | ||
4749 | 272 | XmNheight, height + (topH - daH), NULL); | ||
4750 | 273 | } else { | ||
4751 | 274 | XtVaSetValues(drawArea, XmNwidth, width, XmNheight, height, NULL); | ||
4752 | 275 | } | ||
4753 | 276 | } | ||
4754 | 277 | |||
4755 | 278 | void XPDFCore::update(int topPageA, int scrollXA, int scrollYA, | ||
4756 | 279 | double zoomA, int rotateA, | ||
4757 | 280 | GBool force, GBool addToHist) { | ||
4758 | 281 | int oldPage; | ||
4759 | 282 | |||
4760 | 283 | oldPage = topPage; | ||
4761 | 284 | PDFCore::update(topPageA, scrollXA, scrollYA, zoomA, rotateA, | ||
4762 | 285 | force, addToHist); | ||
4763 | 286 | linkAction = NULL; | ||
4764 | 287 | if (doc && topPage != oldPage) { | ||
4765 | 288 | if (updateCbk) { | ||
4766 | 289 | (*updateCbk)(updateCbkData, NULL, topPage, -1, ""); | ||
4767 | 290 | } | ||
4768 | 291 | } | ||
4769 | 292 | } | ||
4770 | 293 | |||
4771 | 294 | GBool XPDFCore::checkForNewFile() { | ||
4772 | 295 | time_t newModTime; | ||
4773 | 296 | |||
4774 | 297 | if (doc->getFileName()) { | ||
4775 | 298 | newModTime = getModTime(doc->getFileName()->getCString()); | ||
4776 | 299 | if (newModTime != modTime) { | ||
4777 | 300 | modTime = newModTime; | ||
4778 | 301 | return gTrue; | ||
4779 | 302 | } | ||
4780 | 303 | } | ||
4781 | 304 | return gFalse; | ||
4782 | 305 | } | ||
4783 | 306 | |||
4784 | 307 | //------------------------------------------------------------------------ | ||
4785 | 308 | // page/position changes | ||
4786 | 309 | //------------------------------------------------------------------------ | ||
4787 | 310 | |||
4788 | 311 | GBool XPDFCore::gotoNextPage(int inc, GBool top) { | ||
4789 | 312 | if (!PDFCore::gotoNextPage(inc, top)) { | ||
4790 | 313 | XBell(display, 0); | ||
4791 | 314 | return gFalse; | ||
4792 | 315 | } | ||
4793 | 316 | return gTrue; | ||
4794 | 317 | } | ||
4795 | 318 | |||
4796 | 319 | GBool XPDFCore::gotoPrevPage(int dec, GBool top, GBool bottom) { | ||
4797 | 320 | if (!PDFCore::gotoPrevPage(dec, top, bottom)) { | ||
4798 | 321 | XBell(display, 0); | ||
4799 | 322 | return gFalse; | ||
4800 | 323 | } | ||
4801 | 324 | return gTrue; | ||
4802 | 325 | } | ||
4803 | 326 | |||
4804 | 327 | GBool XPDFCore::goForward() { | ||
4805 | 328 | if (!PDFCore::goForward()) { | ||
4806 | 329 | XBell(display, 0); | ||
4807 | 330 | return gFalse; | ||
4808 | 331 | } | ||
4809 | 332 | return gTrue; | ||
4810 | 333 | } | ||
4811 | 334 | |||
4812 | 335 | GBool XPDFCore::goBackward() { | ||
4813 | 336 | if (!PDFCore::goBackward()) { | ||
4814 | 337 | XBell(display, 0); | ||
4815 | 338 | return gFalse; | ||
4816 | 339 | } | ||
4817 | 340 | return gTrue; | ||
4818 | 341 | } | ||
4819 | 342 | |||
4820 | 343 | void XPDFCore::startPan(int wx, int wy) { | ||
4821 | 344 | panning = gTrue; | ||
4822 | 345 | panMX = wx; | ||
4823 | 346 | panMY = wy; | ||
4824 | 347 | } | ||
4825 | 348 | |||
4826 | 349 | void XPDFCore::endPan(int wx, int wy) { | ||
4827 | 350 | panning = gFalse; | ||
4828 | 351 | } | ||
4829 | 352 | |||
4830 | 353 | //------------------------------------------------------------------------ | ||
4831 | 354 | // selection | ||
4832 | 355 | //------------------------------------------------------------------------ | ||
4833 | 356 | |||
4834 | 357 | void XPDFCore::startSelection(int wx, int wy) { | ||
4835 | 358 | int pg, x, y; | ||
4836 | 359 | |||
4837 | 360 | takeFocus(); | ||
4838 | 361 | if (doc && doc->getNumPages() > 0) { | ||
4839 | 362 | if (selectEnabled) { | ||
4840 | 363 | if (cvtWindowToDev(wx, wy, &pg, &x, &y)) { | ||
4841 | 364 | setSelection(pg, x, y, x, y); | ||
4842 | 365 | setCursor(selectCursor); | ||
4843 | 366 | dragging = gTrue; | ||
4844 | 367 | } | ||
4845 | 368 | } | ||
4846 | 369 | } | ||
4847 | 370 | } | ||
4848 | 371 | |||
4849 | 372 | void XPDFCore::endSelection(int wx, int wy) { | ||
4850 | 373 | int pg, x, y; | ||
4851 | 374 | GBool ok; | ||
4852 | 375 | |||
4853 | 376 | if (doc && doc->getNumPages() > 0) { | ||
4854 | 377 | ok = cvtWindowToDev(wx, wy, &pg, &x, &y); | ||
4855 | 378 | if (dragging) { | ||
4856 | 379 | dragging = gFalse; | ||
4857 | 380 | setCursor(None); | ||
4858 | 381 | if (ok) { | ||
4859 | 382 | moveSelection(pg, x, y); | ||
4860 | 383 | } | ||
4861 | 384 | #ifndef NO_TEXT_SELECT | ||
4862 | 385 | if (selectULX != selectLRX && | ||
4863 | 386 | selectULY != selectLRY) { | ||
4864 | 387 | if (doc->okToCopy()) { | ||
4865 | 388 | copySelection(); | ||
4866 | 389 | } else { | ||
4867 | 390 | error(-1, "Copying of text from this document is not allowed."); | ||
4868 | 391 | } | ||
4869 | 392 | } | ||
4870 | 393 | #endif | ||
4871 | 394 | } | ||
4872 | 395 | } | ||
4873 | 396 | } | ||
4874 | 397 | |||
4875 | 398 | // X's copy-and-paste mechanism is brain damaged. Xt doesn't help | ||
4876 | 399 | // any, but doesn't make it too much worse, either. Motif, on the | ||
4877 | 400 | // other hand, adds significant complexity to the mess. So here we | ||
4878 | 401 | // blow off the Motif junk and stick to plain old Xt. The next two | ||
4879 | 402 | // functions (copySelection and convertSelectionCbk) implement the | ||
4880 | 403 | // magic needed to deal with Xt's mechanism. Note that this requires | ||
4881 | 404 | // global variables (currentSelection and currentSelectionOwner). | ||
4882 | 405 | |||
4883 | 406 | void XPDFCore::copySelection() { | ||
4884 | 407 | int pg; | ||
4885 | 408 | double ulx, uly, lrx, lry; | ||
4886 | 409 | |||
4887 | 410 | if (!doc->okToCopy()) { | ||
4888 | 411 | return; | ||
4889 | 412 | } | ||
4890 | 413 | if (getSelection(&pg, &ulx, &uly, &lrx, &lry)) { | ||
4891 | 414 | //~ for multithreading: need a mutex here | ||
4892 | 415 | if (currentSelection) { | ||
4893 | 416 | delete currentSelection; | ||
4894 | 417 | } | ||
4895 | 418 | currentSelection = extractText(pg, ulx, uly, lrx, lry); | ||
4896 | 419 | currentSelectionOwner = this; | ||
4897 | 420 | XtOwnSelection(drawArea, XA_PRIMARY, XtLastTimestampProcessed(display), | ||
4898 | 421 | &convertSelectionCbk, NULL, NULL); | ||
4899 | 422 | } | ||
4900 | 423 | } | ||
4901 | 424 | |||
4902 | 425 | Boolean XPDFCore::convertSelectionCbk(Widget widget, Atom *selection, | ||
4903 | 426 | Atom *target, Atom *type, | ||
4904 | 427 | XtPointer *value, unsigned long *length, | ||
4905 | 428 | int *format) { | ||
4906 | 429 | Atom *array; | ||
4907 | 430 | |||
4908 | 431 | // send back a list of supported conversion targets | ||
4909 | 432 | if (*target == targetsAtom) { | ||
4910 | 433 | if (!(array = (Atom *)XtMalloc(sizeof(Atom)))) { | ||
4911 | 434 | return False; | ||
4912 | 435 | } | ||
4913 | 436 | array[0] = XA_STRING; | ||
4914 | 437 | *value = (XtPointer)array; | ||
4915 | 438 | *type = XA_ATOM; | ||
4916 | 439 | *format = 32; | ||
4917 | 440 | *length = 1; | ||
4918 | 441 | return True; | ||
4919 | 442 | |||
4920 | 443 | // send the selected text | ||
4921 | 444 | } else if (*target == XA_STRING) { | ||
4922 | 445 | //~ for multithreading: need a mutex here | ||
4923 | 446 | *value = XtNewString(currentSelection->getCString()); | ||
4924 | 447 | *length = currentSelection->getLength(); | ||
4925 | 448 | *type = XA_STRING; | ||
4926 | 449 | *format = 8; // 8-bit elements | ||
4927 | 450 | return True; | ||
4928 | 451 | } | ||
4929 | 452 | |||
4930 | 453 | return False; | ||
4931 | 454 | } | ||
4932 | 455 | |||
4933 | 456 | //------------------------------------------------------------------------ | ||
4934 | 457 | // hyperlinks | ||
4935 | 458 | //------------------------------------------------------------------------ | ||
4936 | 459 | |||
4937 | 460 | void XPDFCore::doAction(LinkAction *action) { | ||
4938 | 461 | LinkActionKind kind; | ||
4939 | 462 | LinkDest *dest; | ||
4940 | 463 | GString *namedDest; | ||
4941 | 464 | char *s; | ||
4942 | 465 | GString *fileName, *fileName2; | ||
4943 | 466 | GString *cmd; | ||
4944 | 467 | GString *actionName; | ||
4945 | 468 | Object movieAnnot, obj1, obj2; | ||
4946 | 469 | GString *msg; | ||
4947 | 470 | int i; | ||
4948 | 471 | |||
4949 | 472 | switch (kind = action->getKind()) { | ||
4950 | 473 | |||
4951 | 474 | // GoTo / GoToR action | ||
4952 | 475 | case actionGoTo: | ||
4953 | 476 | case actionGoToR: | ||
4954 | 477 | if (kind == actionGoTo) { | ||
4955 | 478 | dest = NULL; | ||
4956 | 479 | namedDest = NULL; | ||
4957 | 480 | if ((dest = ((LinkGoTo *)action)->getDest())) { | ||
4958 | 481 | dest = dest->copy(); | ||
4959 | 482 | } else if ((namedDest = ((LinkGoTo *)action)->getNamedDest())) { | ||
4960 | 483 | namedDest = namedDest->copy(); | ||
4961 | 484 | } | ||
4962 | 485 | } else { | ||
4963 | 486 | dest = NULL; | ||
4964 | 487 | namedDest = NULL; | ||
4965 | 488 | if ((dest = ((LinkGoToR *)action)->getDest())) { | ||
4966 | 489 | dest = dest->copy(); | ||
4967 | 490 | } else if ((namedDest = ((LinkGoToR *)action)->getNamedDest())) { | ||
4968 | 491 | namedDest = namedDest->copy(); | ||
4969 | 492 | } | ||
4970 | 493 | s = ((LinkGoToR *)action)->getFileName()->getCString(); | ||
4971 | 494 | //~ translate path name for VMS (deal with '/') | ||
4972 | 495 | if (isAbsolutePath(s)) { | ||
4973 | 496 | fileName = new GString(s); | ||
4974 | 497 | } else { | ||
4975 | 498 | fileName = appendToPath(grabPath(doc->getFileName()->getCString()), s); | ||
4976 | 499 | } | ||
4977 | 500 | if (loadFile(fileName) != errNone) { | ||
4978 | 501 | if (dest) { | ||
4979 | 502 | delete dest; | ||
4980 | 503 | } | ||
4981 | 504 | if (namedDest) { | ||
4982 | 505 | delete namedDest; | ||
4983 | 506 | } | ||
4984 | 507 | delete fileName; | ||
4985 | 508 | return; | ||
4986 | 509 | } | ||
4987 | 510 | delete fileName; | ||
4988 | 511 | } | ||
4989 | 512 | if (namedDest) { | ||
4990 | 513 | dest = doc->findDest(namedDest); | ||
4991 | 514 | delete namedDest; | ||
4992 | 515 | } | ||
4993 | 516 | if (dest) { | ||
4994 | 517 | displayDest(dest, zoom, rotate, gTrue); | ||
4995 | 518 | delete dest; | ||
4996 | 519 | } else { | ||
4997 | 520 | if (kind == actionGoToR) { | ||
4998 | 521 | displayPage(1, zoom, 0, gFalse, gTrue); | ||
4999 | 522 | } | ||
5000 | 523 | } |
The diff has been truncated for viewing.