-
Notifications
You must be signed in to change notification settings - Fork 636
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
Exporting as pdf #1332
Comments
You should open file as |
Thanks for helping out, unfortunately, I am still getting a corrupted file... |
Quick check on this, I have tested the code and it is able to generate the pdf for me. Sharing the code snippet which worked for me from atlassian import Confluence
def save_file(content, title):
file_pdf = open(title + ".pdf", "wb")
file_pdf.write(content)
file_pdf.close()
print("Completed")
secret_key="<your_confluence_secret_key>"
label = "apitesting"
confluence = Confluence(
url='https://<your_confluence_url>',
token=secret_key)
pages = confluence.get_all_pages_by_label(label=label, start=0, limit=10)
for page in pages:
response = confluence.get_page_as_pdf(page["id"])
save_file(content=response, title=page["title"]) Also I have used adobe acrobat to verify the files |
I have a problem with the export API.
|
@frankiedrake It could be possible that your confluence API url is incorrect. thats why you are seeing Login page as HTML result. |
Hi,
Trying to export as pdf, but only getting an empty pdf.
`def save_file(content, title):
file_pdf = open(title + ".pdf", "w")
file_pdf.write(content)
file_pdf.close()
print("Completed")
if name == "main":
label = "apitesting"
pages = confluence.get_all_pages_by_label(label=label, start=0, limit=10)
for page in pages:
response = confluence.get_page_as_pdf(page["id"])
save_file(content=response, title=page["title"])`
Error message suggests write() argument must be str, not bytes.
Any clues?
The text was updated successfully, but these errors were encountered: