latex3 / pdfresources

LaTeX PDF resource management
LaTeX Project Public License v1.3c
23 stars 7 forks source link

Issues with date settings / hypersetup #26

Closed igreil closed 2 years ago

igreil commented 3 years ago

When I create a PDF/A compliant document, I am unable to set the date via a command, like so:

\newcommand*{\MyAuthor}{Nomen Nescio}
\newcommand*{\MyDate}{D:20010101000000}

\hypersetup{
    pdftitle={Foobar},
    pdfauthor={\MyAuthor},
    pdfcreationdate={\MyDate},
    pdfmoddate={D:20010101000000},
}

Note how the behavior between pdfauthor and pdfcreationdate etc. is different. What gets written to the file is literally MyDate. pdfmoddate on the other hand works. Surely that's not by design?

u-fischer commented 3 years ago

please always make a complete example. That makes it easier to test. But beside this. Why are you setting the creation date? That is normally not needed.

igreil commented 3 years ago

Because I am control freak, probably :-) … That said, it's supposedly legal and I've done it in my previous setup, i.e. without using pdfmanagement-testphase. I have been unable to attach a full .tex file to show the behavior, so I am resorting to copy & paste:

% !TeX program  = lualatex

\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{pdfstandard=A-2U}

\documentclass{article}

\usepackage{fontspec}
\usepackage{hyperxmp}
\usepackage[pdfa]{hyperref}   

\newcommand*{\MyAuthor}{Nomen Nescio}
\newcommand*{\MyDate}{D:19801201000000+01'00'}

\hypersetup{
    pdftitle={Foobar},
    pdfauthor={\MyAuthor},
    pdfcreationdate={\MyDate},
    pdfmoddate={D:19801201000000+01'00'},
}

\pdfvariable omitcidset=1

\begin{document}

Lorem ipsum dolor sit amet, consectetaur adipisicing elit, sed do eiusmod 
tempor incididunt ut labore et dolore magna aliqua. 
\end{document}
u-fischer commented 3 years ago

well creationdate should show the date when the pdf was created, if you change it, you are basically lying. We use that for regression tests to get reproducible results but real documents shouldn't need it.

Well currently the value is passed unchanged (and this is documented). I could reconsider this, but it won't change in the next days, as I just uploaded a new version.

igreil commented 3 years ago

… if you change it, you are basically lying.

I see your point, even though I probably wouldn’t express it quite so dramatically. It affects all dates, by the way, i.e. pdfdate, pdfcreationdate and pdfmoddate. (pdfmetadate no longer seems to work at all.) I understand how one could argue that the user shouldn't have to change those dates in the first place, but then it probably shouldn't be supported directly neither. What tripped me up was the different behavior between pdfauthor and pdfdate.

Well currently the value is passed unchanged (and this is documented). I could reconsider this, but it won't change in the next days, as I just uploaded a new version.

That's fine, and if you consider it documented behavior and a feature, so be it. Just wanted you to be aware of this.

u-fischer commented 3 years ago

pdfdate is not a hyperref key. Its value is passed (unchanged) to hyperxmp, there is no pdfmetadate key. But yes, I think there isn't a reason not to expand the value, so I will change this.

u-fischer commented 2 years ago

This is fixed in newer versions.