imagemagick - PDF: How to Optimize Filesize & Convert to PNG (embedded fonts problem) -


i have pdf embedded fonts can't seem work with. right now, i'm using ghostscript , trying 2 things:

  • minimize filesize of pdf:

    gswin32c -dsafer -dbatch -dnopause -dquiet -sdevice=pdfwrite -soutputfile=output.pdf input.pdf

  • convert pdf png (super sample, used creating other thumbnails):

    gswin32c -dsafer -dbatch -dnopause -dquiet -dfirstpage=1 -dlastpage=1 -r288 -sdevice=png16m -soutputfile=output.pdf input.pdf

the above works when working on scanned documents. when run them against pdfs embedded fonts (the pdf generated on fly application), fails. here's error get:

gpl ghostscript 8.71: warning: 'loca' length 274 greater numglyphs 136 n font uughde+arialmt. gpl ghostscript 8.71: warning: 'loca' length 274 greater numglyphs 136 n font uughde+arialmt. gpl ghostscript 8.71: warning: 'loca' length 188 greater numglyphs 93 in  font uughde+arial-boldmt. gpl ghostscript 8.71: warning: 'loca' length 188 greater numglyphs 93 in  font uughde+arial-boldmt. 

aside ghostscript, have access pdftk , imagemagick (which might replaced graphicsmagick). i'm open other solutions.

development on wamp. deployment lamp.

suggestions?

the fonts used inside pdfs seem opentype fonts. software created these pdfs seems have subsetted fonts. during font embedding , subsetting software (which "generates pdfs on fly" -- ghostscript?!?), there seems have occurred problem made not comply 100% specification.

'loca' tables part of opentype font descriptions. represent index glyph locations.

now process these not 'kosher' pdfs ghostscript. ghostscript gives out warnings, no errors.

gs errors mean: "i'll abort further processing. can't work around problem or repair corrupt file. should have written output files already, useless."

gs warnings mean: "i've encountered problem. i'll continue process input , work around it. i've written valid output file. better check it, fidelity!"

the warnings (not errors!) see mean this:

  1. one of subsetted fonts in question claims number of glyphs 188 according table.
  2. but in reality actual font description contains definitions 93 glyph shapes.

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -