How to embed a pdf file to a page?

Anthony_Benitez July 14, 2017

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

3 answers

1 vote
Richard Isaacs February 23, 2020

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

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.

0 votes
Richard Isaacs February 23, 2020

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

Niels Frederickx February 29, 2020

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

Like Shannon S likes this
jaliya.gunasekera November 3, 2020

Hi,

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

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.
Richard Isaacs November 3, 2020

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.

Philipp Meier November 11, 2020

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.

Kelsey Shimada June 21, 2021

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

Nitika Arora
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 5, 2021

Hi @Kelsey Shimada ,

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

Like Kelsey Shimada likes this
0 votes
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 17, 2017

Hi Anthony,

You will currently be able to use the PDF Macro 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

Topher Hayden June 12, 2019

Why does the macro still exist but not let me use it?

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 13, 2019

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, 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 Plans to remove the view file macros).

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

End of Support Announcements for Confluence

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

Like adickey likes this
Meghanand Baraskar February 5, 2020

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. 

Richard Isaacs February 5, 2020

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.

Like Shannon S likes this
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 6, 2020

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 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

Meghanand Baraskar February 6, 2020

Thank you for your responses Richard and Shannon. @Richard Isaacs 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

Like Shannon S likes this
Richard Isaacs February 6, 2020

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 

Jason Birdsey February 21, 2020

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

Richard Isaacs February 23, 2020

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.

Remko Meijer March 14, 2024

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events