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

Osipov, Michael michael.osipov at siemens.com
Mon Dec 17 11:01:06 CET 2018



Am 2018-12-14 um 21:31 schrieb Zdenek Wagner:
> Hi,
> 
> the biggest problem is that fonts are usually embedded as a subset so
> you can replace the text cintaining the embedded characters. The text
> must have the same length bcause the adresses of streams and other
> objects must remain unchanged. For modifications of a PDF file I would
> suggest QPDF: http://qpdf.sourceforge.net/
> I have not tried it myself but it seems capable of such transformatins.

True, I already noticed this and replied to Ulrike. Figured QPDF already 
out myself, I need to see how it can really help me. Though, it adds 
complexity to the process.

Michael

> Zdeněk Wagner
> http://ttsm.icpf.cas.cz/team/wagner.shtml
> http://icebearsoft.euweb.cz
> 
> pá 14. 12. 2018 v 20:21 odesílatel Ulrike Fischer <news3 at nililand.de> napsal:
>>
>> Am Fri, 14 Dec 2018 16:50:17 +0100 schrieb Osipov, Michael:
>>
>>
>>> So for a sed(1)-based postprocessor it is virtually impossible to map
>>> "<0008002700320026002c00270008>" to "%DOCID%" w/o analyzing the PDF objects.
>>
>> I don't understand this. Where is the difference between
>> <0008002700320026002c00270008> and (%DOCID%)? Both is a quite unique
>> string.
>>
>>
>>
>>>
>>> Requesting XeLaTex to produce
>>>> Td[(%DOCID%)]TJ ET
>>>
>>> will not work
>>
>> It is easy:
>>
>> \documentclass[12pt,a4paper]{article}
>>   \special{dvipdfmx:config z 0} %uncompress pdf
>>
>>   \begin{document}
>>
>>   {\fontencoding{OT1}\ttfamily \%DOCID\%
>>    \makebox[0pt]{%
>>     \raisebox{5cm}[0pt][0pt]{1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ}}%
>>   }
>>
>>   bllb
>>
>>   \end{document}
>>
>> This gives -68.742 Td[(%DOCID%)]TJ in the pdf.
>>
>> The chars in the raisebox are there so that the chars perhaps needed
>> for the replacement are also in the pdf.
>>
>> Be aware that you must exchange the same number of chars. %DOCINFO%
>> can be replaced by 7 other chars, but not less or more or the xref
>> table will be faulty.
>>
>> --
>> Ulrike Fischer
>> https://www.troubleshooting-tex.de/
>>
> 


More information about the tex-live mailing list