-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
When trying to write a cairo surface to a file, it is not possible to distinguish whether the surface object is a pdf or svg surface.
MWE:
using Cairo
function Base.write(filename::String, surface::Cairo.CairoSurfaceIOStream)
finish(surface)
seek(surface.stream, 0)
open(filename, "w") do io
write(io, read(surface.stream, String))
end
return
end
c = CairoSVGSurface(IOBuffer(), 1000, 600);
write("output.svg", c) # this works fine
write("output.pdf", c) # this would also have worked but the output file would not really be a pdfIs there a convenient way to enforce that the file extension matches the type of Cairo stream?
Right now both CairoSVGSurface and CairoPDFSurface outputs a CairoSurfaceIOStream which makes it not possible to dispatch between the two.
mattuntergassmair
Metadata
Metadata
Assignees
Labels
No labels