Select to view content in your preferred language

Is there a way to code a btn link to open the actual PDF?

1666
5
Jump to solution
04-17-2020 05:58 PM
AdamRepsher
Frequent Contributor

I have an ArcGIS Hub Initiative site for #covid-19 and I have a PDF that I want to have users access with a button.

I want this to be a one-click action.  Click button, get a full-window view of the PDF.

Not a "dataset" view that looks like an open data overview page:

Is there a way to re-formulate the link that is currently this:

<a class="btn btn-primary" target="_blank" href="https://covid-19-myfake.link.hub.arcgis.com/datasets/[id_hash_hidden]">View</a>

...into one that just opens the actual document?

The document can't be completely public...

0 Kudos
1 Solution

Accepted Solutions
KlaraSchmitt
Esri Regular Contributor

Hi Adam,

You can absolutely have a PDF that opens fullscreen from a link that you've put on a Hub Initiative site; however, it is the Hub link structure `...hub.arcgis.com/datasets/[id]` that is causing the PDF to open in our Item Details view. We do have a parameter that can be added to a Hub link to force a full screen, which is `/datasets/[id]?fullScreen=true` but I am observing a bug with it not actually expanding the iframe to the full height of the window even though it is hiding the metadata. I will open an issue.

Alternatively, if you open the PDF in ArcGIS Online's Item Details view, then click the open button, then copy the URL from the browser address bar (it'll be long, but you do want the whole thing), you can then paste that URL as the href into the exact same link structure you have above within your initiative and it'll do what you want.

I ran a test of both through my own site.

Lastly, I know you didn't ask, but for accessibility and best practices, I would also recommend adding an aria-label to your link `<a href="" class="btn btn-link" aria-label="opens in new tab">`, which just warns those using assistive technologies not to be surprised when they select the link and it throws open a new tab/window.

View solution in original post

5 Replies
KlaraSchmitt
Esri Regular Contributor

Hi Adam,

You can absolutely have a PDF that opens fullscreen from a link that you've put on a Hub Initiative site; however, it is the Hub link structure `...hub.arcgis.com/datasets/[id]` that is causing the PDF to open in our Item Details view. We do have a parameter that can be added to a Hub link to force a full screen, which is `/datasets/[id]?fullScreen=true` but I am observing a bug with it not actually expanding the iframe to the full height of the window even though it is hiding the metadata. I will open an issue.

Alternatively, if you open the PDF in ArcGIS Online's Item Details view, then click the open button, then copy the URL from the browser address bar (it'll be long, but you do want the whole thing), you can then paste that URL as the href into the exact same link structure you have above within your initiative and it'll do what you want.

I ran a test of both through my own site.

Lastly, I know you didn't ask, but for accessibility and best practices, I would also recommend adding an aria-label to your link `<a href="" class="btn btn-link" aria-label="opens in new tab">`, which just warns those using assistive technologies not to be surprised when they select the link and it throws open a new tab/window.

AdamRepsher
Frequent Contributor

Excellent!  Thank you so much Klara Schmitt‌!!! 

--Adam

0 Kudos
LarryMasters
Frequent Contributor

I did this, minus the aria-label thing, and got this when I clicked on the link in the hub site;

any ideas?

0 Kudos
AdamRepsher
Frequent Contributor

You are getting this with a PDF?

0 Kudos
LarryMasters
Frequent Contributor

Yes.

0 Kudos