Change to poppler for pdf conversion
This commit is contained in:
parent
b705cc28ea
commit
69fa9e52fb
1 changed files with 8 additions and 9 deletions
|
@ -4,13 +4,12 @@
|
||||||
void ConvertWorker::convertPdf(QNetworkRequest request, QString filename, QTemporaryFile* tempfile)
|
void ConvertWorker::convertPdf(QNetworkRequest request, QString filename, QTemporaryFile* tempfile)
|
||||||
{
|
{
|
||||||
|
|
||||||
QProcess* muraster = new QProcess(this);
|
QProcess* pdftoppm = new QProcess(this);
|
||||||
muraster->setProgram("/home/nemo/stuff/bin/muraster");
|
pdftoppm->setProgram("pdftoppm");
|
||||||
muraster->setArguments({"-F", "pgm", filename});
|
pdftoppm->setArguments({"-gray", "-rx", "300", "-ry", "300", filename});
|
||||||
|
|
||||||
|
|
||||||
QProcess* ppm2pwg = new QProcess(this);
|
QProcess* ppm2pwg = new QProcess(this);
|
||||||
qDebug() << SailfishApp::pathTo("ppm2pwg").toString();
|
|
||||||
QString Ppm2pwgPath = SailfishApp::pathTo("ppm2pwg").toString().remove("file://");
|
QString Ppm2pwgPath = SailfishApp::pathTo("ppm2pwg").toString().remove("file://");
|
||||||
ppm2pwg->setProgram(Ppm2pwgPath);
|
ppm2pwg->setProgram(Ppm2pwgPath);
|
||||||
QStringList env; // {"PREPEND_FILE="+tempfile->fileName()};
|
QStringList env; // {"PREPEND_FILE="+tempfile->fileName()};
|
||||||
|
@ -25,24 +24,24 @@ void ConvertWorker::convertPdf(QNetworkRequest request, QString filename, QTempo
|
||||||
|
|
||||||
ppm2pwg->setEnvironment(env);
|
ppm2pwg->setEnvironment(env);
|
||||||
|
|
||||||
muraster->setStandardOutputProcess(ppm2pwg);
|
pdftoppm->setStandardOutputProcess(ppm2pwg);
|
||||||
ppm2pwg->setStandardOutputFile(tempfile->fileName(), QIODevice::Append);
|
ppm2pwg->setStandardOutputFile(tempfile->fileName(), QIODevice::Append);
|
||||||
|
|
||||||
connect(muraster, SIGNAL(finished(int, QProcess::ExitStatus)), muraster, SLOT(deleteLater()));
|
connect(pdftoppm, SIGNAL(finished(int, QProcess::ExitStatus)), pdftoppm, SLOT(deleteLater()));
|
||||||
connect(ppm2pwg, SIGNAL(finished(int, QProcess::ExitStatus)), ppm2pwg, SLOT(deleteLater()));
|
connect(ppm2pwg, SIGNAL(finished(int, QProcess::ExitStatus)), ppm2pwg, SLOT(deleteLater()));
|
||||||
|
|
||||||
qDebug() << "All connected";
|
qDebug() << "All connected";
|
||||||
|
|
||||||
|
|
||||||
muraster->start();
|
pdftoppm->start();
|
||||||
ppm2pwg->start();
|
ppm2pwg->start();
|
||||||
|
|
||||||
qDebug() << "Starting";
|
qDebug() << "Starting";
|
||||||
|
|
||||||
|
|
||||||
if(!muraster->waitForStarted())
|
if(!pdftoppm->waitForStarted())
|
||||||
{
|
{
|
||||||
qDebug() << "muraster died";
|
qDebug() << "pdftoppm died";
|
||||||
tempfile->deleteLater();
|
tempfile->deleteLater();
|
||||||
emit failed();
|
emit failed();
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue