Skip to content

[EPUB] How to set meta data? #383

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

Closed
Shohreh opened this issue Dec 6, 2024 · 1 comment
Closed

[EPUB] How to set meta data? #383

Shohreh opened this issue Dec 6, 2024 · 1 comment

Comments

@Shohreh
Copy link

Shohreh commented Dec 6, 2024

Hello,

I just installed and tried pypandoc, but I can't figure out how to set metadata in the EPUB output file

os.environ.setdefault('PYPANDOC_PANDOC', r'c:\Apps\Pandoc\pandoc.exe')
#print(pypandoc.get_pandoc_version())

#OK output = pypandoc.convert_file(TEMPFILE, 'epub', outputfile=OUTPUTFILE)

#RuntimeError: Pandoc died with exitcode "6" during conversion: Unknown option --metadata title.
#output = pypandoc.convert_file(TEMPFILE,format='html',to='epub',encoding='utf-8',outputfile=OUTPUTFILE, extra_args=['--metadata title=f"{TITLE}"'])

#RuntimeError: Pandoc died with exitcode "6" during conversion: Unknown option --metadata title.
output = pypandoc.convert_file(TEMPFILE,format='html',to='epub',outputfile=OUTPUTFILE, extra_args=['--metadata title="blah"'])

Thank you.

@Shohreh
Copy link
Author

Shohreh commented Dec 6, 2024

Done

extra_args=['--epub-title-page=false','--metadata',f'author={AUTHOR}','--metadata',f'title={TITLE}']
#print("extra_args:",extra_args)
output = pypandoc.convert_file(TEMPFILE,format='html',to='epub',outputfile=OUTPUTFILE, extra_args=extra_args)

@Shohreh Shohreh closed this as completed Dec 6, 2024
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

1 participant