Andrey Smyntyna
Andrey Smyntyna

Reputation: 71

Ghostscript loses font while extracting the page from PDF

I split PDF into pages with help of usable command line:

for G in $(seq 1 $(pdfinfo 47.pdf | sed -n 's/Pages:[^0-9]*\([0-9]*\).*/\1/p')) ; do 
   gs \
    -dSAFER \
    -sDEVICE=pdfwrite \
    -dBATCH \
    -dNOPAUSE \
    -dFirstPage=$G \
    -dLastPage=$G \
    -o $G.pdf \
     47.pdf ;
done

But some pages appears without text (Graphics are still present)

So, I have tried to extract embedded font from PDF:

gs -q -dNODISPLAY extractFonts.ps -c "(47.pdf) extractFonts quit"

These fonts I have installed in system Fonts folder.

After that, I have repeat splitting and no changes were happened.

How-to be sure that pages will be extracting correctly, I have no idea now.

Upvotes: 0

Views: 715

Answers (1)

KenS
KenS

Reputation: 31141

Ghostscript and pdfwrite are not actually intended for the purpose of splitting PDF files up, there are other tools which will probably work better, why not try pdftk ?

If you really want to use Ghostscript then I would advise you to get hold of the latest bleeding-edge code from the Git repository, in that code the pdfwrite device will accept an output file name containing a '%d' and will write one file per page.

Beyond that, it seems most likely to me that you are simply experiencing a bug, rather than 'losing the font', if the font was missing the text would still be ther but in a differnt font. Which version of GS are you using ?

Upvotes: 2

Related Questions