> For the complete documentation index, see [llms.txt](https://docs.meta-inf.hu/content-exporter-confluence/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.meta-inf.hu/content-exporter-confluence/user-guides/before-exporting/embedded-links-with-page-number.md).

# Embedded links with page number

This section explains how to create a page that includes embedded links with page numbers for PDF export.&#x20;

For more information, see the following:

[Custom stylesheet](/content-exporter-confluence/user-guides/before-exporting/custom-stylesheets/stylesheet-administration.md)

[User macro](https://confluence.atlassian.com/doc/writing-user-macros-4485.html)

[Anchors](https://confluence.atlassian.com/doc/anchors-139442.html)

## Creating a page including embedded links with page number <a href="#embeddedlinkwithpagenumber-step-by-stepguide" id="embeddedlinkwithpagenumber-step-by-stepguide"></a>

**Before you begin**: Use the following page hierarchy.

![](/files/QDnz6kVbrzoGer62xljI)

### Creating a Custom Stylesheet <a href="#embeddedlinkwithpagenumber-creatingacustomstylesheet" id="embeddedlinkwithpagenumber-creatingacustomstylesheet"></a>

{% hint style="warning" %}
**Important:** You need administrator rights in order to carry out the following steps.
{% endhint %}

1\. Create or modify a custom stylesheet using the following CSS code:

```css
a.embedded-page-link::after{
    content: "("target-counter(attr(href), page, decimal)")";
}
```

2\. Create a user macro with the following example settings.

![](/files/F8X4LISAMpabF6taET7n)

```velocity
## @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 <a href="#embeddedlinkwithpagenumber-creatingalink" id="embeddedlinkwithpagenumber-creatingalink"></a>

Follow these to create a link on the **Embedded link Home** page that links a table at the **Another page in the export** page.

1\. Edit **Another page in the export** and add an **Anchor** tag to the table:

![](/files/jly0l5TbP6HqMY0ayaAF)

![](/files/vNBxkot8Bv9qEyjv4lhy)\
\
\ <br>

2\. Edit **Embedded link Home** and insert the user macro here:<br>

![](/files/pyQkSYU52jSoAxvnghM9)

3\. 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.

![](/files/9iwcYoetfNeD9OTxOLJo)

**Result**: You setting should look like this:

![](/files/IHai2MfbZ4X1ZDKe1Dl8)

### Printing settings with Content Exporter <a href="#embeddedlinkwithpagenumber-printsettingswithcontentexporter" id="embeddedlinkwithpagenumber-printsettingswithcontentexporter"></a>

1. Go to your first exportable page (which in this case it is  **"Embedded link Home"**).
2. In the page menu click on **Export to PDF.**
3. Customize for this export.
4. Click on **Stylesheet (CSS)** → **Edit**.
5. Select the custom style sheet you created (See [Creating a Custom Stylesheet](#embeddedlinkwithpagenumber-creatingacustomstylesheet)).
6. Click on **Apply** to save your settings.
7. Select content as desired.
8. Click on **Export**.

### Changing results <a href="#embeddedlinkwithpagenumber-changeresults" id="embeddedlinkwithpagenumber-changeresults"></a>

You can change the text on your Confluence page by changing the Linked text in the user macro's editable field.&#x20;

You can change the exported text in the PDF by changing your **Custom CSS Style** (the export result is (\<page number>)).&#x20;

Here are some examples on how you can do that:

```css
a.embedded-page-link-see::after{
    content: "See on page: " target-counter(attr(href), page, decimal);
}
```

```css
a.embedded-page-link-check::after{
    content: "Check " target-counter(attr(href), page, decimal) " page.";
}
```
