לאתר זה תהיה פונקציונליות מוגבלת בזמן שאנו מתחזקים אותו לשיפור החוויה שלך. אם מאמר מסויים לא פותר את הבעיה שלך וברצונך לשאול שאלה, קהילת התמיכה שלנו מחכה לעזור לך ב־Twitter תחת ‎@FirefoxSupport וב־Reddit תחת ‎/r/firefox.

חיפוש בתמיכה

יש להימנע מהונאות תמיכה. לעולם לא נבקש ממך להתקשר או לשלוח הודעת טקסט למספר טלפון או לשתף מידע אישי. נא לדווח על כל פעילות חשודה באמצעות באפשרות ״דיווח על שימוש לרעה״.

מידע נוסף

Is it possible to style the built in pdf.js viewer using CSS/modify in general?

  • 2 תגובות
  • 1 has this problem
  • 1 view
  • תגובה אחרונה מאת ev3commander

more options

A lot of firefox is customizable via userchrome or extensions, however one thing that does not seem to be is the default PDF.js viewer. I would like to continue using it; however, I would like to change the styling on it (specifically I want to change how page breaks are rendered, which I already have the CSS for). Extensions obviously will not work as it is an internal file, userChrome doesn't work (I tried it), and I can't seem to find where the viewer is actually located on my PC (Search Everything brings nothing relevant up for pdfjs, pdf.js, or viewer.html.) Is there any way that I can modify the inbuilt PDF viewer?


PS this is probably unimportant but I noticed that https://mozilla.github.io/pdf.js/web/viewer.html has slightly different CSS from the built in version .

A lot of firefox is customizable via userchrome or extensions, however one thing that does not seem to be is the default PDF.js viewer. I would like to continue using it; however, I would like to change the styling on it (specifically I want to change how page breaks are rendered, which I already have the CSS for). Extensions obviously will not work as it is an internal file, userChrome doesn't work (I tried it), and I can't seem to find where the viewer is actually located on my PC (Search Everything brings nothing relevant up for pdfjs, pdf.js, or viewer.html.) Is there any way that I can modify the inbuilt PDF viewer? PS this is probably unimportant but I noticed that https://mozilla.github.io/pdf.js/web/viewer.html has slightly different CSS from the built in version .

פתרון נבחר

Instead of a userChrome file, a userContent.css file is what you would use to style pages that are actually displayed on Firefox, even if they are internal pages. The file needs to be added to the same folder as the userChrome.

To make sure it only changes the CSS of the PDF viewer, you would probably need to encapsulate everyone in @-moz-document url(URL_FOR_THE_PDF_VIEWER), although I admittedly don't know what the internal path for the pdf.js would be.

You can try not encapsulating the CSS, but it might modify other pages or websites that share similar classes or IDs (depending on what CSS selectors you are using).

Hope this helps.

Read this answer in context 👍 1

כל התגובות (2)

more options

פתרון נבחר

Instead of a userChrome file, a userContent.css file is what you would use to style pages that are actually displayed on Firefox, even if they are internal pages. The file needs to be added to the same folder as the userChrome.

To make sure it only changes the CSS of the PDF viewer, you would probably need to encapsulate everyone in @-moz-document url(URL_FOR_THE_PDF_VIEWER), although I admittedly don't know what the internal path for the pdf.js would be.

You can try not encapsulating the CSS, but it might modify other pages or websites that share similar classes or IDs (depending on what CSS selectors you are using).

Hope this helps.

more options

Cool, thanks! I think this should work for me. I'll probably just use super specific selectors to avoid that happening.

Edit: Never mind, I think that that didn't work.. I copied .pdfViewer .page { margin: 1px auto -3px auto !important; border: 1px dashed transparent !important; }

into my userContent.css and it didn't do anything.

Edit: Sorry again! It worked. The error was in my CSS.

השתנתה ב־ על־ידי ev3commander