Skip to content
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

Framed monster block background image doesn't appear in the PDF #3275

Closed
RKuerten opened this issue Jan 29, 2024 · 11 comments · Fixed by #3297
Closed

Framed monster block background image doesn't appear in the PDF #3275

RKuerten opened this issue Jan 29, 2024 · 11 comments · Fixed by #3297
Labels
bug We say this works but it doesn't ❌ Missing from V3 This should be in v3 tweak Small, non-breaking change

Comments

@RKuerten
Copy link
Collaborator

Renderer

v3

Browser

Chrome

Operating System

Windows

What happened?

When generating a PDF, the .monster.frame is always generated with the background color, ignoring the background image.

I tested with different background images, with different background-blend-modes (mainly normal, lighten, darken, and multiply), the result is always the same (no background image for the monster block in the PDF).

Print difference
Browser vs Generated PDF

Browsers tested:
Brave V 1.62.153 w/ Chromium 121.0.6167.85 64-bits
Chrome V 121.0.6167.86 64-bits

Code

No response

@Gazook89
Copy link
Collaborator

Gazook89 commented Jan 29, 2024

I just test with a new brew, featuring only a framed stat block, with Chrome on Mac (viewed in Preview), and had no issue. Hrm.

Are you using the default PDF printer, or something else (CutePDF etc)?

Is this true with a brand new brew, with no custom css? Or, can you provide the Share link to your brew that isn't working?

Chrome Version 120.0.6099.234 (Official Build) (arm64)

@RKuerten
Copy link
Collaborator Author

I can't share the brew publicly because it is a product yet to be released on the DMsGuild. I'm using the default printer (on Windows, btw).

I've tested with a brand new brew, and it works. It also works by copying a single page of the brew with a stat block with the custom css. The brew is not that big (30 pages), but there's basically an image in every page along side the stat blocks. Could be some memory issue.

Once I add the pages (cover page & toc + intro page) that should be before the first page with a stat block, the background disappears. If delete both pages, only the first stat block has the background, the others default to the background color.

@RKuerten
Copy link
Collaborator Author

I've circumvented the problem by adding the background texture as a before element in the .monster.frame blocks. The code for it looks like this (for .wide blocks, it is equal except for the width, which is 102.1%).

.page .monster.frame::before  {
  background-color     : #F7F0D4;
  background-image     : url(https://i.imgur.com/owy8gdY.jpg);
  background-blend-mode: normal;
  background-size      : 100% 100%;
  background-repeat    : no-repeat;
  background-position  : top center;
  content              : "";
  position             : absolute;
  width                : 104.1%;
  height               : 100%;
  top                  : 0;
  left                 : -7px;
  z-index              : -3;
}

I'm closing this issue.

@5e-Cleric
Copy link
Member

New brew just created:
image
print view:
image
PDF after download:
image

@5e-Cleric 5e-Cleric reopened this Jan 29, 2024
@5e-Cleric
Copy link
Member

5e-Cleric commented Jan 29, 2024

Please save a new brew in which you find this issue, and share it with us.

Also, what is your OS, and your browser, and the version of both?

It might also be your own CSS, if nothing else is faulty, it will be the css.

@RKuerten
Copy link
Collaborator Author

RKuerten commented Jan 29, 2024

Here's a brew with the same problem, no CSS changes from the base v3:

I had a 2-page lore doc for my campaign (avernus) written in Portuguese, added two pages with the same generated stat block in each: no background when generating the PDF.

However, I discovered that if I scroll down to the stat block in the print page, the background loads for that stat block (and that stat block only). Additional stat blocks only have the background color.

Here's the share link: https://homebrewery.naturalcrit.com/share/MbQOA3BqiTUz

Tested in both browsers below, on Windows 10:
Brave V 1.62.153 w/ Chromium 121.0.6167.85 64-bits
Chrome V 121.0.6167.86 64-bits

@calculuschild
Copy link
Member

calculuschild commented Jan 29, 2024

Looks like we have background-attachment: fixed which is causing the background to scroll out of view on the print page. I thought we had fixed this earlier but I guess not. Should be an easy change.

I believe the original reason we had that was that by attaching the background to the page coordinates rather than the statblock, every statblock on a page would be a "window" onto a different section of the background texture, instead of each having the same identical section of parchment. There is probably a better option to do this than "fixed".

@RKuerten In the mean time you can add this code to your Style tab:

.page .monster.frame {
  background-attachment: unset;
}

@5e-Cleric
Copy link
Member

so the bug can't happen in a one page document, good to know.

@5e-Cleric 5e-Cleric linked a pull request Feb 12, 2024 that will close this issue
@5e-Cleric 5e-Cleric added bug We say this works but it doesn't ❌ Missing from V3 This should be in v3 tweak Small, non-breaking change labels Feb 13, 2024
@calculuschild
Copy link
Member

calculuschild commented Feb 27, 2024

For #3297 , the fix should be to just remove the background-attachment property entirely, instead of setting it to unset.

(Unset is only needed to overwrite an existing property, which you would need to do if trying to fix this from your brew style tab.)

Just reopening this instead of making a new issue, so we have all the context.

@RKuerten
Copy link
Collaborator Author

Created a new pull request to fix that.

@RKuerten
Copy link
Collaborator Author

Fixed with the merge of #3330

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug We say this works but it doesn't ❌ Missing from V3 This should be in v3 tweak Small, non-breaking change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants