question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PDF is not opening on published site

See original GitHub issue

Hi guys! So i imported few JPG’s and one pdf file into my .js file. On local server during develop and serve everything works great. Once i push my website to surge, all images showing up except link (a href) to my PDF. It’s just can’t find it.

Any ideas?

Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

19reactions
LuisPaGarciacommented, Mar 5, 2019

To add some static content, you need to create a static folder on the root of your project.

Then to use it:

import { withPrefix } from 'gatsby'

render() {
  // Note: this is an escape hatch and should be used sparingly!
  // Normally they recommend using `import` for getting asset URLs
  // as described in the “Adding Images, Fonts, and Files” page.
  return (
<a
  rel="noopener noreferrer"
  href={withPrefix('/my_pdf.pdf')}
  target="_blank"> Click to see my pdf
</a>
)
}
1reaction
HaoZekecommented, Dec 1, 2017

Not relevant, also surge.sh does not support .pdf files as described here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot viewing PDF files on the web - Adobe Support
In Reader or Acrobat, right-click the document window, and choose Page Display Preferences. · From the list at left, select Internet. · Deselect ......
Read more >
6 Fixes to Try When Adobe Acrobat Reader Can't Open PDF ...
6 Fixes to Try When Adobe Acrobat Reader Can't Open PDF Files on Windows · Right-click on the Windows Start button and select...
Read more >
Disable Preferences So That PDF Does Not Open As A Web ...
Right click any PDF file, select Open With - Choose another App. Select Adobe Reader, check the box at the bottom 'Always use...
Read more >
Fix PDF View Problems for Chrome and Edge Browsers
Solution: · See if your PDF supports Fast Web View, open the PDF from your desktop computer (not a web browser) using Adobe...
Read more >
PDF won't open? How to Fix PDF Files not Opening Error
Why can't I open a PDF? · Outdated app: If PDF is not opening in Adobe Reader, it might be because the app...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found