From 5effa4059f72de018dc9fa30ef62c9f6db48ee07 Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Sat, 25 May 2013 11:25:40 +0200 Subject: [PATCH] use tiff2pdf instead of converting first to ps and then to pdf this is not only a lot faster, but also allows lossless conversion. Along that line, don't try to alter the pagesize during conversion to PDF. PDF-viewer applications do a great job adjusting to the paper-size as the user wants it, so let the user make the decision. After all when having the PDF, it is unlikely that it will be printed out anyway. --- docs/manual-de.docbook | 16 ++++------------ docs/manual.docbook | 15 ++++----------- scripts/helpers.pyin | 6 +++--- 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/docs/manual-de.docbook b/docs/manual-de.docbook index e51c2de..422d355 100644 --- a/docs/manual-de.docbook +++ b/docs/manual-de.docbook @@ -248,22 +248,14 @@ - tiff2ps - Ein kleines Utility, um TIFF-Dateien ins Postscript-Format zu + tiff2pdf + Ein kleines Utility, um TIFF-Dateien verlustfrei ins PDF-Format zu konvertieren. Es wird von den Standard-Skripten benötigt, um Faxe in PDF-Dateien - umzuwandeln (SFF->TIFF->PS->PDF :-} ). Es ist oft in einem Paket namens + umzuwandeln (SFF->TIFF->PDF :-} ). Es ist oft in einem Paket namens tiff oder tifftools enthalten. Details unter - - ps2pdf - Noch ein kleines Utility für die Kette SFF->PDF - diesmal für - die Konvertierung von Adobe PostScript in Adobe PDF. Es ist bei Ghostscript - dabei, sodass Sie es höchst wahrscheinlich bereits haben. - () - - aktueller Ghostscript mit cfax-Patch Aktuelle Ghostscript-Versionen enthalten ein Device, um die @@ -1976,7 +1968,7 @@ is not present, current time as returned by localtime() is used. sfftobmp -tif myfile.sff outfile.tiff Sie erhalten eine TIFF-Datei, die Sie mit den TIFF-Tools (z.B. - tiff2ps) in nahezu jedes andere nützliche Format + tiff2pdf) in nahezu jedes andere nützliche Format konvertieren können. diff --git a/docs/manual.docbook b/docs/manual.docbook index 144ab02..6b94ad9 100644 --- a/docs/manual.docbook +++ b/docs/manual.docbook @@ -224,20 +224,13 @@ - tiff2ps - A small utility to convert TIFF files to the Postscript format. It's needed by - the default script to convert faxes to PDF files (SFF->TIFF->PS->PDF :-} ). + tiff2pdf + A small utility to losslessly convert TIFF files to the PDF format. It's needed by + the default script to convert faxes to PDF files (SFF->TIFF->PDF :-} ). It's often included in a package called tiff or tifftools. Details on - - ps2pdf - Again a small utility for the SFF->PDF chain - this time for the - conversion of Adobe PostScript to Adobe PDF. It's part of Ghostscript, so - you most likely have it already. () - - current Ghostscript with cfax patch Current Ghostscript versions will include a device to create the above mentioned @@ -1788,7 +1781,7 @@ is not present, current time as returned by localtime() is used. sfftobmp -tif myfile.sff outfile.tiff This will give you a TIFF file which you can convert now to nearly - any other useful format with the TIFF tools, for example tiff2ps. + any other useful format with the TIFF tools, for example tiff2pdf. Color faxes - the CFF format diff --git a/scripts/helpers.pyin b/scripts/helpers.pyin index 652bcf2..6922892 100644 --- a/scripts/helpers.pyin +++ b/scripts/helpers.pyin @@ -23,7 +23,7 @@ if sfftobmp_major_version <= 2: __call('sff to tif', "sfftobmp", "-tif", infile, outfile) else: def sff2tif(infile, outfile): - __call('sff to tif', "sfftobmp", "-tif", infile, "-o", outfile) + __call('sff to tif', "sfftobmp", "-q", "-t4", infile, "-o", outfile) # Note: readConfig is now imported from capisuite.config @@ -129,13 +129,13 @@ def sendMIMEMail(mail_from, mail_to, mail_subject, mail_type, # convert sff -> tif sff2tif(attachment, "%s.tif" % basepath) # convert tif -> ps -> pdf - cmd = "tiff2ps -h11 -H12 -L.5 -w8.5 -a %s | ps2pdf -sPAPERSIZE=a4 - -" % escape("%s.tif" %basepath) + cmd = "tiff2pdf %s" % escape("%s.tif" %basepath) try: status, content = commands.getstatusoutput(cmd) finally: os.unlink("%s.tif" % basepath) if status: - raise ConvertionError("Error while calling tiff2ps or ps2pdf. " + raise ConvertionError("Error while calling tiff2pdf. " "Not installed?") filepart = email.MIMEBase.MIMEBase("application","pdf", name = "%s.pdf" % basename)