Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: reverse interval operations



On 2010-01-22 12:27:58 +0100, Marco Nehmeier wrote:
> Arnold Neumeier informed me about some printing problems with my
> motion and it seems there is a problem with my ps to pdf
> transformation at my linux system.

Perhaps because of bitmap fonts.

> Here is a second try (with pdflatex).
> Hopefully it works.

This document contains bitmap fonts (Type 3):

$ pdffonts document.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
[none]                               Type 3            yes no  no       4  0
[none]                               Type 3            yes no  no       5  0
[none]                               Type 3            yes no  no       6  0
[none]                               Type 3            yes no  no       7  0
HHNWDI+CMMI12                        Type 1            yes yes no       8  0
FGSELX+CMR12                         Type 1            yes yes no       9  0
TZEYKI+CMSY10                        Type 1            yes yes no      10  0
[none]                               Type 3            yes no  no      11  0
[none]                               Type 3            yes no  no      12  0
LPTBFR+CMSY8                         Type 1            yes yes no      13  0
PXOHER+CMR8                          Type 1            yes yes no      14  0
JYDBGW+MSBM10                        Type 1            yes yes no      15  0
[none]                               Type 3            yes no  no      23  0
[none]                               Type 3            yes no  no      24  0
[none]                               Type 3            yes no  no      25  0
[none]                               Type 3            yes no  no      48  0

They look strange under Linux, and this is even worse under Mac OS X.
I suggest that the following be used:

\usepackage[T1]{fontenc}
\usepackage{lmodern}

Warning: the PDF files generated by pdflatex are quite big due to
lack of font optimization. You may want to use the attached pdfcrush
script (if you want PDF metadata to be preserved, you also need a
recent version of pdftk).

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)
#!/bin/sh

# pdfcrush -- Optimize the use of the fonts in a PDF file by using ps2pdf.
# Copyright (C) 2005-2009 Vincent Lefevre
#
# Warning! pdfcrush overwrites the files given in argument, and
# in some cases, the result can be bigger than the original PDF
# file (and sometimes look different).
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see http://www.gnu.org/licenses/
# or write to the Free Software Foundation, Inc., 51 Franklin St,
# Fifth Floor, Boston, MA 02110-1301, USA.

echo 'This is $Id: pdfcrush 34386 2010-01-12 14:17:55Z vinc17/ypig $' | \
  sed -e 's/.Id: //;s/Z .*//'

if [ $# -eq 0 ]; then
  echo "Usage: pdfcrush <file.pdf> ..." >&2
  exit 1
fi

set -e
err=0

# Directory for temporary files. Note: to avoid data loss in case of
# problem (e.g. reboot at the wrong time), this directory should not
# be relative to /tmp; so, let's use /var/tmp (the current directory
# may be a bad idea and may not be writable).
tmpdir=`mktemp -d /var/tmp/pdfcrush-XXXXXXXX`

trap 'rm -rf $tmpdir' 0
tmpinfo="$tmpdir/info"
tmppdf1="$tmpdir/crushed.pdf"
tmppdf2="$tmpdir/final.pdf"

keys='Creator|CreationDate|Title|Subject|Keywords|Author'

# pdftk will be used to restore the metadata, if available.
# Warning! The official pdftk 1.41 version is broken; you may
# need the handle_utf8_data_in_update_info patch from Debian.
pdftkv=`pdftk --version 2> /dev/null || true`

for i in "$@"
do
  if file "$i" | grep -q 'PDF document'; then
    if [ -n "$pdftkv" ]; then
      printf "Getting metadata of file %s\n" "$i"
      pdftk "$i" dump_data | perl > "$tmpinfo" -CO -ne \
        "/^InfoKey: ($keys)\$/ or next; print; \$_ = <>;
         /^InfoValue: / or die; s/&#(\\d+);/chr\$1/eg; print"
    fi
    printf "Crushing file %s\n" "$i"
    ps2pdf "$i" "$tmppdf1"
    if [ -n "$pdftkv" ]; then
      printf "Restoring metadata of file %s\n" "$i"
      pdftk "$tmppdf1" update_info "$tmpinfo" output "$tmppdf2"
    else
      echo "pdftk not found; metadata not modified."
      mv "$tmppdf1" "$tmppdf2"
    fi
    trap 'if [ $? = 0 ]; then rm -rf $tmpdir; \
                         else echo "Backup in $tmpdir"; fi' 0
    mv -f "$tmppdf2" "$i"
    trap 'rm -rf $tmpdir' 0
    printf "Successfully processed file %s\n" "$i"
  else
    printf "Skipping %s (not a PDF file)\n" "$i" >&2
    err=2
  fi
done

exit $err