Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing metadata with wkhtmltopdf #6558

Closed
aflueckiger opened this issue Jul 23, 2020 · 6 comments
Closed

missing metadata with wkhtmltopdf #6558

aflueckiger opened this issue Jul 23, 2020 · 6 comments

Comments

@aflueckiger
Copy link

aflueckiger commented Jul 23, 2020

When converting files with wkhtmltopdf, the metadata is not propagated to the resulting pdf.

To reproduce the issue, try:

pandoc -t html5 -s in.md -o out.pdf \
--css css/style.css \
-V title-meta="test"

Versions:
wkhtmltopdf 0.12.5
pandoc 2.9.2.1

On the opposite, converting markdown files directly into pdf works as expected:

pandoc -s in.md -o out.pdf \ 
-V title-meta="test"

The circumvention of wkthtmltopdf above is not an option since css styling is no longer possible.
I guess the missing metadata is due to a lacking implementation rather than a bug. If I am wrong, please correct me.

@mb21
Copy link
Collaborator

mb21 commented Jul 23, 2020

you're looking for the title as part of the PDF metadata? if so, you'd need to pass that option to wkhtmltopdf

pandoc -t html5 -s in.md -o out.pdf \
--pdf-engine-opt='--title test'

it's something pandoc could be change to do itself probably..

@aflueckiger
Copy link
Author

aflueckiger commented Jul 23, 2020

Yes, I would like to set the PDF metadata using pandoc. Besides title, there is a need for author, keywords and date as well. However, it seems that wkhtmltopdf still lacks this functionality: wkhtmltopdf/wkhtmltopdf#2000

Moreover, I couldn't get your example work:

pandoc -t html5 -s in.md -o out.pdf \
--pdf-engine-opt='--title test'
[WARNING] This document format requires a nonempty <title> element.
  Defaulting to 'letter' as the title.
  To specify a title, use 'title' in metadata or --metadata title="...".
Unknown long argument --title "test"
...

I guess the easiest is to do it post-hoc with exiftool.

@mb21
Copy link
Collaborator

mb21 commented Jul 23, 2020

ah sorry, probably it's:

--pdf-engine-opt='--title' --pdf-engine-opt='test'

@jgm
Copy link
Owner

jgm commented Jul 23, 2020

If wkhtmltopdf lacks the functionality, then I don't see any way to improve things in pandoc.
Should this be closed?

@mb21
Copy link
Collaborator

mb21 commented Jul 24, 2020

wkhtmltopdf can set the title, but not other metadata like author...

@aflueckiger
Copy link
Author

Currently, there is no way to improve as wkhtmltopdflacks the functionality to set all metadata. Use exiftool instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants