2

I would like to embed a PDF file in a Tridion page.

I tried to use embed and object tags but the TCM URI in the src parameter is not replaced with the PDF's actual link (the link resolver doesn't work).

Should I create an embedded Schema and then create a Component or is there something native I'm not aware of. Please be aware that I don't want to use the tridion:href to post a link, what I want is to embed the PDF to show its contents in the webpage.

Please step by step. Thanks.

  • 1
    Can you edit your question and provide a bit more detail, like what templating language are you using, which version of Tridion, and perhaps supply a sample of the code you have tried and isn't working etc.? – Bart Koopman May 20 '16 at 11:16
  • The main problem is to resolve the link to the pdf document, and use it in the published html code. Can you send the html code that you need to publish? – Raúl Escudero May 20 '16 at 11:30
4

The out-of-the-box Link Resolver TBB may work with object or embed tags - I'm not sure I've ever tried it... It's worth a go though... See the documentation topic: Link Attributes and try adding a tridion:href in combination with tridion:type="Multimedia" and tridion:targetattribute="src"

Failing that, you can always create a small TBB that publishes the PDF and adds the published path to the templating package which you can then use in your DWT.

| improve this answer | |
  • Sure you can use the Link Resolver TBB. But I do prefer the TBB to publish and generate the needed html code to get the custom final result. – Raúl Escudero May 20 '16 at 12:08
4

You're on the right track. There isn't a more native way to "embed" PDFs on a web page than publishing the PDF, rendering the markup, and giving editors a way to manage the PDFs. From the editor perspective they can insert images or links, which can be PDFs, but there is no "embed" option.

There are a few ways to "embed" PDFs in markup. After confirming which behavior (and markup) you want on the website, you'll want to confirm the best content model for the editors. It doesn't have to be an Embedded Schema.

Content editors could:

  • Place PDFs directly on a Page (as a Component Presentation)
  • Publish the Multimedia Components dynamically (from a folder)
  • Link to the PDFs from a Component and then publish the Component or Page

Your template for the PDF or the Component linking to it (or view, if using an MVC approach) will render the "embedding" markup. You'll also publish the PDF either indirectly using AddBinary or directly with its own (dynamic) Component Template. The details @BartKoopman mentions will help get you specific answers, but you'll likely parse the markup in your Output (in a Template Building Block) to detect and add such PDFs.

If you make the PDFs fully "dynamic" and have editors directly publish them, you might use GetBinary as well in delivery, depending on where you want to render your markup.

| improve this answer | |
3

This is basic Tridion, I don´t know if you have some restrictions, as you don't explain the scenario (Tridion version, Dreamweaver templating, DD4T, etc...):

  • include a multimedia field in your schema (i.e. "doc")
  • in a dreamweaver component template you can include:
<!-- TemplateBedinIf cond="doc" -->
<a href="@@doc@@">Link document</a>
<!-- TemplateEndIf -->
  • Create a Component Template and include you Dreamweaver template, and the "Default Finish Actions" template (wich includes the Link Resolver)
  • Create a component with the pdf document, include it in a page and publish the page,
  • The link must be translated into the link to the pdf
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.