[Public] Pdf/UA Conversion Turns Images and Boxes Gray
Instructions on fixing gray shading in Pdf/UA conversion
Description:
Images, SVGs, shadows, and Box elements may appear with gray shading while converting to Pdf/UA using ConvertToPdfUA
or SaveAsPdfUA
.
Reason:
Chromium struggles with paint order in Pdf/UA mode. Applying -webkit-filter: blur(0)
forces proper layer ordering, fixing the issue. While it doesn't visually blur anything, this CSS property forces Chromium to create a new compositing layer. This action triggers hardware acceleration and makes the browser re-evaluate how elements are stacked and painted, ultimately resolving the rendering issues in the PDF output. This solution is particularly useful for engines like PDFium or CEF that rely on Chromium's rendering capabilities.
Solution:
Add the following CSS to your HTML to resolve the issue:
Inline:
<html style="-webkit-filter: blur(0);">
CSS File:
html {
-webkit-filter: blur(0);
}
- May slightly impact performance on low-end devices due to forced hardware acceleration.
- In specific scenarios,
-webkit-filter: blur(0)
can affect z-index stacking. Adjustz-index
values as needed to maintain correct layering.