Re: [diagrams] embed vector image (eps or pdf)?

30 views
Skip to first unread message

Brent Yorgey

unread,
Feb 16, 2013, 9:28:16 AM2/16/13
to diagrams...@googlegroups.com
On Sat, Feb 16, 2013 at 03:37:22AM -0800, Stefan Kersten wrote:
> hi,
>
> i'd like to use diagrams for compositing two vector images (eps or pdf) by
> scaling, rotating and placing them on a canvas. does one of the backends
> support inclusion of vector images? i could convert the input to png, but
> i'd like to stay in the "vector domain".
>
> thanks for any pointers,
> sk

Currently, no, though this would make a lot of sense. I have looked
into importing EPS or PDF into cairo a bit, and there's no obvious way
to do it -- though I've found bits and pieces here and there
suggesting it might be possible.

Ryan, how difficult would it be to add support for importing EPS files
in the postscript backend?

-Brent

Ryan Yates

unread,
Feb 16, 2013, 9:37:05 AM2/16/13
to diagrams...@googlegroups.com
I'm not sure what is usually supported by most Postscript interpreters (I can do some experiments to see), but the language includes a `run` procedure that loads and runs a file and an `exec` procedure that can be used to execute some string.  It is quite common in a PDF to have many embedded streams that can be referenced in several places.  Postscript should be able to handle that fine, but EPS might not be friendly to either `run` or `exec`.  Certainly this would cause problems for many EPS importers (they are often quite bad at actually running the code and just assume that it takes a particular form and parse that).  Bottom line, it could be as simple as emitting "(filename.eps) run" in the right place in the file.

I'll do some experiments and see what form will work for things like epstopdf to see if it will work in common workflows.

Ryan



--
You received this message because you are subscribed to the Google Groups "diagrams-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diagrams-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Ryan Yates

unread,
Feb 16, 2013, 12:34:53 PM2/16/13
to diagrams...@googlegroups.com
SVG should be pretty straight forward using <image ... xlink:href=...> for external references.  I think there is an easy way to embed resources as well.

Brent Yorgey

unread,
Feb 16, 2013, 1:10:20 PM2/16/13
to diagrams...@googlegroups.com
Ah, cool. Note there is already an open issue for this:
https://github.com/diagrams/diagrams-svg/issues/11 . Anyone is
welcome to have a go.

-Brent

Stephen Tetley

unread,
Feb 17, 2013, 2:33:05 AM2/17/13
to Ryan Yates, diagrams...@googlegroups.com
Hi Ryan - I think that one of the Adobe PostScript reference documents
covers this, I'll have a look for it.

On 16 February 2013 14:37, Ryan Yates <fryg...@gmail.com> wrote:
> I'm not sure what is usually supported by most Postscript interpreters (I
> can do some experiments to see), ...

Stephen Tetley

unread,
Feb 17, 2013, 12:57:08 PM2/17/13
to Ryan Yates, diagrams...@googlegroups.com
The Encapsulated PostScript File Format Specification is the one I was
thinking of, particularly chapter 3 and the example.

http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf

Bill Casselman book, which I think is available on his website (see
Stefan's link), also covers embedding EPS files
Reply all
Reply to author
Forward
0 new messages