如何为启用 CSP 的嵌入式 PDF 查看器设置 CSS

Pet*_*adt 5 css pdf content-security-policy

我遇到以下问题:已设置

Content-Security-Policy style-src 'self' 
Run Code Online (Sandbox Code Playgroud)

在 .htacess 文件中,chrome 在显示像<a href="file.pdf">.

Refused to apply inline style because it violates the following
Content Security Policy directive: "style-src 'self'". Either the
'unsafe-inline' keyword, a hash ('sha256-[deleted]'), or a nonce
('nonce-...') is required to enable inline execution.
Run Code Online (Sandbox Code Playgroud)

我还可以看到 chrome 将一些 css 应用于 PDF 显示:

element.style {
background-color: rgb(38,38,38);
height: 100%;
width: 100%;
overflow: hidden;
margin: 0;
}
Run Code Online (Sandbox Code Playgroud)

当然,简单的方法是将 .htaccess 中的 CSP 设置更改为

Content-Security-Policy style-src 'self' 'unsafe-inline'
Run Code Online (Sandbox Code Playgroud)

但这会损害安全。我也犹豫给我无法控制的代码散列。所以问题是:如何为链接到的 PDF 文件指定 CSS 代码?