[Scribus] Scribus cmdline import/export (patch)

Craig Ringer craig
Sun Sep 25 10:16:40 CEST 2005


On Sat, 2005-09-24 at 23:26 -0700, Bryce Harrington wrote:
> Hi Peter and Craig,
> 
> A while back we discussed an idea of packaging the scribus pdf/ps
> import/export code for use with Inkscape, since Inkscape's pdf/ps
> (esp. EPS import) support is so poor.

Indeed. It's a nice idea. Much of the current PS/PDF import and export
code is very tightly Scribus specific though, and it all uses a lot of
Qt container classes etc. I'm not sure how practical that'd be.

> However it occurs to me that another solution would be to simply give
> scribus some commandline options for doing import/export.  E.g.
> 
>     scribus -i filename.eps -e filename.svg

This has been desired for a long time. See
http://bugs.scribus.net/view.php?id=238 . We're still not at the point
where that's quite practical, though we're certainly getting there. 

Being able to do it without an X-server and with a low startup time may
well be post-Qt4-migration stuff though (Riku will know much more than
me about this).

> I looked into the scribus code a bit to see how this could be
> implemented.  I wasn't sure how to call the import/export plugins

As chance would have it, that's something I'm going to be working on
soon. There's just a pile of university stuff to deal with first.

For importers/exporters that already have plugins, you can use the
plugin manager to call them. There's code in fileloader.cpp for that,
but it might be a bit tricky to follow.

The general approach you could take is:

#include "scplugin.h"
#include "pluginmanager.h"

ScActionPlugin* plug = dynamic_cast<ScActionPlugin*>(PluginManager::instance().getPlugin("importps"));
if (plug)
{
    bool result = plug->run("/path/to/PS-file-to-import");
    // Act on result code
}
else
{
   // Inform the user that you couldn't do what they asked because
   // you couldn't access the required plugin.
}

There is currently no good way to enumerate supported formats, etc,
automatically. That's planned, though, and should hopefully happen
during 1.3.2cvs development.

Once that's done, your TODO should simply become a call into FileLoader.

--
Craig Ringer





More information about the scribus mailing list