[tex-live] Making texts externally replaceable in PDFs, e.g. with sed(1)

Osipov, Michael michael.osipov at siemens.com
Mon Dec 17 12:15:54 CET 2018

Am 2018-12-17 um 12:02 schrieb Zdenek Wagner:
> po 17. 12. 2018 v 11:42 odesílatel Osipov, Michael
> <michael.osipov at siemens.com> napsal:
>> Am 2018-12-17 um 11:34 schrieb Ulrike Fischer:
>>> Am Mon, 17 Dec 2018 10:59:04 +0100 schrieb Osipov, Michael:
>>>>>>> You could create a tfm and a type1 font from you font.
>>>>>> That would be a whole new ground for me. I need to discuss this with our
>>>>>> project lead who is proficient in LaTeX and can tell whether this is worth
>>>>>> the effort or not.
>>>>>      That honestly sounds like a considerably better technical solution in
>>>>> the context that you’ve described.
>>>> This is something I fully agree. The solution is straight forward and
>>>> clean.
>>> I'm not sure. It would work but at the end you are including a
>>> non-unicode-font.
>>> I would include a representative string (1234567890abcd...)
>>> somewhere outside the viewport, use this to identify the correct hex
>>> numbers and then exchange the hex.
>> Yep, this is what I had in mind a couple of days ago. Still, the
>> exchange has to be performed by the target service which I do not
>> control. I don't consider them to read the PDF spec like me and replay
>> this approach.
>> We likely will consider the non-Unicode font for only this case. WE just
>> need \d, A-Z and maybe % or alike.
> The advantage of QPDF is that it can read any PDF (even with
> compressed streams), convert them to the QPDF mode which is
> uncompressed and the xref table does not matter, you can exchange your
> stream, include a font (if needed) and have the result converted back
> to a real PDF which can even be compressed, the tables will be
> automatically recalculated. I think that the stream can be replaced in
> the QPDF mode just by text manipulations using sed, awk etc, it will
> not be necessary to compile a new binary base on the QPDF library.

Correct, with some custom code I could add the Type 1 font object, 
search for the BT/ET and replace with Tj parts as well as the /F font 
ref. That still makes quite a lot of work for a simple task.
I haven't found a command to leave the QDF mode. All I see is
1. qpdf --qdf-mode ...
2. Change file
3. fix-qdf ... (recalculates stream lengths and xref table)
4. ...Where is --leave-qdf-mode?


More information about the tex-live mailing list