Skip to content

Can not be added in papaer-dialog #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hyyan opened this issue Jan 17, 2017 · 3 comments
Open

Can not be added in papaer-dialog #13

hyyan opened this issue Jan 17, 2017 · 3 comments

Comments

@hyyan
Copy link

hyyan commented Jan 17, 2017

Hello

Thanks for the great work ,I am unable to add this element inside paper-dialog , I just get blank pdf , with no errors in the console .

when I try to download the pdf , I get error saying Can not get the page

Any idea ?
thanks in advance

@emielbeinema
Copy link
Contributor

I've had a similar problem with using this element inside a paper-dialog. My problem was eventually fixed by manually setting the dimensions of the pdf-element when opening the dialog:

attached: function() {
    var pdfElementToolbarHeight = 64;
    var modal = this.$.modal;
    var pdf = this.$.pdf;
    modal.addEventListener("iron-overlay-opened", function() {
        var style = window.getComputedStyle(modal, null);

        pdf.height = parseInt(style.getPropertyValue("height")) - parseInt(style.paddingTop) - parseInt(style.paddingBottom) - pdfElementToolbarHeight;
        pdf.width = parseInt(style.getPropertyValue("width")) - parseInt(style.paddingLeft) - parseInt(style.paddingRight);
        pdf.instance.HEIGHT = pdf.height;
        pdf.instance.WIDTH = pdf.width;
        pdf.instance.loadPDF();
    });
}

Does this help in your situation?

@hyyan
Copy link
Author

hyyan commented Jan 18, 2017

@emielbeinema thanks for sharing your solution , I will give it a try

@emielbeinema
Copy link
Contributor

@hyyan Have you had any luck getting your setup to work yet?

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

No branches or pull requests

2 participants