0

I want to show a pdf file inside the webpage, using Clojurescript. These are what I've tried but it does not show anything.

[:embed {:src "demo.pdf"
         :type "application/pdf"
         :width "500px"
         :height "400px"}]

or

[:object {:data "demo.pdf"
         :type "application/pdf"
         :width "500px"
         :height "400px"}]

Can anyone help me with that? Thank you!

niloofar
  • 2,244
  • 5
  • 23
  • 44
  • Is your file `"demo.pdf"` in `resources/public` directory? – Martin Půda Nov 23 '22 at 08:33
  • @MartinPůda no! I just copied type="application/pdf" from examples I found by searching. I should include directory path in :src, shouldn't I? – niloofar Nov 23 '22 at 08:41
  • So the error is, that you see a 404 in your browser's network-tab? So your question actually is, where to put static resource on the server-side? If not please be specific what is not working. Does the dev-console or network-tab give you any hints? "Does not work" is bad error description. – cfrick Nov 23 '22 at 08:52
  • @cfrick no, I don't see the pdf on the page and there is also no 404 error. As I know, I should put the file in the resources directory, but it does not working. – niloofar Nov 23 '22 at 08:54
  • 2
    @niloofar stack overflow pro tip: omit the phrase "is not working" and the like from your posts. There are dozens if not hundreds of reasons it might not be working, telling us that does not help us help you. Describe the *output* instead: like "I see a blank page but there's no error in the JS console or the dev tools network tab". That object tag example should be working as long as `demo.pdf` is a valid pdf file in the same directory index.html gets served from. We can't help you figure out why if all you tell us is that it didn't work. – Jared Smith Nov 23 '22 at 14:38

0 Answers0