Code Monkey home page Code Monkey logo

hugo-embed-pdf-shortcode's Issues

Undefined is not an object

I have this issue , with Safari 15.5 on Monterey 12.4
running Hugo server
undefined is not an object (evaluating 'pdfjsLib.GlobalWorkerOPtions...
Screenshot 2022-06-20 at 13 13 55

thanks in advance
best regards

how to set a pdf file so that it can display?

Screenshot_20210305_224426

I tried the inspect element on the Hugo blog page, an error appeared like the picture

{{< embed-pdf url="./path/to/pdf/file/LAPORAN HASIL MONITORING KEAMANAN SIBER TAHUN 2020.pdf" >}}

is it correct to set the url?

Add a progress loader before displaying the pdf file

Is your feature request related to a problem? Please describe.
When embedding large PDF files the canvas is shown but the pdf is not rendered. The script waits for the PDF to load completely and then displays it.
This may take several minutes and during this period the page does not indicate any progress or loading information.

Describe the solution you'd like
Display a loading symbol or icon or progress percentage.

Describe alternatives you've considered

Additional context

Use CDN instead of including the library files

Is your feature request related to a problem? Please describe.
No.

Describe the solution you'd like
At the moment the shortcode requires the user to include the library files locally. This will be a maintenance problem as the library will have to be updated everytime there is a new release.

Describe alternatives you've considered
Ideally the library can be included using a CDN. If not available then consider other projects / libraries that include PDF.js and provide a CDN.

Additional context

Explore the option of making the source of the PDF.js library configurable.
Refer this

unable to load pdf.worker.js with a baseURL in hugo

Describe the bug
in a hugo page with a different root page than ./ such as: localhost:1313/hugopage/, the js-pdf can not load, getting:

Setting up fake worker failed: "Cannot load script at: https://localhost:1313/js/pdf-js/build/pdf.worker.js".

To Reproduce
Steps to reproduce the behavior:

  1. run: hugo server --bind "" --baseURL "localhost/multimedia/"
  2. Try to load a markdown with {{< embed-pdf url="essai.pdf">}}

Expected behavior
The pdf should load correctly

Desktop (please complete the following information):

  • Linux
  • Firefox/Chrome

Additional context
Very important to change the BaseURL

PDF.js library loading broken

Describe the bug
The script src is incorrect, which means the page breaks as the library will not load.

To Reproduce
Steps to reproduce the behavior:

  1. Include the library using the steps in README.
  2. Run the local webserver with hugo serve -D or deploy

Expected behavior
The PDF should display normally.

Screenshots
image

The correct URL should be /js/pdf-js/..., without the extra slash at the beginning. Manually removing the slash fixes the bug.

Reverting 704485b fixes the bug as well, but it will break if your site depends on the prepended relative link.

Install as a Theme Component

Installation and updates would be easier with a Theme Component.
I just did a successful installation this way and I can provide a PR.
But before tackling this I would like to know if this PR has any chance to get merged.
What do you think anvitks, is it the right way to go?

Please make PDF resizable

Is your feature request related to a problem? Please describe.

No problem.

Describe the solution you'd like

It would be nice to either have the PDF resizable or have a parameter for the embed code to make the PDF larger (maybe in percent).

It doesn't work

I did according to the instructions.
However, it doesn't work.
Anything is visible on the page.

Deploy pdf is not working

sorry i reopened the issue. this time I get an error that the pdf does not appear again when deployed on netlify

Screenshot_20210308_125753

I'm sorry but, it doesn't work for me

First of all, thanks for your attention.
I am following the steps of his instructions but the pdf that is a single page does not load, only the window appears with "Previous Next Page: /" I have tried with firefox chrome and google chrome movile ..
I have also tried to load other pdf files with more than one page but I have the same result.
I don't know if I'm doing something wrong (I'm just starting with hugo), I'm trying to make it work at https://hotspotcepeda.github.io/es/posts/hotspot/#pdf
I have the pdf file uploaded locally at https://github.com/hotspotcepeda/hotspotcepeda.github.io/blob/main/static/pdfs/hotspot_conectar.pdf
I would like to know what is happening, I do not have an error message, the pdf file is simply not displayed.

I would appreciate your help in making it work.

PDF always loading, never displaying.

The initial installation did not work at all. But then I ran across this guide and I can get the shortcode to start loading the PDF, but it never actually loads it: the wheel just keeps on spinning.

Provide option to allow users to download the PDF file

What?
Provide a option to allow the user to download the PDF file.

Why?
Sometimes I need to publish PDF in “secure mode” (I mean that people don’t have to can downloading the PDF); other times, I need to publish PDF allowing people to download.
Currently, I seem that it isn’t possible to download the PDF; am I wrong?

Originally posted by @nicfab in #26 (comment)

hidePaginator option does not work

Describe the bug
Option hidePaginator="true" has no effect.

To Reproduce
Steps to reproduce the behavior:
Insert shortcode to display with hidePaginator="true"

Expected behavior
I just want to display the first and only page of a pdf, so I don't need a paginator
or a link to download the PDF.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Ubuntu Linux
  • Browser Chrome
  • Version hugo v0.125.4

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

PDF not loading on Netlify but is OK on localhost

Describe the bug
A clear and concise description of what the bug is.
When I upload my site to Netlify the spinner keeps on spinning but at the localhost it loads in a very short time.

To Reproduce
Steps to reproduce the behavior:
Open page with the "hugo-embed-pdf-shortcode"

Expected behavior
A clear and concise description of what you expected to happen.
I expect to see the PDF file

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Ubuntu 23.04
  • Browser [e.g. chrome, safari]
  • Brave browser, Firefox, Chrome
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.
I had installed it and the problem started where it was not loading on Netlify and had stopped loading on localhost. I then reinstalled it and it started reloading in localhost but not on Netlify.
I think I have read of other people having this problem with Netlify but I didn't see any solutions to the problem.

Scroll through pages

I use the Embed-pdf-shortcode for displaying my CV on my personal website.

I wonder if there could be an option in which the few pages will display automatically one after the other (as a long page) without the need to press next/previous.

[Feature Request] Add GitHub action to implement a CI for the shortcode

Is your feature request related to a problem? Please describe.
Currently there is no CI in place to test whether the changes made to the shortcode work in the real world.
Any change needs to be installed on a demo site manually and checked in the CI for the demo website
Demo site Source code is here

Describe the solution you'd like
When new code is added to the shortcode the CI should take the code from the PR, spawn the website code with the latest shortcode and check for any build errors and show a deploy preview. This is implemented in the Demo site using the netlify integration.

Describe alternatives you've considered
Currently no alternatives considered. Open to suggestions and any PRs that can implement a solution for this.

Users can view PDFs but preventing them the download

Is your feature request related to a problem? Please describe.
Sometimes allowing users only to view some PDFs is preferable, preventing them from downloading them.
Sometimes you may want to share PDFs, but you want to prevent the download for various reasons.

Describe the solution you'd like
So, you can implement the plugin code with a feature that allows avoiding downloading PDFs.
In that way, PDFs can remain "embedded" in the webpage, and users can only view them page by page, but they should not be allowed to download PDFs. It's like a security mode.

I much appreciate it if you consider this suggestion soon.
See issue #26

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.