Viewer for PDF images

I’ve made a prototype work (without error checking or resource freeing) and with that one can freely plot existing PDFs into CairoMakie Figures. Whoever is motivated could turn that easily into a small CairoMakie extension package:

The usage part looks like this:

f = lines(cumsum(randn(100)), color = :red; figure = (resolution = (400, 300)))
CairoMakie.save("f1.pdf", f)
f = lines(cumsum(randn(100)), color = :blue; figure = (resolution = (400, 300)))
CairoMakie.save("f2.pdf", f)

##

f = Figure(resolution = (600, 800))
pdf!(f.scene, path = "f1.pdf", bbox = (BBox(0, 600, 400, 800)))
pdf!(f.scene, path = "f2.pdf", bbox = (BBox(0, 600, 0, 400)))
CairoMakie.save("f1_f2.pdf")

And the end result:

5 Likes