Ghostscript not printing correctly A5 landscape pdf - printing

We have a little app detecting changes on some sftp server folders and printing automatically any new document. We set up this app, working for some years now in a warehouse in Europe, on a new warehouse in U.S but it fails to print correctly A5 documents.
The program uses ghostscript to do the printing and passes a set of arguments for A4 printers :
-dColorImageResolution=150 -dDownsampleColorImages=true -sDEVICE=pdfwrite -dQUIET -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dPrinted -dBATCH -dNOPAUSE -sDEVICE=mswinpr2 -dNoCancel -sOutputFile="%printer%{0}" "{1}"
And for A5 printers :
-sPAPERSIZE=a5 -dFIXEDMEDIA -dPDFFitPage -dColorImageResolution=150 -dDownsampleColorImages=true -sDEVICE=pdfwrite -dQUIET -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dPrinted -dBATCH -dNOPAUSE -sDEVICE=mswinpr2 -dNoCancel -sOutputFile="%printer%{0}" "{1}"
The issue is that when we put the same configuration into our U.S printers, the pdfs in A5 landscape print on portrait orientation. We changed the configuration using options like dAutoRotatePages=(/PageByPage, /None, /All), tried remove dPDFSETTINGS=/screen and many other thing (I lost count sorry) and at best we can print the page in landscape but very offsetted on the right (like it doesn't understand anymore that the format is A5).
The printer is a Lanier PC600 I believe and here is the pdf I try to print:
https://drive.google.com/file/d/1VFnsBBnGf6MbJHdwmfD0Lc_QKGWznsFA/view?usp=sharing
Does someone has an idea on why this problem happens?
Thank you

Related

Printing really long prints on Epson Thermal Printers

Working on a project where I'm printing really long prints on epson thermal printers (80mm x 18000mm) (length is variable per print).
My documents are set up as 1000mm long pages ie 14000mm print is 14 pages.
I'm able to print a correct length document with this command
lp -d 10_0_0_11 -o media=Custom.80x18000mm -o PageSize=Custom.80x1000mm -o TmtPaperSource=DocNoFeedCut -o landscape -o fit-to-page -o outputorder=reverse -o TmtSpeed=1 -o TmtPaperReduction=Both example/url/to/document
But this is really slow and don't want to use the command line for convenience.
When printing the document via Preview MacOS it only prints a portion of the document at the printer's max print size of 80x297mm. I have a custom page size of 80x1000mm setup but it seems to be ignoring that.
Any better workaround to gain the extra speed printing without the command line?

Ghostscript - virtual printer output is only A4

I'm using ghostscript for Virtual Printer and I installed it according to this manual: http://www.stat.tamu.edu/~henrik/GSPSprinter/GSPSprinter.html
The problem is, that it prints everything in A4 no matter how big document is. (or what I set in dialog box). I need to print documents from MS Word sometimes in A3 and sometimes in A4, so I didn't set the default paper size.
My setting right now is like this:
-Ic:\gs\gs8.14\lib;c:\gs\fonts
-sDEVICE=mswinpr2
-dNoCancel
-dNOPAUSE
-dSAFER
I tried it with
-sPAPERSIZE=A4
and
-sPAPERSIZE=A4
-sPAPERSIZE=A3
but didn't get any positive result.
Do you have any idea how to set it?
Thanks, Laura
Use this:
-sPAPERSIZE=a4
-sPAPERSIZE=a3
(a instead of A)

ImageMagick pdf to black and white pdf

I would like to convert a pdf file to a Black and White PDF file with ImageMagick. But I've got two problems:
I use this command:
convert -colorspace Gray D:\in.pdf D:\out.pdf
But this command convert only the FIRST page... How to convert all pages?
After use this command the resolution is terrible... but if I use -density 300 option the file size has increased more than double. So I would like to use the same DPI setting, but how to use?
Thanks a lot
Assuming you have all the necessary command line tools installed you can do the following:
Split and join PDF using pdfseparate and pdfunite (Poppler tools).
Extract the original density using pdfinfo plus grep/egrep and, for instance, sed. This will not guarantee the same size of the PDF file, just the same DPI.
Putting it all together you can have a series of bash commands as following:
pdfseparate in.pdf temp-%d.pdf; for i in $(seq $(ls -1 temp-*.pdf | wc -l)); do mv temp-$i.pdf temp-$(printf %03d $i).pdf; done
for f in temp-*.pdf; do convert -density $(pdfinfo $f | egrep -o 'Page size:[[:space:]]*[0-9]+(\.[0-9]+)?[[:space:]]*x[[:space:]]*[0-9]+(\.[0-9]+)?' | sed -e 's/^Page size:\s*//'| sed -e 's/\s*x\s*/x/') -colorspace Gray {,bw-}$f; done
pdfunite bw-temp-*.pdf out.pdf
rm {bw-,}temp-*.pdf
Note 1: there as a dirty workaround (for/wc/seq/printf) for a proper ordering of 10-999 pages PDFs (I did not figure out how to put leading zeros in pdfseparate).
Note 2: I guess ImageMagick treats PDFs as just another binary image file so for instance for mainly text files this will result in huge PDFs. Thus, this is a very bad method to convert text-based PDFs to B&W.

How to print Java code on A3 page avoiding line-wrapping

I have to print Java code that some times reaches 300 columns (characters per line) in A3 paper and whatever editor I use (e.g. textmate) wraps the lines in order to fit in A4 paper.
Any suggestions?
cheers,
Asterios
Your editor undoubtably has either a Page Setup dialog or a Preferences dialogue as part of the Print Dialogue which will allow you to set the Paper Size to use for printing.
Even Notepad supports this
I finally made it to print using enscript. Here is the command I used to print Java code into PDF (and the used the pdf to print).
enscript -r -Ejava -M A3 -C -f "Courier8" input.java -o - | ps2pdf - output.pdf
where:
-r prints in landscape mode
-C prints the line numbers
-f changes the font and size
-M sets the output media to A3 (default is A4)
-Ejava adds syntax highlighting (you can also use --color if you need
colors in syntax highlighting but
they are not nicely printed in
greyscale)
It seems unlikely that every editor tries to format for A4. Which other editors have you tried? Does textmate not have a page size option? (Hmm... seems not)
Try a different editor that does let you set page size. Word, even.

On Ghostscript: Fastest way to create a blank .tif document

A legacy backend requires the email body with a .tif document, no tif and it fails. So i need to generate a blank .tif, is there a fast way to do this with ghostscript?
edit: make once in project installation use when i need it.
The following line will produce a 1 pixel Tiff file (340 bytes). That's the smallest Tiff file I could get.
gswin32c.exe -q -dNOPAUSE -sDEVICE=tiffpack -g1x1 -sOutputFile=small.tif -c newpath 0 0 moveto 1 1 lineto closepath stroke showpage quit
Actually, you can even reduce the command to:
gswin32c.exe -q -dNOPAUSE -sDEVICE=tiffpack -g1x1 -sOutputFile=small.tif -c showpage quit
without size gain, alas.
Couldn't you make your blank .tif file once and then attach the same file every time it is needed?
Might be something here: Re: [R] Making TIFF images with rtiff

Resources