This article is meant to help you create a page including embedded links with page numbers for PDF export.
Step-by-step guide
Use the following page hierarchy:
You can find all related documentation at the bottom of this page.
Creating a Custom Stylesheet
Administrators only!
Please note that you have to have administrator rights in order to carry out the below steps.
Create or modify a Custom stylesheet using the following CSS code:
a.embedded-page-link::after{ content: "("target-counter(attr(href), page, decimal)")"; }
Create a user macro with the following settings (image for example, use the code below):
## @noparams #if ( $renderContext.getOutputType().toLowerCase() =="pdf" ) #set($outputHtml= $body.replaceAll(">.*</a>","></a>").replaceAll("<a href=", "<a class='embedded-page-link' href=")) #else #set($outputHtml = $body) #end $outputHtml
Creating a Link
To create a link on the "Embedded link Home" page that links a table at the "Another page in the export" page, do the following steps:
- Edit "Another page in the export" and add an anchor tag to the table:
- Edit "Embedded link Home" and insert the user macro here:
- Add a link to the Link field with the page name and the anchor's name
Link: <Page name>#<AnchorName>
Link text: Any text what you want to see on the page
The final result should look like this:
Print Settings with Content Exporter
- Go to your first exportable page (in this case it is the "Embedded link Home")
- In the page menu click on Export to PDF
- Customize for this export
- Click on Stylesheet (CSS) → Edit
- Select the custom style sheet you created (see Creating a Custom Style Sheet).
- Click on Apply to save your settings
- Select content as desired (in this case the "Current page with all child pages" option has been selected)
- Click on Export
Change results
Change the text on your confluence page by changing the Linked text in the User macro's editable field.
Change the exported text in the PDF by changing your Custom CSS Style (the export result is (<page number>)). Here are some examples on how you can do that:
a.embedded-page-link-see::after{ content: "See on page: " target-counter(attr(href), page, decimal); } a.embedded-page-link-check::after{ content: "Check " target-counter(attr(href), page, decimal) " page."; }
Related articles