[Top][All Lists]

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

Re: Ghostscript/GhostPDL 9.22 Release Candidate 1

From: Ken Sharp
Subject: Re: Ghostscript/GhostPDL 9.22 Release Candidate 1
Date: Tue, 19 Sep 2017 16:32:11 +0100

At 15:11 19/09/2017 +0000, William Bader wrote:

>It would be possible to write a tool which could reliably detect identical fonts in a PDF file,

There are already libraries that can read PDFs into a data structure and then write a new PDF, for example, pdfsizeopt in python, poppler <> and PoDoFo <> in C++, pdfclown <> in .net, PDFBox <> in java, iText <> in java and c#, pdfsam <> in java. Maybe one of them would be suitable as a starting point for writing a font merging tool.

Indeed, and if I was going to do this I would use MuPDF. Note that it will likely be a slow job to run. You can't do the job until you have all the PDF files collected into one, then you need to check each instance of each font to see if its the same as any other font, and remove the other font, updating the relevant Resources dictionaries. Fortunately you don't need to alter any of the content streams. Finally you'd need to rewrite the PDF file with a modified xref and the relevant font streams removed.

Of course, because you have a fixed workflow you *could* simply look for the second and following instances of any font rather than checking them all exhaustively, but I think it would be better to do the job right. Firstly you'd be protected against any further changes in your workflow, and secondly you would have a genuinely useful tool in its own right.

Ghostscript is entirely the wrong tool for that job. Its possible, but I wouldn't want to write the PostScript program for it.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]