Adobe Acrobat does not render and complains with the following error if we open svg_example.pdf generated by example/svg.rs, though browsers render it.
As far as I have investigated, this is caused by the following ColorSpace resource being defined incorrectly.
|
( |
|
"Resources", |
|
DictItem::Dict { |
|
map: [( |
|
"ColorSpace".to_string(), |
|
DictItem::Name(ColorSpace::Rgb.as_string().into()), |
|
)] |
|
.into_iter() |
|
.collect(), |
|
}, |
|
), |
It should be defined something like below.
https://github.com/kyasu1/printpdf/blob/2cca445ddbcb672a0f8d75e9cb717431f11ca644/src/svg.rs#L85-L102
(
"Resources",
DictItem::Dict {
map: [(
"ColorSpace".to_string(),
DictItem::Dict {
map: [(
"cs0".to_string(),
DictItem::Name(ColorSpace::Rgb.as_string().into()),
)]
.into_iter()
.collect(),
},
)]
.into_iter()
.collect(),
},
),
With this modification, the pdf is rendered as expected.
However, the error dialog is still shown. It is caused by the camera svg which contains unsupportedPattern and Shading resources. Supporting them is another story.
Anyway, hardcoding the name cs0 is not the correct approach. Instead, we need to figure out how to look up all ColorSpaces defined in the PDF file.
Adobe Acrobat does not render and complains with the following error if we open
svg_example.pdfgenerated byexample/svg.rs, though browsers render it.As far as I have investigated, this is caused by the following
ColorSpaceresource being defined incorrectly.printpdf/src/svg.rs
Lines 85 to 95 in ac411a8
It should be defined something like below.
https://github.com/kyasu1/printpdf/blob/2cca445ddbcb672a0f8d75e9cb717431f11ca644/src/svg.rs#L85-L102
With this modification, the pdf is rendered as expected.
However, the error dialog is still shown. It is caused by the camera svg which contains unsupported
PatternandShadingresources. Supporting them is another story.Anyway, hardcoding the name
cs0is not the correct approach. Instead, we need to figure out how to look up allColorSpaces defined in the PDF file.