[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PDF reader that overrides fonts



On Fri, Jun 06, 2008 at 13:30:17 -0500, Mumia W.. wrote:
> On 06/06/2008 12:02 PM, Florian Kulzer wrote:
>> [...]
>> Here is an extremely quick-and-dirty, I-guarantee-for-nothing (!) bash
>> script to remove embedded fonts. It takes only one argument, the name of
>> the original PDF file, and it generates "...-NOFONTS.pdf". I only tested
>> this on one PDF file that I happened to have lying around, so I have no
>> idea how robust this is:
>>
>> #! /bin/bash
>> TEMPPSFILE="${1%.pdf}-TEMP.ps"
>> FONTS="$(echo $(pdffonts "$1" | awk 'NR>2{print "/"$1}'))"
>> echo ".setpdfwrite <</NeverEmbed [$FONTS]>> setdistillerparams" > "$TEMPPSFILE"
>> pdftops "$1" - >> "$TEMPPSFILE"
>> gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -o "${1%.pdf}-NOFONTS.pdf"  -f "$TEMPPSFILE"
>> rm "$TEMPPSFILE"
>>
>
> I ran Dotan's file through Florian's script, but the resulting file  
> seems to still use the handwriting font.
>
> This is what the $TEMPPSFILE looks like at the top:
>
>> .setpdfwrite <</NeverEmbed [/CHBAKA+TimesNewRomanPSMT /CHBALP+GuttmanYad-Brush /CHBANO+GuttmanYad-Brush /CHBAPN+GuttmanYadLight /CHBBAI+GuttmanYadLight /TimesNewRomanPS-BoldMT /ArialMT /TimesNewRomanPS-ItalicMT /CHBCAA+SymbolMT /CHBKLK+MT-Extra /Arial-BoldMT /CHAPKP+TimesNewRomanPSMT]>> setdistillerparams
>> %!PS-Adobe-3.0
>> %%Creator: xpdf/pdftops 3.01
>> %%LanguageLevel: 2
>> %%DocumentSuppliedResources: (atend)
>
> Perhaps the .setpdfwrite command should be below the %!PS-Adobe-3.0  
> statement, but I wouldn't know where to put it.

It looks like my script did what it was meant to do up to this point.
Unfortunately I don't know much about the inner workings of ghostscript;
I just copied this command from an example given in the ghostscript
documentation. 

I would be interested to know if these fonts are still listed as
embedded if you run pdffonts on the final -NOFONTS.pdf. I will ask
Dotan to send me his original file; maybe there is some document
security option which has to be overridden.

Please let us know if you think of anything else in the meantime; your
earlier suggestion about the ghostscript fonts was what made me realize
that the problem could maybe be solved by using ghostscript to remove
the offending fonts from the PDF.

-- 
Regards,            | http://users.icfo.es/Florian.Kulzer
          Florian   |


Reply to: