[tex-live] Supplied a custom PDF trailer ID with XeLaTeX/xdvipdfmx

Osipov, Michael michael.osipov at siemens.com
Sat Dec 15 01:13:44 CET 2018


Hi folks,

we are producing PDFs with XeLaTeX (TL 2018) which already have a UUID 
set in the XMP stream of the PDF (by the backend service via hyperxmp). 
I noticed that the PDF trailer contains an ID too which is a 16-byte 
long string, just like the UUID sans hyphens. I would like to write the 
very same UUID to it instead of the MD5-hashed one. According to the 
spec, this is fine.

Looking through the net I didn't find an option to do so with XeLaTeX 
and xdvipdfmx. Ideally, I would provide this with hypersetup: 
pdftrailerid={...}, but I could also live with a param for xdvipdfmx.

Looking at the source code of dvipdfm-x I see pdf_set_id(pdf_obj *), 
pdf_enc_id_array(), pdf_enc_compute_id_string(char *, char *, char *) as 
well as the static sec_data structure which contains "unsigned char 
ID[16]". That'd be perfect to write to.

Is that feasible, if yes which route? via LaTeX source code or via cmd 
for the driver? One could of course modify dvipdfmx.c for a new param, 
but I don't know the system well enough to tell whether this is a smart 
approach or not.

I'd like to avoid to iterate over the PDF with sed(1) or a Java 
BufferedReader just to replace "/ID[<HEX><HEX>]".

Ideas?

Regards,

Michael


More information about the tex-live mailing list