Exporting a page to PDF without knowing its page ID

Sapir Ben Baz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 15, 2023

I'm trying to export to PDF a page without knowing its page ID via REST API or the Atlassian Python API. 
I only have its URL. Here's an example of the URL: 

https://my-product.atlassian.net/wiki/spaces/MY-SPACE-NAME/overview

As I only have the URL, without knowing its page ID, I tried understanding how such export can work, and for now it doesn't seem promising. 
I've noticed that when I try to get the space's content, the page I'm looking for is returned. In fact, on this page's _links attribute, there's another attribute called webui whose value is /spaces/MY-SPACE-NAME/overview (in addition to the self page attribute, that returns the actual link of the page https://my-product.atlassian.net/wiki/rest/api/content/PAGE-ID).

Other than getting the space's entire content and start looking for the webui attribute that matches the URL I'm looking for, is there a better option to export the page to PDF?

Thanks everyone in advance!

1 answer

1 vote
Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 15, 2023

Hi @Sapir Ben Baz 

Welcome to the community.

There is no option to export page or space to PDF, Word or HTML via the API.

Al long running open issue at Atlassian can be found here: https://jira.atlassian.com/browse/CONFCLOUD-37995 

You can vote for this, but I don't see this option comming soon

Sapir Ben Baz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 15, 2023

Thank you Marc, good to know. 

I managed though to export a page to PDF with its ID via the Atlassian Python API package. Do you happen to know how the above can be achieved with it?

Like Marc - Devoteam likes this
Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 15, 2023

Hi @Sapir Ben Baz 

Sorry now, as these packages are not Atlassian owned.

I do see this python option in 

# Export page as PDF
# api_version needs to be set to 'cloud' when exporting from Confluence Cloud
.
confluence.export_page(page_id)

As I'm not well evolved in python, II'm afraid I can't help you further on this.

I got the information from here: https://atlassian-python-api.readthedocs.io/confluence.html#page-actions 

Like Rodrigo likes this
Chris Bowen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 8, 2024

@Sapir Ben Baz what you can do is get a list of page IDs from the space, then loop through them for each one. Or you can loop though them and find the one you want. The issue I am having is getting it to get all the data with it such as images.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events