Skip to content
This repository has been archived by the owner on Oct 10, 2019. It is now read-only.

Canvas size problematic #20

Open
robhunt3r opened this issue Jan 3, 2015 · 2 comments
Open

Canvas size problematic #20

robhunt3r opened this issue Jan 3, 2015 · 2 comments

Comments

@robhunt3r
Copy link

Canvas size is not 100% it's container, causing visual errors. It is not resizing neither, which is absolutely not responsive...

I'm trying to convert original viewer.js into an angularjs service, but I'm not too experienced with Angular... The far I went is allowing blobs to being rendered instead of only pdf url, removing the SRC attribute of the directive and injecting directly inside my controller...

Any clues on this? It would be cool to make mousewheel and that available too, because ng-pdfviewer is too simple and no browser friendly at all....

@petarjs
Copy link

petarjs commented Jul 29, 2015

If you want to the rendered pdf to be responsive, just add width: 100% (or so) to the canvas inside of pdfviewer and it will become responsive, maintaining the aspect ratio of the canvas (because the lib sets width and height on the canvas element). You can also do min-width etc.

@Zyst
Copy link

Zyst commented Jul 27, 2016

Thanks @petarslovic I fixed this in my project by adding the following CSS, with a specific selector to avoid unintended consequences:

/* Bugfix for pdfviewer canvas tomfoolery */
pdfviewer > canvas {
    width: 100%;
}

Works as one would expect.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants