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

[Bug] Print styles being ignored #9730

Closed
cjlotz opened this issue Feb 24, 2024 · 4 comments
Closed

[Bug] Print styles being ignored #9730

cjlotz opened this issue Feb 24, 2024 · 4 comments
Labels
pdf Produce PDF as the output format

Comments

@cjlotz
Copy link
Contributor

cjlotz commented Feb 24, 2024

Describe the bug
Custom styles created for printing does not seem to get applied. I'm trying to change the background-color of the code blocks as the background color used for web output does not match the printed output. I've added the following CSS to my custom main.css file

@media print {
    section[role="tabpanel"] {
        display: block !important;
    }

    .hljs {
        background-color: aliceblue;
    }
}

The section[role] gets applied, but the background-color overide does not get applied. I've verified that the .hljs override does work when applied to the whole site and not only to print media selector.

@cjlotz cjlotz added bug A bug to fix template The stock site template labels Feb 24, 2024
@yufeih
Copy link
Contributor

yufeih commented Feb 24, 2024

PDF does not print background graphics by default, we could add an option to opt-in background graphics.

@yufeih yufeih added pdf Produce PDF as the output format and removed bug A bug to fix template The stock site template labels Feb 24, 2024
@cjlotz
Copy link
Contributor Author

cjlotz commented Feb 26, 2024

@yufeih is background-color classified as background graphics? All I'm looking for is for the area assigned to the code fence to have a different background color so that it is visible for the user from where they should be selecting the text to copy/paste and execute outside of the document.

@yufeih
Copy link
Contributor

yufeih commented Feb 26, 2024

Is background-color classified as background graphics?

You can save the page as PDF in the browser and test with "Background Graphics" off:

Screenshot 2024-02-26 at 9 06 38 PM

@cjlotz
Copy link
Contributor Author

cjlotz commented Feb 27, 2024

I can confirm that if I turn the Background graphics setting on, the background-color is indeed rendered correctly. Having a setting to opt into this behaviour will be great.

yufeih pushed a commit that referenced this issue Feb 28, 2024
Added pdfPrintBackground setting to include background graphics as part of pdf printing.  Fixes #9740 #9730
@yufeih yufeih closed this as completed Feb 28, 2024
p-kostov pushed a commit to ErpNetDocs/docfx that referenced this issue Jun 28, 2024
Added pdfPrintBackground setting to include background graphics as part of pdf printing.  Fixes dotnet#9740 dotnet#9730
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pdf Produce PDF as the output format
Projects
None yet
Development

No branches or pull requests

2 participants