0

I have a stored PDF and I want to display it in an iFrame. What is the appropriate way to calculate the src?

I used this but that did not work for me:

<set field="resourceReference" from="ec.resource.getLocationReference('dbresource://mantle/content/cv/100000/content_100006/161107_HS.pdf')"/>

Then, in the HTML I added:

src="${resourceReference.getUrl()}"

Without success.

field setup

enter image description here

mrovnanik
  • 123
  • 9

1 Answers1

1

A URL from a ResourceReference is an internal URL (starting with dbresource:// in your example) and not a valid URL for a web client. You'll need to add a screen transition or something that streams the file to a web client (using something like the ec.web.sendResourceResponse(String location) method). There are various examples of transitions using this method in the framework, SimpleScreens, etc.

David E. Jones
  • 1,721
  • 1
  • 9
  • 8
  • I added a transition with ec.web.sendResourceResponse('dbresource://mantle/content/cv/XYZ.pdf', true) with inline = true. Then I added an iframe with src src="${sri.buildUrl('getActualCV').url}". – mrovnanik Nov 14 '16 at 12:40