Insert pdf as a printout in wiki

LabKey Support Forum
Insert pdf as a printout in wiki chelsea st germain  2023-04-14 15:29
Status: Active
 

How do you insert a pdf or image into the wiki page? I've tried the following with no luck:

This doesn't work at all, this image file is just added as an attachment:

<img src=""final graph_LT_P_10.jpg">

This also doesn't work, and throws an error about an illegal element:

<!-- update web address for where pdf file is store in "data" element-->
<p><object style="min-height: 100vh; width: 100%;" width="320" height="240" data='/labkey/_webdav/FCIC/FCIC%20Task%20Work/T.08.00%20Cross-Cutting%20Analysis/Case%20Studies/HT-P-11_02/%40files/HT-P-11_02_CaseStudyBrief.pdf' /></object></p>

 
 
mohara responded:  2023-04-15 15:44

The easiest way to include an image in a wiki is to use a wiki-syntax page, then attach the image (jpg or png are common) to the page directly and include the image name in brackets within the text: [imageName.jpg]

The syntax in an HTML-syntax wiki is almost what you show: <img src="imageName.jpg">
I notice that what you pasted has an extra " before the image name which would prevent the image from displaying.

We don't directly support displaying a PDF within a wiki page (that could depend on browser settings, though none of the browsers I've tried will display them). You can work around this in a few ways:

  • obtaining a screen image (jpg or similar) and displaying it as above.
  • including a link to the image in a wiki-syntax page - ("link" or "new-tab-link" so that clicking will open it in a new tab) {link:PDF file will open when you click here|/full/path/to/desired.pdf}
  • if you have the Platform Developer (or Trusted Analyst) role, you'd be able to use <object> syntax as you show. That you don't have this permission is why you see the 'illegal element' error. If you have one of these roles, another idea is including a 'backup' plan in your <object> to give the user a download option if the browser won't display the PDF directly:
    <object data="/full/path/to/desired.pdf" type="application/pdf" width="100%" height="500px">
      <p>Unable to display PDF file. <a href="/full/path/to/desired.pdf">Download desired.pdf instead</a>.</p>
    </object>

There's lots more guidance in the Wiki User documentation topics.

--Molly