How to embed a pdf file to a page?
Asked by Anthony_Benitez:

Is there a way to embed a pdf file to a page so I can scroll through it without having to open it?


Answers:
author: Richard Isaacs
body: UPDATED! THE BELOW PROCESS HAS BEEN UPDATED (STEP 6) FOLLOWING FEEDBACK AND ISSUES USING DIFFERING BROWSERS.

Hi I thought I would share this option with you that I just found. It is not perfect really just embedding another type of viewer but I think it is better.

Confluence has a pdf preview function which we can access via an iframe.

Here is how:

1. In edit add the pdf file to the page using ctrl + m.

2. Choose the pdf if already attached or upload a new pdf now.

3. Save the page.

4. On the viewing page you will see the pdf as a thumbnail embedded on the page.

5. Click the pdf thumbnail and the advanced pdf viewer will load.

6. **Click the share icon in the viewer bar and then copy the share link.**

![shot.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/84146iEE9E223A5DFEB20B/image-dimensions/894x290?v=v2 "shot.jpg")

7. Edit the page again. Back in the edit screen delete the thumbnail and instead create an html macro and paste the following iframe code in with your url from step 6 replacing ENTER THE URL IN HERE with your url (leave the apostrophes)

\<style\>.embed-container { position: relative; padding-bottom: 100%; height: 0; overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }\</style\>\<div class='embed-container'\>\<iframe src='ENTER THE URL IN HERE' style='border:0'\>\</iframe\>\</div\>

8. Click save

You will now have a fully functioning viewer with download and even pdf edit options.


author: Richard Isaacs
body: UPDATED! THE BELOW PROCESS HAS BEEN UPDATED (STEP 6) FOLLOWING FEEDBACK AND ISSUES USING DIFFERING BROWSERS.

Hi I thought I would share this option with you that I just found. It is not perfect really just embedding another type of viewer but I think it is better.

Confluence has a pdf preview function which we can access via an iframe.

Here is how:

1. In edit add the pdf file to the page using ctrl + m.
2. Choose the pdf if already attached or upload a new pdf now.
3. Save the page.
4. On the viewing page you will see the pdf as a thumbnail embedded on the page.
5. Click the pdf thumbnail and the advanced pdf viewer will load.
6. **Click the share icon in the viewer bar and then copy the share link.** **![shot.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/84148i5FC3BE2F0CDF96FB/image-size/large?v=v2&px=999 "shot.jpg")**
7. Edit the page again. Back in the edit screen delete the thumbnail and instead create an html macro and paste the following iframe code in with your url from step 6 replacing ENTER THE URL IN HERE with your url (leave the apostrophes)

\<style\>.embed-container { position: relative; padding-bottom: 100%; height: 0; overflow: hidden; max-width: 100%; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }\</style\>\<div class='embed-container'\>\<iframe src='ENTER THE URL IN HERE' style='border:0'\>\</iframe\>\</div\>

8. Click save

You will now have a fully functioning viewer with download and even pdf edit options.

comments: author: Niels Frederickx
body: I don't seem to have a html macro .

Did you install seperately?

Edit: Nevermind, I found the solution.

Thanks!

<https://confluence.atlassian.com/doc/html-macro-38273085.html>


author: jaliya.gunasekera
body: Hi,

'Insert PDF Macro' doesn't work. 'Insert' button is disabled. screenshot attached.

![Confluence-add-pdf.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/116895i17ECA02ED6B8628B/image-size/large?v=v2&px=999 "Confluence-add-pdf.jpg")

Mine is Version 86.0.4240.111 (Official Build) (64-bit) .

From the new instructions the step 1 does not work for me.

1. In edit add the pdf file to the page using ctrl + m.


author: Richard Isaacs
body: Hi

The macro seems to indicate it is not finding any appropriate pdfs attached to the page. To fix this, an alternative is view the original page out of edit mode and then drag and drop the pdf onto the page, it will upload as an attachment. Then you should be able to find it in edit mode in the pdf macro.


author: Philipp Meier
body: The Page Name is the name of the confluence page where it is looking for the PDF file. You should leave it blank if you just uploaded it to this page.


author: Kelsey Shimada
body: Hi Richard! Thank you for the description. I am looking at the Share dialog right now, and it seems to be broken. Do you know if I'm doing something wrong, if it's already known, or if I should file myself?

![Screen Shot 2021-06-21 at 11.27.22 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/148305iEBD5F76DA27F4808/image-dimensions/278x307?v=v2 "Screen Shot 2021-06-21 at 11.27.22 AM.png")


