I reproduce the problem with versions 13.0.0 and 12.3.1 on Windows 10 x64, but not with version 8.0.4 on the same machine.
The issue happens when we Export
to PDF a Graphics
object containing a Rectangle
or Polygon
primitive with Opacity
directive. A minimal example:
gr = Graphics[{Opacity[0.5], Rectangle[]}];
Export["test.pdf", gr] // SystemOpen
In the exported file opened by Adobe Acrobat Reader the rectangle has an unwanted outline:
To explore the problem deeper, I define an auxiliary function that exports supplied expression to PDF, and then immediately imports the results as vector graphics:
vectorExportImportPDF[expr_] :=
First@ImportString[ExportString[expr, "PDF", "AllowRasterization" -> False],
If[$VersionNumber >= 12.2, {"PDF", "PageGraphics"}, {"PDF", "Pages"}],
"TextOutlines" -> False];
Apply it to the above Graphics
:
vectorExportImportPDF[gr] // ResourceFunction["ShortInputForm"]
We see that imported graphics contains an explicit outline defined via JoinedCurve
. We can see the outline alone if we remove the FilledCurve
object:
vectorExportImportPDF[gr] /. _FilledCurve -> {}
Apparently, it is a bug. Reported to the support as [CASE:4899765].
A solution that respects the Opacity
would be nice to have
A workaround is to Export
a FilledCurve
, but not Rectangle
or Polygon
primitive:
gr2 = vectorExportImportPDF[gr] /. _JoinedCurve -> {};
vectorExportImportPDF[gr2] // ShortInputForm