Download Efficient portable document

Transcript
US 8,433,997 B1
11
12
the one in $HOME/.texlive2008) and running the updmap
command, the following font map ?les would be created:
pdftex dll4.map Font map ?le forpdfT EX with the base 14
sion level. There is no need to pay attention to this tweak,
because Multivalent recompresses all ZIP streams with maxi
mum effort.
fonts embedded. This is the default.
Generate object streams and cross-reference streams pdf
pdftex ndll4.map Font map ?le for pdfT EX with the base
TEX can generate object streams and cross-reference streams
14 fonts omitted.
to save about 10% of the PDF ?le size, or even more if the ?le
pdftex.map Font map ?le used by pdfT EX by default.
contains lots of hyperlinks. (The actual saving depends on the
Identical to one of the two above, based on the pdftexDown
?le structure.) Example command-line for enabling it (with
loadBasel4 setting.
out line breaks):
dvipdfm dll4.map Font map ?le for dvipdfm(x) with the
pd?atex “\pdfminorversion5
\pdfobjcompresslevel3
base 14 fonts embedded. This is the default.
dvipdfm ndll4.map Font map ?le for dvipdfm(x) with the
\input” doc.tex
base 14 fonts omitted.
If ZIP compression is used to compress the object streams,
dvipdfm.map Font map ?le used by dvipdfm(x) by default.
in some rare cases it is possible to save space by starting a new
Identical to one of the two above, based on the dvipdfm
block within the ZIP stream just at the right points. There is no
need to pay attention to this tweak, because Multivalent gen
erates object streams and cross-reference streams by default.
Encode Type 1 fonts as CFF CFF (Type 2 or / Subtype
DownloadBasel4 setting.
It is possible to specify the base 14 embedding settings
without modifying con?guration ?les or generating .map
?les. Example command-line for pdfT EX (type it without
line breaks):
20
/TypelC) is an alternative, compact, highly compressible
25
binary font format that can represent Type 1 font data without
loss. By embedding vector fonts in CFF instead of Type 1, one
can save signi?cant portion of the PDF ?le, especially if the
document is 10 pages or less (e.g. reducing the PDF?le size
from 200 kB to 50 kB). dvipdfmx does this by default, the
\input” doc .tex
However, this will display a warning “No ?ags speci?ed
for non-embedded font”. To get rid of this, use
other drivers (pdfT EX, dvipdfm, ps2pdf with dvips) don’t
\input” doc .tex
support CFF embedding so far. There is no need to pay atten
tion to this tweak, because pdfsizeopt.py converts Type 1
instead. Get the .map ?le from Extra ?les related to PDF
generation and PDF size optimization. URL http://code
. goo gle.com/p/pdfsizeopt/ source/browse/#svn/trunk/extra.
fonts in the PDF to CFF.
30
The .map ?le syntax for dvipdfm is different, but dvipdfmx
and PDF graphics, the driver is usually not smart enough to
recognize the fonts already embedded, and unify them with
can use a .map ?le of pdfT EX syntax, like this:
dvipdfmx -f pdftex_dll4.map doc.dvi
Please note that dvipdfm loads the .map ?les speci?ed in
dvipdfmx.cfg ?rst, and the .map ?les loaded with the -f ?ag
override entries loaded previously, from the con?guration
35
?le. To have the base 14 fonts omitted, run (without a line
break):
dvipdfmx -f pdftex_ndll4.map
-f dvipdfmx_ndll4_extra.map doc.tex
single font. Thus space wouldbe wasted in the ?nally PDF ?le
containing multiple subsets of the same font, possibly storing
45
waste by using a graphics package implemented in pure TEX
(such as TikZ) or using METAPOST (for which there is
special support in dvips, dvipdfm(x) and pdfT EX to avoid
font and glyph duplication). The package psfrag doesn’t suf
duplicate versions of some glyphs. It is possible to avoid this
Get the last .map ?le from Extra ?les related to PDF gen
rendered bitmap font instead.
fer from this problem either if the EPS ?les don’t contain any
fonts embedded.
There is no need to pay attention to this tweak, because
Sub set fonts Font subsetting is the process when the driver
selects and embeds only the glyphs of a font which are actu
ally used in the document. Font subsetting is turned on by
default for dvips, dvipdfm(x) and pdfT EX when emitting
pdfsizeopt.py uni?es font subsets.
50
glyphs produced by TEX.
2.2 Extra Manual Tweaks on TEX-to-PDF Compilation
This sections shows a couple of methods to reduce the size
of the PDF created by a TEX compilation manually. It is not
necessary to implement these methods if the temporary PDF
the fonts in the main document. Let’s suppose that the docu
ment contains included graphics with text captions, each
graphics source PostScript or PDF having the font subsets
embedded. No matter dvips, dvipdfm(x) or pdfTEX is the
driver, it will not be smart enough to unify these subsets to a
40
eration and PDF size optimization. URL http://code.google
.com/p/pdfsizeopt/ source/browse/#svn/trunk/ extra. Without
dvipdfmx . ndll4 extra.map, a bug in dvipdfm prevents it
from writing a PDF ?le without the fontiit would embed a
Create graphics with font subsetting in mind For glyphs
coming from external sources such as the included PostScript
Disable font subsetting before concatenation If a PDF
document is a concatenation of several smaller PDF ?les
(such as in journal volumes and conference proceeding), and
each PDF ?le contains its own, subsetted fonts, then it
55
depends on the concatenator tool whether those subsets are
uni?ed or not. Most concatenator tools (pdftk, Multivalent,
gets optimized by pdfsizeopy.py+Multivalent, because this
pdfpages, ps2pdf) don’t unify these font subsets.
combination implements the methods discussed here.
Set the ZIP compression level to maximum For pdfT EX,
the assignment \pdfcompresslevel9 select maximum PDF
compression. With TEXLive 2008, this is the default. Here is
how to specify it on the command-line (without line breaks):
However, if you use ps2pdf for PDF concatenation, you
can get font subsetting and subset uni?cation by disabling
font subsetting when generating the small PDF ?les. In this
case, Ghostscript (run by ps2pdf) will notice that the docu
60
ment contains the exact same font many times, and it will
subset only one copy of the font.
There is no need to pay attention to this tweak, because
pd?atex “\pdfcompresslevel9
\input” doc .tex
For dvipdfm(x), the command-line ?ag -z9 can be used to
maximize compression. This is also the default. PDF itself
supports redundancy elimination in many different places
(see in Subsection 2.3) in addition to setting the ZIP compres
pdfsizeopt.py uni?es font subsets.
65
Embed each graphics ?le once When the same graphics ?le
(such as the company logo on presentation slides) is included
multiple times, it depends on the driver whether the graphics