ERROR -12 closing pdfwrite device in ghost script - linux

In our module we are using the ghost script to compress PDF of higher size to lower size use the command
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4
-sOutputFile=output.pdf input.pdf
while converting this we are getting an error as shown below
GPL Ghostscript 9.10: Unrecoverable error, exit code 1GPL Ghostscript 9.10: ERROR -12 closing pdfwrite device. See gs/psi/ierrors.h for code explanation
More Information:
we are using Ubuntu 14.04 OS.
Thanks, Praveen Ravipati

Thanks KenS, I found the cause of the issue. I verified the tmp directory while compressing the PDF . it taking the huge space and at some point of time tmp space is not enough to compress. So this is throwing io error. So to fix this i added extra space for tmp directory. then I checked again.It is fine

Related

'GPL Ghostscript 9.50: Annotation set to non-printing, not permitted in PDF/A, reverting to normal PDF output'. While converting PDF to PDFA (linux))

I'm using the latest version of Ghostscript "GPL Ghostscript 9.50 (2019-10-15)" but still I'm unable to convert PDF to PDF/A. The command which I used for conversion gs -dPDFA -dBATCH -dNOPAUSE -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -dPDFACompatibilityPolicy=1 -sOutputFile=output_filename.pdf input_filename.pdf it is saying that GPL Ghostscript 9.50: Annotation set to non-printing, not permitted in PDF/A, reverting to normal PDF output. Is there any problem with my command, if there so please let me know with a proper solution.
Thanks & Regards.

How to reduce (or optimize) size of recently built LFS?

As the title shows, I've recently built an LFS (version 8.3), with jhalfs.
So with du -h, the size of the whole partition is about 4.5 GB
(I've already deleted all the files in /sources).
Executing this command that shows what are the big files in the system : du -a / | sort -n -r | head -n 10 , shows this result :
Does anyone know how can I optimize and reduce my partition (what files / packages /or repertories to erase) without breaking the OS ?
The goal is reaching an operating system that turns around 400 or 300 MB.
Thank you
Aside from removing /tools and maybe also docs (/usr/share/doc, /usr/share/man) you can also strip debugging symbols from all the libraries and executables. This is done using strip(1) utility; detailed instructions can be found in the LFS book, section "Stripping Again".

Ghostscript not prining accented characters correctly

I have a Bash script that writes a text watermark to PDF files. It does this by generating an overlay PDF with Ghostscript and then using PDFtk to stamp the overlay onto the original.
All this works perfectly, except that Ghostscript is not writing accented characters correctly. If my input text is, for example, "Français", the output on the PDF will be "Franˆ§ais".
My Ghostscript command line is:
/usr/local/bin/gs -q -o "${TEMPFILE}" \
-sDEVICE=pdfwrite -sPAPERSIZE=letter \
-c "60 23 moveto 0.32 0.23 0.22 setrgbcolor /Helvetica-Oblique findfont 9 scalefont setfont (${WATERMARK}) show"
The $WATERMARK variable contains a single line of text to be written. The problem occurs both when running the Bash script that contains this line and also when I run just this command directly.
I'm seeing this problem using Ghostscript 9.06 on Mac OS X (installed via Homebrew) and 9.05 on Ubuntu 12.04 (installed from the Ubuntu package repository). The Bash script and gs command line were both written by someone else; I have no experience using Ghostscript myself.
Changing the font has no effect on the problem and I've been unable to google anything useful related to this. What are we doing wrong here?
Thanks.
You haven't encoded the font correctly (or indeed at all).
You are assuming that the character code which represents the glyph named ccedilla is the same in the font as it is on your computer system. For Latin fonts, and the ASCII characters up to 127 this is usually true, for characters beyond that it usually isn't and for non-Latin languages (eg Russian, Arabic, CJKV languages, etc) it isn't true at all.
Encoding fonts isn't hard, but it is rather lengthy to go into here, so instead let me recommend the excellent series of articles written by John Deubert of Acumen Training, you can find them here:
http://www.acumentraining.com/acumenjournal.html
For your purposes I suggest the November and December 2001 articles.

Repair apparently damaged pdf and reduce file size

I have a PDF file (4.6MB) which was made by combining 6 different PDFs (containing both text and bitmap graphics) using pdftk in Ubuntu 12.04. I wish to compress this file to something close to 2MB without affecting its quality.
I have tried pdftk's "compress" option (couldn't compress it to 2 MB), also tried converting it to ps first and than back to pdf, it gives the following warning:
****Warning: considering '0000000000 XXXXX n' as a free entry.
and then hangs. qpdf also failed saying that the file is damaged.
Could someone help me out?
What result does Ghostscript give you? Try this command:
gs \
-o output.pdf \
-sDEVICE=pdfwrite \
-dPDFSETTINGS=/screen \
input.pdf
has this pdf file reserved infos? If it has no confidential data it would be interesting to see
anyway many times where qpdf fails, Multivalent works
you can try to use its Compress tool (it also attempts to repair pdf file)
Multivalent
https://rg.to/file/c6bd7f31bf8885bcaa69b50ffab7e355/Multivalent20060102.jar.html
(latest free version with tools included, current has no tools in itself)
java -cp path....to/Multivalent.jar tool.pdf.Compress file.pdf
This works for me to repair the damaged PDF
sudo apt-get install mupdf-tools
mutool clean input.pdf output.pdf

Problems with linux Imagemagick converting PDFs to JPGs

The system I'm using uses the linux utility convert to convert pdfs to jpgs. My box gives me the following error.
>$ convert Badge-1114044091.pdf Badge-1114044091.jpg
convert: Postscript delegate failed `Badge-1114044091.pdf'.
convert: missing an image filename `Badge-1114044091.jpg'.
But the production machine does not. According to
>$ convert -version
my version is the same as the prodution machine. I'm not sure exactly how to check if postscript needs to be updated. Not really a huge linux guru.
EDIT: Upon suggestion, I checked Ghostscript. The following was already installed.
>$ gs -version
ESP Ghostscript 8.15.3 (2006-08-25)
Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved.
Install GhostScript.
http://www.ghostscript.com/
ImageMagick (the 'convert' utility) doesn't actually convert PDFs; it invokes GhostScript using an arcane command like
gs -q -sDEVICE=jpeg -dBATCH -dNOPAUSE -dFirstPage=1 -dLastPage=1 -r<OUTPUT RESOLUTION> -sOutputFile=<OUTPUT>.jpg <INPUT>.pdf 2>&1
You might want to try that command directly if you want more control.

Resources