Unicode in the footer does not wotk

Viewed 34

I'm using the following snippet to add a footer to a PDF document. It works fine, but although I have the UNCODE working in the PDF document, it does not work in the footer. Otherwise what I ADDED to the document.

gs -q -dNOPAUSE \
  -sDEVICE=pdfwrite \
  -sOUTPUTFILE=output.pdf \
  -c '<< /EndPage \
        { exch pop 0 eq dup \
          { /CharterRegular 10 selectfont \
            /ms {moveto show} bind def \
            (J'aime le café) 40 40 ms \
          } if \
        } bind \
      >> setpagedevice' \
  -dBATCH input.pdf \

Any idea?

Thanks in advance

1 Answers

PDF does not generally use UTF-8 so it should fail as a PostScript command. This use of basic western characters can be a challenge to ensure the font is available or folder is defined or substituted in the fontmap.gs AND possibly Unicode charmap is correctly identified in octal. One unicode source I found for windows (unsure if 100% relevant) has

0xE9 0x00E9 #LATIN SMALL LETTER E WITH ACUTE so in octal that is \351

and this "works for me"

Note there are windows specific differences but those should be easily Portable, but I used MS Arial for testing. current GS 9.55/9.56 may need -dNEWPDF=false and do not use -q until testing is done.

gswin32c -sDEVICE=pdfwrite -dNEWPDF=false -sFONTPATH="C:\Windows\Fonts" -o"french.pdf" -c "<< /EndPage { exch pop 0 eq dup { /Arial 10 selectfont /ms {moveto show} bind def (J'aime le caf\351) 40 40 ms } if } bind >> setpagedevice" -f input.pdf

enter image description here

Later edit found an old CharterITCReg.ttf lurking about but note the difference in naming and only found that by trail [sic] and error.

gs9.56.1\bin>gs -dNEWPDF=false -sDEVICE=pdfwrite -sFONTPATH=c:\usr\myfonts\ -ofrench.pdf -c "<< /EndPage { exch pop 0 eq dup { /CharterITC-Regu 10 selectfont /ms {moveto show} bind def (J'aime le caf\351) 40 40 ms } if } bind >> setpagedevice" -f in.pdf

enter image description here

Related