I am trying to export a ContourPlot with a Barlegend to pdf. Here's the simplest example (just the legend)
(Export["legend.pdf", #]; #) &@BarLegend["Rainbow"]
The output in the Notebook looks fine, but the pdf version has some white spaces on the top and the bottom, and some weird ticks on the bottom. I'm attaching a screenshot of the notebook output and the pdf.
I am on MacOS 15.5 and Mathematica 14.3. I tried with Mathematica on a Windows computer and there the pdf exports fine.
Any ideas? Thanks!

