24#include <kgenericfactory.h>
26#include <KoFilterChain.h>
33#include "pscommentlexer.h"
35class EpsImportFactory : KGenericFactory<EpsImport, KoFilter>
38 EpsImportFactory( void )
39 : KGenericFactory<EpsImport, KoFilter>( "karbonepsimport" )
43 virtual void setupTranslations( void )
45 TDEGlobal::locale()->insertCatalogue( "kofficefilters" );
49K_EXPORT_COMPONENT_FACTORY( libkarbonepsimport, EpsImportFactory() )
51EpsImport::EpsImport( KoFilter*, const char*, const TQStringList& )
56EpsImport::~EpsImport()
60KoFilter::ConversionStatus
61EpsImport::convert( const TQCString& from, const TQCString& to )
64 to != "application/illustrator" ||
66 from != "image/x-eps" &&
67 from != "application/postscript" ) )
69 return KoFilter::NotImplemented;
73 TQString input = m_chain->inputFile();
77 int llx = -1, lly = -1, urx = -1, ury = -1;
78 BoundingBoxExtractor extractor;
82 if ( file.open(IO_ReadOnly) )
84 extractor.parse(file);
85 llx = extractor.llx();
86 lly = extractor.lly();
87 urx = extractor.urx();
88 ury = extractor.ury();
92 tqDebug ( "file could not be opened");
95 TQString sedFilter = TQString ( "sed -e \"s/%%BoundingBox: 0 0 612 792/%%BoundingBox: %1 %2 %3 %4/g\"").
96 arg(llx).arg(lly).arg(urx).arg(ury);
100 "gs -q -P- -dBATCH -dNOPAUSE -dSAFER -dPARANOIDSAFER -dNODISPLAY ps2ai.ps ");
101 command += TDEProcess::quote(input);
103 command += sedFilter;
105 command += TDEProcess::quote(m_chain->outputFile());
107 tqDebug ( "command to execute is (%s)", TQFile::encodeName(command).data());
110 if( !system( TQFile::encodeName(command)) )
113 return KoFilter::StupidError;
116#include "epsimport.moc"
|