Commit af301d6d authored by Carsten  Rose's avatar Carsten Rose
Browse files

Replace pdftk by pdfunite. 'pdftk' is outdated. It's hard to install on Ubuntu...

Replace pdftk by pdfunite. 'pdftk' is outdated. It's hard to install on Ubuntu 18. It fails for recent PDFs. 'pdfunite' is based on poppler. URLs are preserved. Orientation and size are preserved.
parent be9506e3
Pipeline #1964 passed with stages
in 2 minutes and 54 seconds
......@@ -49,7 +49,7 @@ The following features are only tested / supported on linux hosts:
* General: QFQ is coded to run on Linux hosts, preferable on Debian derivates like Ubuntu.
* HTML to PDF conversion - command `wkhtmltopdf`.
* Concatenation of PDF files - command `pdftk`.
* Concatenation of PDF files - command `pdfunite`.
* Mime type detection for uploads - command `file`.
......@@ -65,12 +65,12 @@ To normalize UTF8 input, *php-intl* package is needed by
* normalizer::normalize()
For the `download`_ function, the programs `pdftk` and `file` are necessary to concatenate PDF files.
For the `download`_ function, the programs `pdfunite` and `file` are necessary to concatenate PDF files.
Preparation for Ubuntu::
sudo apt install php-intl
sudo apt install pdftk libxrender1 file pdf2svg # for file upload, PDF and 'HTML to PDF' (wkhtmltopdf), PDF split
sudo apt install poppler-utils libxrender1 file pdf2svg # for file upload, PDF and 'HTML to PDF' (wkhtmltopdf), PDF split
sudo apt install inkscape imagemagick # to render thumbnails
.. _wkhtml:
......@@ -981,7 +981,7 @@ Setup in configuration_
* *download*:
* During a download (especially by using wkhtml), temporary files are not deleted automatically. Also the
``wkhtmltopdf`` and ``pdftk`` commandlines will be logged to `SQL_LOG`_. Use this only to debug problems on download.
``wkhtmltopdf`` and ``pdfunite`` command lines will be logged to `SQL_LOG`_. Use this only to debug problems on download.
.. _REDIRECT_ALL_MAIL_TO:
......
......@@ -688,7 +688,7 @@ const SIP_TABLE = 'table'; // delete a record from 'table'
const SIP_URLPARAM = 'urlparam';
const SIP_SIP_URL = 'sipUrl';
const SIP_MAKE_URLPARAM_UNIQ = '_makeUrlParamUniq'; // SIPs for 'new records' needs to be uniq per TAB! Therefore add a uniq parameter
const SIP_DOWNLOAD_PARAMETER = '_b64_download'; // Parametername, filled in SIP, to hold all download element parameter.
const SIP_DOWNLOAD_PARAMETER = '_b64_download'; // Parameter name, filled in SIP, to hold all download element parameter.
const SIP_PREFIX_BASE64 = '_b64';
......
......@@ -102,8 +102,9 @@ class Download {
* @param array $files
*
* @return string - fileName of concatenated file
* @throws UserFormException
* @throws CodeException
* @throws DownloadException
* @throws UserFormException
*/
private function concatPdfFiles(array $files) {
......@@ -145,7 +146,9 @@ class Download {
throw new DownloadException('Error creating output file.', ERROR_DOWNLOAD_CREATE_NEW_FILE);
}
$cmd = "pdftk $inputFiles cat output $concatFile";
// $cmd = "pdftk $inputFiles cat output $concatFile 2>&1"; # Outdated. Hard to install on Ubuntu 18. Fails for recent PDFs.
// $cmd = "qpdf --empty --pages $inputFiles -- $concatFile 2>&1"; # Fails to merge identical files, if they contain references.
$cmd = "pdfunite $inputFiles $concatFile 2>&1"; // Based on poppler. URLs are preserved. Orientation and size are preserved.
if ($this->downloadDebugLog != '') {
Logger::logMessage("Download: $cmd", $this->downloadDebugLog);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment