← Back to DAGDA | Support | Source: https://github.com/MihajloNesic/jekyll-pdf-embed/issues/6
Skip to content

PDF is downloaded instead of displayed #6

Open

Description

@jlconlin

I have page where I'm trying to embed a PDF like this:

{% pdf "/Meetings/Attachments/Agenda.pdf" %}

Instead of embedding the PDF in the page, the PDF is downloaded. There is some space for the embedded PDF, but it just shows a blank space instead.

Do I have something configured incorrectly?

Activity

  1. MihajloNesic commented on Oct 20, 2021

    @MihajloNesic
    Owner

    That's strange. You are using the correct syntax. Is there anywhere I can see this live?

    Until then, you can check out the official example usage page -> https://mihajlonesic.gitlab.io/jpe-examples/

  2. jlconlin commented on Oct 21, 2021

    @jlconlin
    Author

    @MihajloNesic Unfortunately, the page is not hosted externally. I have seen the example page, which helped.

    Attached to this is my (edited) _config.yml. I just removed the personal things that I can't share. It "shouldn't" affect the issues I'm seeing.

    _cfg.yml.txt

    I know this plugin used to work. But now it seems that every post I have that embeds the PDF, now just downloads it instead.

  3. MihajloNesic commented on Oct 21, 2021

    @MihajloNesic
    Owner

    @jlconlin Hmm, the config file didn't really help (thank you though). You probably did set it up correctly, as you said, it did use to work.

    Does that mean that the server from which you are embedding the pdf files has changed? Maybe the Content-Disposition header changed?

    I will try to recreate the issue (probably) this weekend. Thank you for your time and keep an eye on this issue :)

  4. jlconlin commented on Oct 22, 2021

    @jlconlin
    Author

    Oh, now you are getting beyond my area of expertise. I'm not a web developer. The machine is still the same. It's possible (likely?) that the theme I am using (minimal mistakes) was updated and that made a change.

  5. MihajloNesic commented on Oct 23, 2021

    @MihajloNesic
    Owner

    Hello @jlconlin .
    I've made an example Jekyll website with theme Minimal mistakes and jekyll-pdf-embed. You can view the source code here https://github.com/MihajloNesic/minimal-mistakes-pdf-example or see the demo live here https://mihajlonesic.github.io/minimal-mistakes-pdf-example/jekyll-pdf-embed-test

    The plugin works as expected. No automatic downloads

  6. akbaritabar commented on Dec 24, 2021

    @akbaritabar

    I can confirm the same issue (view link is there but no PDF is shown, it downloads it instead of showing) using Mozilla/Firefox (latest version, on Mac) even with your website (photo below). It works perfectly fine when I open it in Google Chrome though.

    In Mozilla/Firefox

    image

    In Chrome

    image

  7. MihajloNesic commented on Dec 31, 2021

    @MihajloNesic
    Owner

    Hi @akbaritabar, thank you for the screenshots.

    That is a strange behaviour. I just tested on Firefox and Chrome (both latest versions) on MacOS and it works perfectly.

    Firefox
    Screenshot at Dec 31 10-15-29

    Chrome
    Screenshot at Dec 31 10-16-41

    I think dumping the iframe is a priority for the next update.

  8. added
    bug
    on Dec 31, 2021
  9. akbaritabar commented on Dec 31, 2021

    @akbaritabar

    @MihajloNesic Thank you for letting me know.
    If this helps, I should add that for my own jekyll based blog I was doing my test while running the server locally and I had not yet pushed to GitHub pages (I see from your screenshot that you have already pushed to server). But for the case of your website (the screenshots in my previous comment), these were indeed strange behavior.

  10. jlconlin commented on May 17, 2022

    @jlconlin
    Author

    Any word on how to fix this? I can confirm that this is an issue using Firefox on my Mac, but it works using Chrome on my Mac.

  11. hosseinabdinf commented on Jul 15, 2022

    @hosseinabdinf

    Hey @MihajloNesic, @jlconlin
    I have the same issue when I use an external pdf link from Github!
    everything works fine when I test the plugin with your example link as below:
    {% pdf "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" %}

    But when I use an external link (from Github), the browser suddenly starts downloading the PDF file.
    I ran my Jekyll website locally, and I tested the output on Google Chrome and Microsoft Edge, both of them started to download the PDF file.

    here is my code:
    {% pdf {{ site.data.cv.dlink }} %}

    site.data.cv.dlink is:
    https://raw.githubusercontent.com/hosseinabdinf/curriculum-vitae/main/hosseinabdi.pdf

    also, I tested it with the embed tag:
    <embed src="{{ site.data.cv.dlink }}" width="500" height="375">

    the problem still remains and the result is the same!

    But when I use local PDF file, it works fine and the PDF shows correctly:
    local: /assets/hosseinabdi.pdf
    {% pdf {{ site.data.cv.local }} %}

    I think the type of link we use is the cause of this problem, so if we use a direct link there will be no problem anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions