-
Notifications
You must be signed in to change notification settings - Fork 985
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
PDF.js CSS/Stylesheets #127
Comments
Interesting use case. Currently there is only one file: pdfobject.js. Externalizing the CSS would require adding another file. No big deal to those who use NPM, but many PDFObject users do not use package managers, and adding the additional CSS would be a big deal. Also, the code you're asking to remove was specifically added for PDF.js! https://github.com/pipwerks/PDFObject/blob/master/pdfobject.js#L153 So I'd need to better understand the issue before making any changes. |
Yeah, I understand the code was added specifically for PDF.js. That's how I isolated the issue in the first place. The inline CSS worked fine for my application when it was doing the raw embed, but setting I can emulate the problem with the following HTML file: <html>
<head>
</head>
<body>
<div id="pdf-container" style="position: relative">
<div id="inner" style="position: absolute; top: 0; right: 0; bottom: 0; left: 0;">
<iframe src='embed.html' style='border: none; width: 100%; height: 100%;'>
</iframe>
</div>
</div>
</body>
</html> And say <h1>Pretend I am a PDF.</h1> This mimics PDFObject's generated structure (with the The iframe source will not show for me in Google Chrome unless the CSS is modified in one of the ways suggested above. |
Thanks for the additional info, I will need some time to check it out. |
Sure, and if there's anything else I can provide to assist you, let me know. |
I want to add that Firefox 52.0 is the first without support for MIME application/pdf, and just was released on March 7 2017, as a current supported official release. So... the number of troubled pdfobject v1 users will increase since then. |
Sorry for the radio silence on this @j30392 . Do you happen to have an example posted online that I can review? |
@jeff-griffin-hm is this still an issue? |
For the 2.2.0 update, there is now an option to remove all inline styles so you can manage CSS on your own. https://pdfobject.com/dev/tests/omit-inline-styles.html 2.2.0 is not released yet but will be released soon. Closing ticket. |
I used PDFObject to display an embedded PDF for our customers, utilizing the ability to fall back on PDF.js in case of no embedded PDF support (e.g., iOS).
This ended up working great, and thanks for the useful library.
However, I did notice a slight problem in my use case. Originally the PDF.js
viewer.html
file would not show up at all, whereas the raw embedded PDF would.After downloading the source and investigating, I isolated the problem to the following:
Removing the
position: absolute
from this<div>
or switching it toposition: relative
caused the PDF.js viewer to appear. Removing position styles from the root container (.pdfobject-container
) also fixes the issue.This may have something to do with the context this is running in (I haven't had time to check), but in general, is it feasible to put the styling in a separate CSS file rather than inside the JS code?
The text was updated successfully, but these errors were encountered: