How-To Question - Document Display

I was wondering if it would be possible to use the hook system to create a custom profile tab that displayed, say, a PDF document that was either stored locally or on an external cloud account or something? Thanks!

1 Like

You should be able to use an iframe to display a PDF document. Example. Never tried it though, but as long as Markdown supports it Ares should support it.

Awesome. Thanks for the pointer! :slight_smile:

I hate to be a bother but…

I’ve got it so it shows a tab in the Systems section and in that tab it will show a PDF file in an iframe. It looks fantastic! What I can’t figure out is how to set the SRC to a variable. Say we want it to point to an attribute stored on the character called “character_sheet”. Any idea how I’d do that? Thanks!

1 Like

To get data from the game to the web portal there are a couple things you have to wire up with custom code. An example of how to do this can be found in the Web Goals tutorial.

If you’ve already got the data set and just need to show it, you won’t need all pieces of the tutorial. I think just these two:

I have everything in place(I think) I’m just missing one thing; how to set the URL to a variable.

So this works like a charm:

<iframe id="MyFrame" src= "\sheet.pdf" height="1000" width="100%"></iframe>

What I’d like is for “URL” to be set to a variable. I tried using iframeObject.src but it didn’t seem to work. I’d like for a player to be able to input where their sheet is stored and have it displayed in the above iframe.

Is that iframe code in ares-webportal/app/templates/components/profile-custom.hbs?

If so then you just need to use ember’s template binding to get the data out of the model (which was sent in the character web request).

So if you named the web request variable character_sheet then in the template you would do

<iframe id="MyFrame" src="{{char.custom.character_sheet}}" height="1000" width="100%"></iframe>

That did it. Works exactly as I was hoping it would. Thanks for the help! :slight_smile:

1 Like