author: Nitika Arora
body: Hi [@Kelsey Shimada](/t5/user/viewprofilepage/user-id/1473777) ,

Yes, the sharing layer is broken and it's a known issue that is in progress at the moment.

<https://jira.atlassian.com/browse/CONFCLOUD-72348>

This will be fixed soon.

Regards

Nitika Arora


author: Shannon S
body: Hi Anthony,

You will currently be able to use the [PDF Macro](https://confluence.atlassian.com/doc/pdf-macro-375849180.html) to embed PDF files within a page and view them.

Please be advised this will be removed in future releases.

Let us know if you have any questions!

Kind Regards,

Shannon

comments: author: Topher Hayden
body: Why does the macro still exist but not let me use it?


author: Shannon S
body: Hello Topher,

Welcome to Atlassian Community! Thank you for contacting us.

***You should still be able to use the PDF Macro at this time. If you are having any issues with it, please elaborate on that so we can help you to solve your issue.***

I wanted to let you know more about why I told Anthony that the macro would eventually be deprecated.

The PDF Macro is part of the [View File Macro](https://confluence.atlassian.com/doc/view-file-macro-170494360.html), which is the macro in Confluence Server that allows users to preview file attachments within Confluence.

We had previously made a decision to deprecate that macro (see [CONFSERVER-39829](https://jira.atlassian.com/browse/CONFSERVER-39829) *Plans to remove the view file macros* ).

However, as of 22 January 2019, ++we reversed that decision++:

[End of Support Announcements for Confluence](https://confluence.atlassian.com/doc/end-of-support-announcements-for-confluence-210239673.html?_ga=2.87610142.725260564.1560240685-1483961444.1556008674#EndofSupportAnnouncementsforConfluence-DeprecatedmacrosforConfluence(13November2015))
> **Update 22 January 2019**   
> We know from your feedback that the existing View File macros provide important functionality that the newer file upload and preview experience does not. For this reason, we've decided to **reverse the decision to stop supporting these macros**.
>
> This means from Confluence 6.14, we will fix bugs relating to these macros, and will not remove the macros from Confluence.

I hope that clarifies things, but if you are still having an issue with it, I'd love to know more about it so I can help you out.

Regards,

Shannon


author: Meghanand Baraskar
body: Hello Shannon,

We are using cloud version of Confluence and the problem we are facing is as below. We have uploaded some pdf documents on a single confluence page (say page 'Repo'). We then have other pages where we want to display selected pdf documents from the Repo page. We tried using the pdf macro and gave reference to Repo page. It lists the available pdf documents but we cannot Save this to make these documents available on the target pages.

Business case is we store results (as pdf) of testing performed for our releases on Repo page. We have separate pages for each release where we want to reference to the appropriate result pdf.


author: Richard Isaacs
body: Have you tried my solution above? If you use steps 1 to 5 it will embed a pdf icon on the page. You should be able to embed a pdf from any page using more or less this process.


author: Shannon S
body: Hi Meghandand,

Thank you for getting in touch. You can try Richard's suggestion, and if you have any trouble, I would recommend either raising a new question, or [creating a support ticket](https://support.atlassian.com/contact) if you have a support license.

The reason being is that the original question here is a lot older, so the rest of the Community might not see that you're struggling. By raising a new question more of us can help you out. :)

Regards,

Shannon


author: Meghanand Baraskar
body: Thank you for your responses Richard and Shannon. [@Richard Isaacs](/t5/user/viewprofilepage/user-id/1136015) I did try out your suggestion but I somehow don't get the URL specific to the PDF from your step 6 above. Hence when I provide that URL to the iframe macro the entire confluence page hosting the PDF gets displayed. Maybe I am doing something silly. I would create a new thread as suggested by Shannon.

Regards,

Meghanand


author: Richard Isaacs
body: Hi Meghanand. Are you opening the pdf by clicking the thumbnail? When you do that you should get the pdf loaded in a viewer with a black frame. The url should look something like this [https://yoursite.com.au/display/area/titleofdocument.pdf](https://yoursite.com.au/display/area/titleofdocument.pdf?)


author: Jason Birdsey
body: When I insert the PDF, save, then click the thumbnail, the URL does not change. It's the same as the host page.

(EDIT) Nevermind, I got it to work using the Macro


author: Richard Isaacs
body: Hi everybody, thanks for the feedback. I have found the issue, it is a difference in browser setups. I have adjusted the instructions now so it should work on all browsers. See the instructions below.


author: Remko Meijer
body: It seems that share down not give you a link anymore? only send to name, group or email is available.


Tags: atl-gruland

pdf