How to open a local PDF file in a tab?
Answered
English Lop posted this in #help-forum
English LopOP
I have a PDF file in my
I've tried
I've also tried
But I get 404s with both. I've also tried with and without
Ideally I want to open just the pdf using the browser's own PDF viewer.
public folder but I can't seem to load it I've tried
<embed
src="/public/MyPDF.pdf"
type="application/pdf"
style={{width: '100%', height: '100vh'}}
/>I've also tried
<iframe src="/public/MyPDF.pdf"
style={{width: '100%', height: '100vh'}}
/>But I get 404s with both. I've also tried with and without
'use client' Ideally I want to open just the pdf using the browser's own PDF viewer.
Answered by Ray
oh should be this
<object data="/MyPDF.pdf" type="application/pdf" width="100%" height="500px" />6 Replies
@English Lop I have a PDF file in my `public` folder but I can't seem to load it
I've tried
<embed
src="/public/MyPDF.pdf"
type="application/pdf"
style={{width: '100%', height: '100vh'}}
/>
I've also tried
<iframe src="/public/MyPDF.pdf"
style={{width: '100%', height: '100vh'}}
/>
But I get 404s with both. I've also tried with and without `'use client'`
Ideally I want to open just the pdf using the browser's own PDF viewer.
try
<object data="/public/MyPDF.pdf" type="application/pdf" width="100%" height="500px" />@Ray try
ts
<object data="/public/MyPDF.pdf" type="application/pdf" width="100%" height="500px" />
English LopOP
I get a blank white page, and this is in the dev tools
@English Lop I get a blank white page, and this is in the dev tools
oh should be this
<object data="/MyPDF.pdf" type="application/pdf" width="100%" height="500px" />Answer
English LopOP
had to change the height to
screen but it works perfectlythank you
@English Lop thank you
np please mark solution