Giter Site home page Giter Site logo

PDF file as background about neutron HOT 16 CLOSED

johann150 avatar johann150 commented on July 23, 2024 1
PDF file as background

from neutron.

Comments (16)

Johann150 avatar Johann150 commented on July 23, 2024

maybe use pdf-poppler

from neutron.

jugendhacker avatar jugendhacker commented on July 23, 2024

Whats with the builtin PDF viewer of chromium?

from neutron.

Johann150 avatar Johann150 commented on July 23, 2024

I did not think about that. But the problem is that the PDF has to be displayed in the background of the drawing canvas. And it is also necessary to get the PDF as an image for the "export as image" function.

from neutron.

jugendhacker avatar jugendhacker commented on July 23, 2024

from neutron.

Johann150 avatar Johann150 commented on July 23, 2024

The PDF import is working already. I implemented it as a special case for background images.
This way I won't have to adjust the "export as image" and saving functionality.

But one annoying thing remains: The conversion takes some time. So a loader would be nice. The nicest way would be a small dialog, but it seems there is none built into electron for this job. So it will probably be a css animation over the whole <body>.

from neutron.

Johann150 avatar Johann150 commented on July 23, 2024

The page numbers in the image file names are zero padded, which causes some issues.

With 238d7ed I tried to fix this behaviour. Although the images seem to be loaded correctly, there is an issue which I have not found yet and no idea where to look.

from neutron.

jugendhacker avatar jugendhacker commented on July 23, 2024

Whats the exact problem?

from neutron.

Johann150 avatar Johann150 commented on July 23, 2024

When I have a PDF with >=10 pages, the images of the pages are correctly loaded but then not drawn correcly onto the canvas used to construct the background image. As a result, the call of toDataUrl (draw.js, l.505) returns a blank image.

from neutron.

Johann150 avatar Johann150 commented on July 23, 2024

So I found this which seems to be the issue.

It states that the function does not work if the canvas is too big, which it probably is in this case because I have a canvas 35363px in height.

from neutron.

jugendhacker avatar jugendhacker commented on July 23, 2024

But there is no real solution for this problem right?

from neutron.

Johann150 avatar Johann150 commented on July 23, 2024

If you have an idea, there will be. My only idea now would be maybe multiple background images. But I don't know how to implement that.

from neutron.

jugendhacker avatar jugendhacker commented on July 23, 2024

Or just a "real" pdf view

from neutron.

Johann150 avatar Johann150 commented on July 23, 2024

Well then there is the problem of saving it again...

from neutron.

jugendhacker avatar jugendhacker commented on July 23, 2024

from neutron.

Johann150 avatar Johann150 commented on July 23, 2024

I give up.
I removed all the code in 722693c. It will just not be reliable enough to work with long documents too.

from neutron.

Johann150 avatar Johann150 commented on July 23, 2024

I think with 0be7666, there might be a posibility for this again. Only problem would be how to store the PDF file alongside.

from neutron.

Related Issues (15)

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.