| 1 |
lars |
1 |
<html>
|
|
|
2 |
<head>
|
|
|
3 |
<title>html2ps/html2pdf FAQ</title>
|
|
|
4 |
<link rel="stylesheet" type="text/css" medial="all" title="Default" href="css/help.css"/>
|
|
|
5 |
</head>
|
|
|
6 |
<body>
|
|
|
7 |
<h1>html2ps/pdf FAQ</h1>
|
|
|
8 |
<a href="index.html">Back to table of contents</a>
|
|
|
9 |
|
|
|
10 |
<ul>
|
|
|
11 |
<li><a href="#installation">Installation</a>
|
|
|
12 |
<ul>
|
|
|
13 |
<li><a href="#installation-utilities">Does html2ps require any external utilities like ghostscript?</a></li>
|
|
|
14 |
<li><a href="#installation-commandline">Can I call this script from the command line?</a></li>
|
|
|
15 |
<li><a href="#installation-version">How can I determine the script version?</a></li>
|
|
|
16 |
</ul></li>
|
|
|
17 |
<li><a href="#nooutput">No output at all. Broken output.</a>
|
|
|
18 |
<ul>
|
|
|
19 |
<li><a href="#nooutput-regexp">I'm getting "Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Empty string supplied as input" error message in PHP 5.2.0</a></li>
|
|
|
20 |
<li><a href="#nooutput-utf8">Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Input is not proper UTF-8, indicate encoding .... </a></li>
|
|
|
21 |
<li><a href="#nooutput-php442">HTML2PS returns blank page. There's some strange messages in PHP error log…</a></li>
|
|
|
22 |
<li><a href="#nooutput-memory">All I'm getting is a blank page; no error messages in PHP error log. Whats happened?</a></li>
|
|
|
23 |
<li><a href="#nooutput-memory2">I got the following error message: <tt>Fatal error: Allowed memory size of … bytes exhausted (tried to allocate … bytes) in&hellip</tt></a></li>
|
|
|
24 |
<li><a href="#nooutput-php440">The script just hangs when converting page containing images! With "render images" options disabled it works!</a></li>
|
|
|
25 |
<li><a href="#nooutput-limits">I've increased limits, but still sometimes get a blank page immediately after the script starts! Some sites are parsed, though...</a></li>
|
|
|
26 |
<li><a href="#nooutput-firefox">I'm getting "PDF doesn't start with "%PDF-" message from Acrobat Reader. Nevertheless, when I save file to my hard drive, it opens perfectly. I'm using Firefox. </a></li>
|
|
|
27 |
<li><a href="#nooutput-cache">Some characters are displayed incorrectly or missing.</a></li>
|
|
|
28 |
<li><a href="#nooutput-file-protocol">I cannot fetch files from local hard disk using 'file' procolol.</a></li>
|
|
|
29 |
</ul></li>
|
|
|
30 |
<li><a href="#layout-broken">Broken layout.</a></li>
|
|
|
31 |
<ul>
|
|
|
32 |
<li><a href="#layout-broken-missing-characters">Some characters are missing in my PDFs on some Acrobat Reader versions / different OSes</a></li>
|
|
|
33 |
<li><a href="#layout-broken-width">Sites are cut-off on the right side when I'm using 640 pixels page width. What can I do?</a></li>
|
|
|
34 |
<li><a href="#layout-broken-pixelpoint-ratio">I've disabled the "Keep screen pixel/point ratio" option and the page layout is completely broken! What can I do?</a></li>
|
|
|
35 |
<li><a href="#layout-broken-black-images">Some images are rendered inside black rectangles!</a></li>
|
|
|
36 |
<li><a href="#layout-broken-horizontal-lines">Horizontal lines (e.g. line under the text) look like they consist of several parts with slightly different width.</a></li>
|
|
|
37 |
<li><a href="#layout-broken-absolute-positioned">My absolute-positioned content is cut at the last page</a></li>
|
|
|
38 |
</ul>
|
|
|
39 |
<li><a href="#output-customize">Customizing output.</a>
|
|
|
40 |
<ul>
|
|
|
41 |
<li><a href="#explicit-break">How could I make an explicit page break?</a></li>
|
|
|
42 |
<li><a href="#headers-footers">How could I add headers or footers to generated Postscript / PDF files?</a></li>
|
|
|
43 |
<li><a href="#hide-headers">I've added headers and footers to my HTML pages, but how I can prevent them from showing up in the browser?</a></li>
|
|
|
44 |
<li><a href="#hires-images">Is there a possibility to create pdf documents with more than 72dpi using html2ps?</a></li>
|
|
|
45 |
<li><a href="#css-media">Can I control media size / margins via CSS?</a></li>
|
|
|
46 |
</ul>
|
|
|
47 |
</li>
|
|
|
48 |
<li><a href="#api">Using script API.</a>
|
|
|
49 |
<ul>
|
|
|
50 |
<li><a href="#api-localfile">How could I convert HTML file from my local drive?</a></li>
|
|
|
51 |
<li><a href="#api-frommemory">How could I convert HTML contained in variable?</a></li>
|
|
|
52 |
<li><a href="#api-security">Can I convert a page using some authentication mechanism using the html2ps webinterface?</a></li>
|
|
|
53 |
<li><a href="#api-relative-path">I'm using API to convert files and images and / or CSS files seems to be ignored.</a></li>
|
|
|
54 |
</ul>
|
|
|
55 |
</li>
|
|
|
56 |
<li><a href="#fonts">Fonts. National symbols.</a>
|
|
|
57 |
<ul>
|
|
|
58 |
<li><a href="#fonts-nonstandard">How can I use fonts other than standard (Times, Helvetica and Courier)?</a></li>
|
|
|
59 |
<li><a href="#fonts-euro">Euro symbol is not displayed. </a></li>
|
|
|
60 |
<li><a href="#fonts-cyrillic-ps">Cyrillic symbols are not displayed in PS output</a></li>
|
|
|
61 |
<li><a href="#fonts-greek-tonos">Greek symbols with tonos are not displayed in PS output; all other greek symbols rendered normally.</a></li>
|
|
|
62 |
<li><a href="#fonts-eastern">Chinese (Japanese, Arabic, etc...) symbols do not show on the page. What I need to do?</a></li>
|
|
|
63 |
<li><a href="#fonts-ttf-cache">I've installed/updated True-Type fonts, but it seems that ... (some mysterious problem) ... happens</a></li>
|
|
|
64 |
</ul>
|
|
|
65 |
</li>
|
|
|
66 |
<li><a href="#forms">Interactive forms.</a></li>
|
|
|
67 |
<li><a href="#frames">Frames.</a></li>
|
|
|
68 |
<li><a href="#misc">Miscellaneous.</a>
|
|
|
69 |
<ul>
|
|
|
70 |
<li><a href="#misc-size">Is it possible to reduce the size of output PDF file?</a></li>
|
|
|
71 |
<li><a href="#misc-filename">Is it possible to use a custom file name when outputting the pdf file?</a></li>
|
|
|
72 |
</ul>
|
|
|
73 |
</li>
|
|
|
74 |
</ul>
|
|
|
75 |
|
|
|
76 |
<div style="border-top: solid black 1px; border-bottom: solid black 1px;">
|
|
|
77 |
<h2 style="text-decoration: underline;">How would I report a bug?</h2>
|
|
|
78 |
<p>
|
|
|
79 |
Use the <a href="http://www.tufat.com/forum/forumdisplay.php?f=59">support forum</a> of tufat.com.
|
|
|
80 |
</p>
|
|
|
81 |
<p>
|
|
|
82 |
Please, provide the following:
|
|
|
83 |
<ul>
|
|
|
84 |
<li><code>phpinfo()</code> output;</li>
|
|
|
85 |
<li>script version (and information about applied patches, if any);</li>
|
|
|
86 |
<li>script parameters you're using for conversion;</li>
|
|
|
87 |
<li><b>full</b> HTML code of the page you're trying to convert.</li>
|
|
|
88 |
</ul>
|
|
|
89 |
The will greatly reduce the time required for solving your issue. Thank you for understanding.
|
|
|
90 |
</p>
|
|
|
91 |
</div>
|
|
|
92 |
|
|
|
93 |
<h2 id="installation">Installation.</h2>
|
|
|
94 |
<dl>
|
|
|
95 |
<dt id="installation-utilities">Does html2ps require any external utilities like ghostscript?</dt>
|
|
|
96 |
<dd>No. PHP with GD extension is sufficient to run conversion. You <em>may</em> use additional
|
|
|
97 |
extensions/utilities to use alternative output methods or to boost conversion speed a little bit, though.</dd>
|
|
|
98 |
<dt id="installation-commandline">Can I call this script from the command line?</dt>
|
|
|
99 |
<dd>Probably yes; check if your PHP support command line interface. Also, consider
|
|
|
100 |
reading this article on php.net:
|
|
|
101 |
<a title="Click to open article in new window" href="http://www.php.net/manual/en/features.commandline.php" target="_blank">
|
|
|
102 |
Using PHP from the command line</a>
|
|
|
103 |
</dd>
|
|
|
104 |
<dt id="installation-version">How can I determine the script version?</dt>
|
|
|
105 |
<dd>Look in config.inc.php for HTML2PS_VERSION_MAJOR, HTML2PS_VERSION_MINOR and HTML2PS_SUBVERSION constants. The full version number is
|
|
|
106 |
MAJOR.MINOR.SUBVERSION. If you cannot find these constants, you're using <em>very old</em> html2ps release.</dd>
|
|
|
107 |
</dl>
|
|
|
108 |
|
|
|
109 |
<h2 id="nooutput">No output at all. Broken output.</h2>
|
|
|
110 |
<dl>
|
|
|
111 |
<dt id="nooutput-regexp">I'm getting "Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Empty string supplied as input" error message in PHP 5.2.0 when attemting to convert some files</dt>
|
|
|
112 |
<dd>A new configuration parameter <tt>pcre.backtrack_limit</tt> was introduced in PHP 5.2.0. html2ps does the excessive
|
|
|
113 |
regexp usage; it is recommended to increase pcre.backtrack_limit value to 1000000.
|
|
|
114 |
</dd>
|
|
|
115 |
|
|
|
116 |
<dt id="nooutput-utf8">Warning: DOMDocument::loadXML() [function.DOMDocument-loadXML]: Input is not proper UTF-8, indicate encoding ....</dt>
|
|
|
117 |
<dd>The page you're trying to convert specifies UTF8 encoding in header / meta tag, but is face uses different encoding. You need
|
|
|
118 |
to switch from "Autodetect" encoding to the real one (in most cases iso-8859-1 will do) if you want to convert such page.</dd>
|
|
|
119 |
|
|
|
120 |
<dt id="nooutput-php442">HTML2PS returns blank page. There's some strange messages in PHP error log, for example:
|
|
|
121 |
<pre>
|
|
|
122 |
Parent: child process exited with status 3221225477 -- Restarting.
|
|
|
123 |
</pre>
|
|
|
124 |
I'm using PHP 4.4.2 </dt>
|
|
|
125 |
<dd>It is a PHP 4.4.2 bug <a href="http://bugs.php.net/bug.php?id=36017">#36017</a>; there's no workarounds
|
|
|
126 |
except changing PHP version or writing your own fetcher without 'fopen' function calls.
|
|
|
127 |
I would recommend either downgrading to earlier 4.4.x versions or installing PHP 5.
|
|
|
128 |
</dd>
|
|
|
129 |
|
|
|
130 |
<dt id="nooutput-memory">All I'm getting is a blank page; no error messages in PHP error log. Whats happened?</dt>
|
|
|
131 |
<dd>
|
|
|
132 |
The script is probably running out of memory or execution time. Try increasing
|
|
|
133 |
the values of <code>max_execution_time</code> and/or <code>memory_limit</code> PHP configuration variables.
|
|
|
134 |
Recommended values are <strong>120</strong> seconds and <strong>32</strong> megabytes. Nevertheless, if you're
|
|
|
135 |
using <em>VERY</em> big images, you'll probably need to increase these values
|
|
|
136 |
even more.
|
|
|
137 |
</dd>
|
|
|
138 |
<dd>
|
|
|
139 |
Another cause may be a JavaScript or META redirect on page you're trying to convert. As HTML2PS script is not designed
|
|
|
140 |
as interactive user agent, it will not follow such redirects for you. You may try to open the url in question in your browser
|
|
|
141 |
and check if the URL will change when page finishes loading. In this case, just supply the final URL to the script.
|
|
|
142 |
</dd>
|
|
|
143 |
<dd>
|
|
|
144 |
Also, please note that domain.com and www.domain.com <em>may</em> point to different sites. In the worst case,
|
|
|
145 |
domain.com (without 'www' part) may just ignore HTTP requests. On the other side, popular browsers try to guess correct
|
|
|
146 |
URL; for example, when you enter 'something' to the address bar, they may try to get something.com or www.something.com.
|
|
|
147 |
This may lead to problem similar to one described in previous paragraph; the solution is the same: open URL in browser and
|
|
|
148 |
check it will change.
|
|
|
149 |
</dd>
|
|
|
150 |
<dd>
|
|
|
151 |
Yet another cause may be browser built-in timeout; in particular, Safari for Windows has a built-in timeout of 60 seconds. In this case
|
|
|
152 |
you will not be able to get the PDF file if conversion takes more than a minute.
|
|
|
153 |
</dd>
|
|
|
154 |
|
|
|
155 |
<dt id="nooutput-memory2">I got the following error message: <tt>Fatal error: Allowed memory size of … bytes exhausted (tried to allocate … bytes) in&hellip</tt></dt>
|
|
|
156 |
<dd>The script is running out of memory. Please refer to <a href="php.net/ini.core">memory_limit PHP.net documentation</a> regarding increasing memory limit.</dd>
|
|
|
157 |
|
|
|
158 |
<dt id="nooutput-php440">The script just hangs when converting page containing images! With "render images" options disabled it works!</dt>
|
|
|
159 |
<dd>There were reports on this problem on Windows recently. A quick investigation showed that for some reason PHP 4.4.0
|
|
|
160 |
sometimes hangs indefinitely <em>inside</em> the 'fsockopen' call. Consider upgrading your PHP version in this case.</dd>
|
|
|
161 |
|
|
|
162 |
<dt id="nooutput-limits">I've increased limits, but still sometimes get a blank page immediately
|
|
|
163 |
after the script starts! Some sites are parsed, though...</dt>
|
|
|
164 |
<dd>Some users encountered this problem using the GD library bundled with PHP.
|
|
|
165 |
While it matched the GD version requirement, it sometimes caused PHP to silently
|
|
|
166 |
die on some images. The problem is solved by recompiling the PHP using the
|
|
|
167 |
external (recent enough) GD library. Note that NOT ALL PHP configurations
|
|
|
168 |
are subject to this problem.</dd>
|
|
|
169 |
|
|
|
170 |
<dt id="nooutput-firefox">I'm getting "PDF doesn't start with "%PDF-" message from
|
|
|
171 |
Acrobat Reader. Nevertheless, when I save file to my hard drive, it opens
|
|
|
172 |
perfectly. I'm using Firefox.
|
|
|
173 |
<dd> There were user reports on issues related to Firefox/Acrobat Reader plugin
|
|
|
174 |
incompatibility. In particular, this problem appeared with Firefox 1.0.7 and
|
|
|
175 |
Reader 6.0.2 PL. You may consider upgrading your software to latest versions
|
|
|
176 |
in this case.</dd>
|
|
|
177 |
|
|
|
178 |
<dt id="nooutput-cache">Some characters are displayed incorrectly or missing.</dt>
|
|
|
179 |
<dd>
|
|
|
180 |
<p>If you've installed, removed or changed font files, you may need to clear
|
|
|
181 |
<tt>cache</tt> subdirectory. HTML2PS do store information extracted from file fonts
|
|
|
182 |
there to reduce script initialization overhead. See also
|
|
|
183 |
"<a href="#fonts-ttf-cache">I've installed/updated True-Type fonts, but it seems that ... (some mysterious problem) ... happens</a>"
|
|
|
184 |
<p>Another cause of this problem may be incorrect source encoding; when encoding is not explicilty specified,
|
|
|
185 |
html2ps tries to take encoding from HTTP headers and META tags. If no encoding information found,
|
|
|
186 |
html2ps assumes iso-8851-1.
|
|
|
187 |
</dd>
|
|
|
188 |
|
|
|
189 |
<dt id="nooutput-file-protocol">I cannot fetch files from local hard disk using 'file' procolol.</dt>
|
|
|
190 |
<dd>
|
|
|
191 |
<p>First of all, please ensure you're providing URL, not the file path; for example, if you're trying to use
|
|
|
192 |
image from <tt>c:\foo\bar\baz.gif</tt>, you'll need to use the following URL: <tt>file:///C:/foo/bar/baz.gif</tt>.</p>
|
|
|
193 |
<p>Second, due the security reasons, files accessed via 'file' protocol are limited to html2ps directory by default. This restriction
|
|
|
194 |
is controlled by <tt>FILE_PROTOCOL_RESTRICT</tt> constant in the <tt>config.inc.php</tt> file. Note that this constant
|
|
|
195 |
contains <em>file path prefix</em>; for example, to use files from <tt>C:\images</tt> directory you'll need to
|
|
|
196 |
store <tt>C:\images\</tt> value in this constant.
|
|
|
197 |
</dd>
|
|
|
198 |
</dl>
|
|
|
199 |
|
|
|
200 |
<h2><a name="layout-broken"></a>Broken layout.</h2>
|
|
|
201 |
<dl>
|
|
|
202 |
<dt id="layout-broken-missing-characters">Some characters are missing in my PDFs on some Acrobat Reader versions / different OSes</dt>
|
|
|
203 |
<dd>Try enabling font embedding (set 'embed' property in html2ps.config to value 1 for fonts used in your documents).</dd>
|
|
|
204 |
|
|
|
205 |
<dt id="layout-broken-width">Sites are cut-off on the right side when I'm using 640 pixels page width. What can I do?</dt>
|
|
|
206 |
<dd> Nothing. Treat this as a feature. Just increase the page width. Most sites
|
|
|
207 |
are <b>NOT</b> designed for such small resolutions and will cause a horizontal
|
|
|
208 |
scrollbar to appear in browser in such cases. </dd>
|
|
|
209 |
|
|
|
210 |
<dt id="layout-broken-pixelpoint-ratio">I've disabled the "Keep screen pixel/point ratio" option and the
|
|
|
211 |
page layout is completely broken! What can I do?</dt>
|
|
|
212 |
<dd> Nothing. Treat this as a feature. If you want to get the layout close to
|
|
|
213 |
the image rendered by the browser, <b>never</b> disable this option. The only
|
|
|
214 |
time you'll need it is when you need to render text having the <b>exact</b>
|
|
|
215 |
size specified in points.</dd>
|
|
|
216 |
|
|
|
217 |
<dt id="layout-broken-black-images">Some images are rendered inside black rectangles!</dt>
|
|
|
218 |
<dd>PNG images with alpha channel are NOT supported. Swicth to single-color transparency, if you need it.</dd>
|
|
|
219 |
|
|
|
220 |
<dt id="layout-broken-horizontal-lines">Horizontal lines (e.g. line under the text) look like they consist of several parts with slightly different width.</dt>
|
|
|
221 |
<dd>Try disabling antialiasing in your PDF reader.</dd>
|
|
|
222 |
|
|
|
223 |
<dt id="layout-broken-absolute-positioned">My absolute-positioned content is cut at the last page</dt>
|
|
|
224 |
<dd>Note that absolute and fixed-positioned content do not generate page breaks (see CSS 2.1. 13.2.3 Content outside the page box). The simplest
|
|
|
225 |
workaround is to add static-positioned div with fixed height.</dd>
|
|
|
226 |
|
|
|
227 |
</dl>
|
|
|
228 |
|
|
|
229 |
<h2><a name="output-customize"></a>Customizing output.</h2>
|
|
|
230 |
<dl>
|
|
|
231 |
<dt><a name="explicit-break"></a>How can I make an explicit page break?</dt>
|
|
|
232 |
<dd>
|
|
|
233 |
You may use <em>one</em> of the following HTML2PS script-specific commands:
|
|
|
234 |
<pre>
|
|
|
235 |
<!--NewPage-->
|
|
|
236 |
<pagebreak/>
|
|
|
237 |
<?page-break>
|
|
|
238 |
</pre>
|
|
|
239 |
Or CSS <em>page-break-after</em> property:
|
|
|
240 |
<pre>
|
|
|
241 |
<div style="page-break-after: always">
|
|
|
242 |
... some content ...
|
|
|
243 |
</div>
|
|
|
244 |
</pre>
|
|
|
245 |
</dd>
|
|
|
246 |
|
|
|
247 |
<dt><a name="headers-footers">How should I add headers or footers to generated Postscript / PDF files?</a></dt>
|
|
|
248 |
<dd>
|
|
|
249 |
You may use one of the following options:
|
|
|
250 |
<ul>
|
|
|
251 |
<li>Use blocks with 'position: fixed'. Pleas note that you probably want to
|
|
|
252 |
set 'top' and 'bottom' properties to negative values to avoid overlapping with
|
|
|
253 |
main content; it is an expected behavior according to HTML/CSS standards.
|
|
|
254 |
(see also a simple <a href="samples/headfoot.html">sample</a>)</li>
|
|
|
255 |
<li>Use "Header" and "Footer" options in web interface or
|
|
|
256 |
PreTreeFilterHeaderFooter filter in API</li>
|
|
|
257 |
<li>Use <a href="compatibility.css.3.html#marginboxes">CSS 3 margin boxes</a>.</li>
|
|
|
258 |
</ul>
|
|
|
259 |
Note that when you use PreTreeFilterHeaderFooter or Header/Footer fields in web interface,
|
|
|
260 |
content is implicitly placed in fixed-positioned div; you may think of this as follows:
|
|
|
261 |
<pre>
|
|
|
262 |
...
|
|
|
263 |
<body>
|
|
|
264 |
<!--header starts-->
|
|
|
265 |
<div style="position: fixed; ....">...your header content...</div>
|
|
|
266 |
<!--header ends-->
|
|
|
267 |
...
|
|
|
268 |
your HTML content
|
|
|
269 |
...
|
|
|
270 |
<!--footer starts-->
|
|
|
271 |
<div style="position: fixed; ....">...your footer content...</div>
|
|
|
272 |
<!--footer ends-->
|
|
|
273 |
</body>
|
|
|
274 |
...
|
|
|
275 |
</pre>
|
|
|
276 |
<p><strong>Important note:</strong> HTML code added via PreTreeFilterHeaderFooter should be (almost) valid XHTML
|
|
|
277 |
(see <a href="http://www.w3.org/TR/xhtml1/#diffs">XHTML 1.0: Differences with HTML 4</a>);
|
|
|
278 |
in particular, all tags / attributes should be in lower case. <em>Almost</em> means that you don't need to specify
|
|
|
279 |
wrapping <tt>html</tt>, <tt>head</tt> and <tt>body</tt> tags for the header content.</p>
|
|
|
280 |
</dd>
|
|
|
281 |
|
|
|
282 |
<dt><a name="hide-headers">I've added headers and footers to my HTML pages, but how I can prevent them from showing up in the browser?</a></dt>
|
|
|
283 |
<dd>
|
|
|
284 |
Use @media css rules setting 'display: none' or 'display: block' for header/footer blocks on different media.
|
|
|
285 |
</dd>
|
|
|
286 |
|
|
|
287 |
<dt><a name="hires-images"></a>Is there a possibility to create pdf documents with more than 72dpi using html2ps?</dt>
|
|
|
288 |
<dd>You may make a page with high-resolution images and set their on-page height and width using
|
|
|
289 |
<code>height</code> and <code>width</code> attributes.
|
|
|
290 |
HTML2PS does not resample images, just outputs them to PDF and provides the scaling factor.
|
|
|
291 |
</dd>
|
|
|
292 |
|
|
|
293 |
<dt id="css-media">Can I control media size / margins via CSS?</dt>
|
|
|
294 |
<dd>
|
|
|
295 |
Yes. Use <a href="compatibility.css.3.html#media">CSS 3 'size' and 'margin'</a> properties. In addition,
|
|
|
296 |
html2ps provides '-html2ps-pixels' property which allows you to override 'pixels' value specified
|
|
|
297 |
in pipeline configuration code.
|
|
|
298 |
</dd>
|
|
|
299 |
|
|
|
300 |
|
|
|
301 |
<dt><a name="pages-batch"></a>##PAGES## directive always displays 1 in batch mode!</dt>
|
|
|
302 |
<dd>Yes, it is a documented feature. ##PAGES## always refer to the number of pages in file being processed.
|
|
|
303 |
</dd>
|
|
|
304 |
|
|
|
305 |
</dl>
|
|
|
306 |
|
|
|
307 |
<h2 id="api">API</h2>
|
|
|
308 |
<dl>
|
|
|
309 |
<dt id="api-localfile">How could I convert HTML file from my local drive?</dt>
|
|
|
310 |
<dd>Use example file in <tt>samples/sample.simplest.from.file.php</tt> as a starting point.</dd>
|
|
|
311 |
<dt id="api-frommemory">How could I convert HTML code contained in a variable?</dt>
|
|
|
312 |
<dd>Use example file in <tt>samples/sample.simplest.from.memory.php</tt> as a starting point.</dd>
|
|
|
313 |
<dt id="api-security">Can I convert a page using some authentication mechanism using the html2ps webinterface?</dt>
|
|
|
314 |
<dd>Out-of-the-box – no. Depending on the type of the authentication you <em>may</em> override the fetcher
|
|
|
315 |
object with your custom one able to bypass authentication. Still, the <strong>recommended</strong> approach
|
|
|
316 |
is html2ps API usage; in this case, you store your HTML code in a PHP variable instead of outputting it to the browser
|
|
|
317 |
and call conversion engine directly.</dd>
|
|
|
318 |
<dt id="api-relative-path">I'm using API to convert files and images and / or CSS files seems to be ignored.</dt>
|
|
|
319 |
<dd>
|
|
|
320 |
Most likely, you're using relative URLs and, at the same time, converting either HTML string from memory or
|
|
|
321 |
local file. In this case script doesn't know the base URL to use while resolving relative paths, so
|
|
|
322 |
these URLs are ignored. You have two options in this case:
|
|
|
323 |
<ul>
|
|
|
324 |
<li>Change relative URI to absolute in your HTML code</li>
|
|
|
325 |
<li>Implement 'get_base_url' function in the fetcher object you're using so it return valid meaningful value.</li>
|
|
|
326 |
</ul>
|
|
|
327 |
</dd>
|
|
|
328 |
|
|
|
329 |
</dl>
|
|
|
330 |
|
|
|
331 |
<h2 id="fonts">Fonts. National symbols.</h2>
|
|
|
332 |
<dl>
|
|
|
333 |
|
|
|
334 |
<dt id="fonts-nonstandard">How can I use fonts other than standard (Times, Helvetica and Courier)?</dt>
|
|
|
335 |
<dd>Follow these <a href="howto_fonts.html" target="_blank">instructions</a></dd>
|
|
|
336 |
|
|
|
337 |
<dt id="fonts-euro">Euro symbol is not displayed</dt>
|
|
|
338 |
<dd>First of all, check if you provided correct information on the file encoding to html2ps; encoding vectors containing euro symbol are
|
|
|
339 |
'iso-8859-15', 'windows-1250', 'windows-1251' or 'windows-1252'. Alternatively, you may use UTF-8 or HTML entities
|
|
|
340 |
&euro; or &8364;.
|
|
|
341 |
</dd>
|
|
|
342 |
|
|
|
343 |
<dt id="fonts-cyrillic-ps">Cyrillic symbols are not displayed in PS output</dt>
|
|
|
344 |
<dd>Install <tt>sharatype-fonts</tt> package to your Ghostscript;
|
|
|
345 |
the script is configured to use these fonts out-of-the-box.
|
|
|
346 |
</dd>
|
|
|
347 |
|
|
|
348 |
<dt id="fonts-greek-tonos">Greek symbols with tonos are not displayed in PS output; all other greek symbols rendered normally.</dt>
|
|
|
349 |
<dd>
|
|
|
350 |
<ul>
|
|
|
351 |
<li>install the unicode postscript .pfb fonts (for example, from <a href="http://canopus.iacp.dvo.ru/~panov/cm-unicode/">http://canopus.iacp.dvo.ru/~panov/cm-unicode/</a>)</li>
|
|
|
352 |
<li>remove the following default 'encoding-override' section from .html2ps.config, as it make greek text to use by default 'Symbol' font lacking 'tonos' symbols:
|
|
|
353 |
<pre>
|
|
|
354 |
<encoding-override name="iso-8859-7">
|
|
|
355 |
<normal normal="Symbol" italic="Symbol" oblique="Symbol"/>
|
|
|
356 |
<bold normal="Symbol" italic="Symbol" oblique="Symbol"/>
|
|
|
357 |
</encoding-override>
|
|
|
358 |
</pre>
|
|
|
359 |
</li>
|
|
|
360 |
<li>
|
|
|
361 |
update "fonts" (NOT "fonts-pdf") section to point to installed fonts, for example:
|
|
|
362 |
<pre>
|
|
|
363 |
<fonts>
|
|
|
364 |
<family name="times">
|
|
|
365 |
<normal normal="CMUSansSerif" italic="CMUSansSerif-Oblique" oblique="CMUSansSerif-Oblique"/>
|
|
|
366 |
</pre>
|
|
|
367 |
</li>
|
|
|
368 |
</ul>
|
|
|
369 |
</dd>
|
|
|
370 |
|
|
|
371 |
<dt id="fonts-eastern">Chinese (Japanese, Arabic, etc...) symbols do not show on the page. What I need to do?</dt>
|
|
|
372 |
<dd>First of all, you'll need fonts containing these symbols; in most cases
|
|
|
373 |
default fonts bundled with Ghostscript or PDFLIB will contain only Western/Central
|
|
|
374 |
European symbols. After you find fonts containing characters you need, you
|
|
|
375 |
should install them instead of the standard fonts, using the answer for this
|
|
|
376 |
question <a href="#fonts">«How can I use fonts other than standard (Times,
|
|
|
377 |
Helvetica and Courier)?»</a></dd>
|
|
|
378 |
|
|
|
379 |
<dt id="fonts-ttf-cache">I've installed/updated True-Type fonts, but it seems that ... (some mysterious problem) ... happens</dt>
|
|
|
380 |
<dd>First of all, clean a "parsed fonts" cache in 'fpdf/font' subdirectory (just remove all files). This could
|
|
|
381 |
solve most font-related issues.</dd>
|
|
|
382 |
</dl>
|
|
|
383 |
|
|
|
384 |
<h2><a name="forms"></a>Interactive forms</h2>
|
|
|
385 |
<dl>
|
|
|
386 |
<dt>When I try to submit the form, Acrobat responds with a "Cannot handle content type: …" message.</dt>
|
|
|
387 |
<dt>Every time I submit the form, I get a strange-looking result page in by browser.</dt>
|
|
|
388 |
<dd>
|
|
|
389 |
PDF interactive forms are not like HTML forms; you MUST modify the server-side script so it return FDF file
|
|
|
390 |
instead of normal HTML in this case.
|
|
|
391 |
See <a href="http://partners.adobe.com/public/developer/pdf/index_reference.html" title="Opens PDF specifications download page at Adobe.com in new window">PDF Reference, v 1.6</a>, page 1026, par. 134 for futher information.
|
|
|
392 |
Also, you may check <a href=""></a> for a brief outline of PDF forms.
|
|
|
393 |
</dd>
|
|
|
394 |
</dl>
|
|
|
395 |
|
|
|
396 |
<h2><a name="frames"></a>Frames</h2>
|
|
|
397 |
<dl>
|
|
|
398 |
<dt>I have a page with frames containing a lot of text, but generated PDF contains only 1 page. Where's my content?</dt>
|
|
|
399 |
<dd>
|
|
|
400 |
As produced PDFs are static, you have no ways to scroll frame content. Thus, only initially visible frame content will be available.
|
|
|
401 |
It is a feature.
|
|
|
402 |
</dd>
|
|
|
403 |
<dt>Some links inside the frames are not active even when I enable "Render Hyperlinks" option.</dt>
|
|
|
404 |
<dd>
|
|
|
405 |
As was stated previously, script may render only a part of frame content. So, if rendered part contains a local hyperlink
|
|
|
406 |
pointing to non-rendered part, this hyperlink will be disabled, as it points to nowhere.
|
|
|
407 |
</dd>
|
|
|
408 |
</dl>
|
|
|
409 |
|
|
|
410 |
<h2><a name="misc"></a>Miscellaneous</h2>
|
|
|
411 |
|
|
|
412 |
<dl>
|
|
|
413 |
<dt id="misc-size">Is it possible to reduce the size of output PDF file?</dt>
|
|
|
414 |
<dd>Yes. By default HTML2PS embeds fonts used during conversion in the generated PDF. You may disable this option by
|
|
|
415 |
setting 'embed' attribute to '0' for these fonts in html2ps.config. Note that it will probably cause problems
|
|
|
416 |
with national symbols on older versions of Acrobat Reader; also, this assumes that users have all fonts used in PDF
|
|
|
417 |
files on their machines. Also, refer to the description of <a href="configuration.html#font_embedding_mode">FONT_EMBEDDING_MODE</a> configuration constant.</dd>
|
|
|
418 |
|
|
|
419 |
<dt>Is it possible to use a custom file name when outputting the pdf file? As of right now, the filename is long ugly string and doesn't look very clean.
|
|
|
420 |
Can I pass the script a varible such as &saveas=thispdffile.pdf and use that for the file name when saving in the browser?</dt>
|
|
|
421 |
|
|
|
422 |
<dd>Yes. If you're using the web interface (html2ps.php file from distribution) you would need to replace
|
|
|
423 |
<code>$g_baseurl</code> with <code>$_REQUEST['saveas']</code> in the following piece of code near the end of html2ps.php:
|
|
|
424 |
<pre>
|
|
|
425 |
switch ($g_config['output']) {
|
|
|
426 |
case 0:
|
|
|
427 |
$pipeline->destination = new DestinationBrowser($g_baseurl);
|
|
|
428 |
break;
|
|
|
429 |
case 1:
|
|
|
430 |
$pipeline->destination = new DestinationDownload($g_baseurl);
|
|
|
431 |
break;
|
|
|
432 |
case 2:
|
|
|
433 |
$pipeline->destination = new DestinationFile($g_baseurl);
|
|
|
434 |
break;
|
|
|
435 |
};
|
|
|
436 |
</pre>
|
|
|
437 |
Also please note that by default output file name can contain only latin letters, digits, '-' and '_' signs,
|
|
|
438 |
any other symbols will be replaced by underscores;
|
|
|
439 |
you may change this behavior by hacking the <code>filename_escape</code> function in <code>destination._interface.class.php</code>.
|
|
|
440 |
<p>
|
|
|
441 |
If you're using API, refer to DestinationBrowser/DestinationDownload/DestinationFile class documentation.
|
|
|
442 |
</dd>
|
|
|
443 |
</dl>
|
|
|
444 |
|
|
|
445 |
</body>
|
|
|
446 |
</html>
|