I'd like to automatically export to PDF some confluence pages.
It can be downloaded with URL :
http://<confluence server>/confluence/spaces/flyingpdf/pdfpageexport.action?pageId=<pageID>
When typing this URL, it works perfectly.
But when I try to download with wget
, an HTML page is downloaded instead ( asking for login and password). I tried to provide login/password with --user
and --password
wget options but it does not work.
Do you have an idea to provide confluence credentials to wget
command? Or another solution to download the PDF page?
If you are using a Confluence Server before Confluence 5.5 you are in luck! Confluence has an API to handle this, see their documentation.
Update : If you are using Confluence Server 5.5 or later, they do not enable the API for this by default. See Confluence Administration > Further Configuration to enable the XML-RPC and SOAP APIs. (Thanks @fatpanther for pointing this out)
The new REST API does not support this, see the REST API documentation.
You may be able to use the Confluence Command Line Interface to export to PDF.
First request the resource:
curl -D- -u user:pwd -X GET -H "Content-Type: application/json" "https://your-url/confluence/spaces/flyingpdf/pdfpageexport.action?pageId=12345678"
Extract the "Location" value from the resulting JSON (e.g. grep | cut), then repeat the query with adjusted URL and mime type:
curl -D- -u user:pwd -X GET -H "Content-Type: text/html;charset=UTF-8" "https://your-url/$LOCATION_JUST_EXTRACTED" --output file.pdf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With