Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can i add a "Download as PDF" button to my page?

naime_surenkok January 29, 2018

Dear all,

 

I wonder if there is a way to add a "Download PDF" button to the page. and this button should be able to download the page content and the children pages' content if there is any.

Thanks in advance,

naime

4 answers

0 votes
Aimane SBAI October 6, 2021

@Rick van Twillert (TMC) 

Is there any way to adapt your macro to "Export to csv" option ?

 

Thanks a lot for your help !

Rick van Twillert (TMC) October 7, 2021

Hi @Aimane SBAI , What do you expect as a result when you export a confluence page to csv?

Aimane SBAI October 7, 2021

@Rick van Twillert (TMC)  Thanks for your prompt reply.

I mean export a table in a Confluence page to csv.

Actually this button already exists in the Table filter options (see image below), but I would like to create a new button more visible in the page.

Capture.PNG

Do you have any idea how to achieve this ?

 

Thanks a lot !

Aimane SBAI October 12, 2021

@rick 

Please, do you have any idea how to achieve this ?

 

Thank you so much !

0 votes
Marin Guentchev, MD, PhD July 21, 2020

I use https://html2pdf.site/

You can add and customize their button in your HTML. Pretty simple. You need to use the @media prin and @page CSS rules to make the pdf look good.

0 votes
Thomas Rough _K15t_
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.
February 19, 2018

Hi Naime, 

Had you considered using an app to achieve what you are wanting? If not but you are interested, Scroll PDF Exporter would be able to implement what you require. 

With our app, you are able to style how you export your Confluence content through customizable templates. In addition, you can also define the specific export scope like you need. This means that you can choose to simply export a whole space, a single page or a page and its children.  Furthermore, you can also use Confluence page labels during the export process to further define which pages should be included and/or excluded from the export. 

These preferences can then be added to the Scroll Export Button macro, which is included when you install the app, on your Confluence page. This makes it easy to export your content using your specific customized template and export scope. 

If you are interested in these features or want to learn more about this app, you can do so on the Atlassian Marketplace – you can also start a trial for free. 

Feel free to reach out us if you have any further questions. 

Thanks, Thomas (K15t Software)

0 votes
Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 29, 2018

Hi Naime,

you can create a user macro with that content:

## Macro title: exportpdf

## @noparams

<a href="<your confluence url>/spaces/flyingpdf/pdfpageexport.action?pageId=$content.getIdAsString()">print</a>

This macro genereates a link "print" that calls the export-pdf-function for this particular page. 

Exporting the children also is difficult. For that, I would use the export function in the space administration. 

GG February 19, 2018

For exporting content with Children Pages I recommend Content Exporter for Confluence addon: https://metainf.atlassian.net/wiki/spaces/CEX/pages/53968898/Export+Confluence+pages#ExportConfluencepages-Exportmultiplepages

It has much more flexible export functionalities than the built-in PDF export and it's still easy to use.

Rick van Twillert (TMC) October 10, 2019

@Thomas Schlegel I really like your Macro suggestion, thanks for that! Hope you don't mind I improved it a bit, which I would like to share:

## Macro title: Download as PDF button
## @noparams
<input type="button" onclick="location.href='$config.getBaseUrl()/spaces/flyingpdf/pdfpageexport.action?pageId=$content.getIdAsString()';" class="aui-button aui-button-primary" value="Download as PDF" style="display: inline;" />
 

So it now uses the base URL instead of a hardcoded URL and it displays as a button styled according to Confluence's colour scheme.

Like # people like this
Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 10, 2019

Thank you @Rick van Twillert (TMC)  - great improvement!

Defence Housing Australia August 31, 2020

Hi @Rick van Twillert (TMC) and @Thomas Schlegel 

I'm a BA with some (limited) DEV skills, and I really want to use your combined macro but can't work out how to get it to work.

I've downloaded it as coded above and created the user macro in 7.3.1.

Should it work as is, or do I need to tweak it to make it unique to my URL?

Thanks in advance,

Kathryn.

Rick van Twillert (TMC) October 7, 2021

Apologies for the late reply, I think the way to get the base URL changed, please try the following:

<input type="button" onclick="location.href='$settingsManager.getGlobalSettings().getBaseUrl()/spaces/flyingpdf/pdfpageexport.action?pageId=$content.getIdAsString()';" class="aui-button aui-button-primary" value="Download as PDF" style="display: inline;" />

(tested on Confluence 7.13.0) 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events