I have Dymo labelwriter printer:
Which is used to print labels in sticker model 11356 (40mm, 80mm)
In Ghostscript which settings can be adjusted to tell it's not A4 nor A5, B5, EnvC5, but it has to be 40mm, 80mm? I tried following parameters, but it's not printing to 1 sticker, instead it keeps pushing out 20 stickers and printing in wrong label locations.
MediaSize A4
MediaSize A5
MediaSize B5
MediaSize EnvC5
MediaSize EnvDL
MediaSize EnvISOB5
MediaSize Postcard
MediaSize DoublePostcard
Therefore, I also have the PDF file itself made into 40mm by 80mm. But it keeps failing to print on 1 label/sticker.
How do I tell Ghostscript just to print the PDF with its exact default size. Without Ghostscript when I print the PDF it works perfectly but the moment I use Ghostscript it's doing abnormal paper settings and printing abnormally.
You have not said how you are using Ghostscript. Which device are you using CUPS, mswinpr2, something else ?
All the Ghostscript devices will honour the media request from PostScript or PDF, and this will override any command line switch, unless you also set -dFIXEDMEDIA.
You haven't quoted an exact command line; but the MediaSize switch is deprecated and should not be used.
I'm going to guess that you are using mswinpr2, in which case Ghostscript will be using the default Media Size configured in the printer. I that's not correct, you need to alter it.
Related
I have a PostScript file with image and text. I want to print it to a laser printer so that the images print in a halftone round pattern.
I am trying to print it from the command line. I would prefer a PDF output first and then I'll print to the laser printer.
I have an HP Laserjet P2015 printer installed in Windows 10.
gswin64c.exe -dQUIET -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=output.pdf test.ps -c "<< /HalftoneType 1 /Frequency 37 /Angle 45 /SpotFunction {180 mul cos exch 180 mul cos add 2 div} >> sethalftone"
The PDF file is generated. However, the images does not appear to be in Round Halftone format. I see no change in the image.
This is the original Image
I want the printout to look like this: Required output
For some reason the output is the same as the original.
pdfwrite doesn't create monochrome output, so no, the output won't be halftoned. The whole point of the pdfwrite device is to maintain the output as close in quality as possible to the input.
There is no way to get monochrome output from pdfwrite unless the monochrome is in the input.
If you instead use a monochrome output device (e.g., tiffg3 or tiffg4) you should see a difference, unless the input file (which you haven't supplied) also sets a screen, in which case the last one encountered will take effect. That is, if the PostScript input file specifies a halftone screen, that's the one that will get used.
What you are asking for is what I might generally describe as a hard problem, probably much harder than you expect.
Your best bet is to send the PostScript directly to the printer, since it supports PostScript.
Problem 1; your PostScript file may already contain a halftone in it which overrides the one you want to use. You can usually prevent that by redefining the sethalftone and setscreen operators:
/sethalftone {pop} bind def
/setscreen {pop pop pop} bind def
You do that after you'[ve defined your own halftone, obviously. Or you can just edit the PostScript file and remove the halftone definition, its usually not that hard to find.
Problem 2 is that printer manufacturers sometimes 'tweak' the interpreter to always use their preferred halftone and prevent you overriding it in PostScript. The only way to find out if that's happening is to try a quick test; print a simple image with the default screen, then set a really coarse screen, say 10 lpi and print the same image. If there's no difference then you know that's not a viable option. If there is, then you can just set the screen you want.
Now, if the printer won't let you change the halftone then the only solution is to render the PostScript to an image using Ghostscript (which will let you change the halftone) and then send the resulting image to the printer. You will need to use a 1 bpp device, something like tiffg3 or tiffg4 should work fine.
The problem here is that you need to ensure that the image fits on the media of the printer, because if it doesn't then the likelihood is that the printer will slightly scale down the image so that it does fit, thereby squashing the halftone cells.
Even more subtly, the printable area of the media in the printer may not be the same as the size of the media. Paper handling can mean that there are some areas of the paper that can't be printed on, and the variability in the feeding of the paper can mean that the printer will refuse to print right to the edges anyway. Because if it did, and there was, say, a 1 mm deviation in the paper handling, then 1 mm of the edge would 'fall off' and there would be a 1 mm white gap at the other edge...
%!
/Times-Roman 12 selectfont
100 100 moveto
(Hello) show
How can I take the output as PDF and EPS
formatted file.
Your question really needs some editing, its not clear (to me anyway) what your problem is.
You say 'PostScript, can't see visual output with Ghostscript' as the title, and then want to know about 'taking the output'. So which is it ? A problem viewing a PostScript file when using Ghostscript ? Or a problem with the output ?
You can use the eps2write device to get EPS output and the pdfwrite device to get PDF output, as per the documentation. Neither has 'visual output'.
Today I encountered one weird bug in Chrome's printing behavior.
When I try to print a dynamically created PDF using Chrome (also in Firefox), every image inside the PDF gets a little bit smaller (8mm).
This doesn't happen neither in Adobe Reader/Acrobat/MacOSX Default Printer Dialog.
Let me explain more about my code so far:
dynamic PDF:
I use prawn to dynamically create a PDF A4 (landscape format) using this code:
require 'prawn'
require "prawn/measurement_extensions"
class CustomPdf < Prawn::Document
def initialize(label) # A4
super({
:page_size => "A4",
:page_layout => :landscape,
:margin => 0,
:print_scaling => :none})
image "my_image.png", :width => 213.mm, :at => [3.mm, 3.mm]
end
end
nested image inside the PDF:
The Image nested inside the PDF has a size of 213mm x 70mm with
300 DPI. In Pixel: 2515x827.
I create the Image using RMagick but the size, dpi and everything so far seems to be alright. So no further explanation at the moment.
Expected result:
The printed PDF will show an image with 213cm width.
Actual result:
The printed PDF will show an image with 205mm width.
What I tried so far
Setting the prawn page_size to something lower than A4 (since the Image isn't bigger as A4 as well...).
Playing around with print_scaling(there are 3 modes, :none, :AppDefault, :something_except_the_other_ones (Read more about it here)
Giving the image a fixed height (70mm)
Playing around with various settings provided by the Chrome Printer Dialog
Tested under Windows Chrome (it's 213mm there, weird), maybe it's related to MacOSX Chrome?
Tested under IE11 (205mm) unfortunately.
Neither of these did anything.
I looked through the Bugreporters of Chromium and found 2 people who might share the same problem as I do:
https://code.google.com/p/chromium/issues/detail?id=97972
https://code.google.com/p/chromium/issues/detail?id=67091
The last one was touched 2013 but no one said anything that actually worked for my case.
Examples
Here is an example 300 DPI image which width is 2515 px:
If Imgur changes the resolution to 72, you can pull the example image from the repository (link: https://github.com/posixpascal/chrome-printing-bug/blob/master/example.png)
Here is an example PDF
Direct Link: Direct Link
GitHub PDF Viewer: https://github.com/posixpascal/chrome-printing-bug/blob/master/output.pdf
Github Repository with example image & pdf generator script
https://github.com/posixpascal/chrome-printing-bug
Unfortunately I can't change the width of the image (not even a pixel).
Someone experienced the same problem?
Any ideas? It's an interesting puzzle I guess... :x
When I print a plain image or a website with Chrome there is a 'Use Original Size' or '100% size' option which I don't have when printing the PDF.
I also tried making a webpage instead of a PDF and set the image width to 213mm which didn't work either...
This is my test results from what i have seen by using a windows system and a Mac ( Yosemite )
Windows :
Printed the PDF in Chome : Perfect - 213 mm
Printed in IE : Perfect - 213 mm. This was less before ( around 205-210ish ). So changed the default print settings :
Selected the Print option -> Used Print Dialog -> Selected the printer -> Print Preferences -> Advanced -> Paper Size -> Changed scaling manually -> tested A4, A5 and so on.-> A5 ( for some reason gave me 213 )
So i moved onto the Mac.
Mac Findings:
Changed Paper Size and tested the same : Size was 213 mm.
This was done like this : Apple Print
So naturally, i tested printing it through Chrome directly instead of opening the PDF through OSX -> Printed at 205 mm.
Tested with printscaling on prawn at :appdefault -> Printed at 213 mm.
Tested the same on Firefox -> lower than 205 - 210 mm.
So i dont really know if its a Chrome issue because its acting weird on Firefox for me.
So ultimately, these are my findings after testing out the code on my end.
I experienced a similar 8 mm shrinkage using Chrome on Windows. Checked all my printer properties and settings and couldn't find what could be doing it. Turns out, I had the option "fit to page" ticked in the Chrome printing (ctrl+p) screen. Un-ticked it and reprinted a page, compared their widths and they were 8 mm off. Sometimes it's the simple things...
In my experience, Chrome prints html usually smaller. It may have to do with WebKit engine having "smart shrinking" feature. I have come across to it here (text search shrinkage). Or, it might be just that, Chrome developers gave it a little tweak since people in the past complained that the stuff does not fit the print.
I need to print an image that is being returned to me through a web service (the data is returned as RAW) and I cannot for the life of me figure out how to print a graphic to a label with EPL.
The EPL manual defines the Graphic Write instruction as:
GWp1, p2, p3, p4, DATA
All of the parameters are returned to me, so I don't have to worry about calculating the height, width, etc., but my problem is that I don't know how to format the DATA.
The manual says DATA should be
Raw binary data without graphic file formatting. Data must be in bytes.
I've tried passing a binary string and a hex string, but nothing seems to work. There is no example on how to use this command in the EPL manual and after hours of searching online I have not been able to find a single example of how to use the command (i.e. example EPL commands that I can copy & paste to send to the printer).
Does anyone have an idea of how to use this command? Could you provide me with an example? (by example I don't mean a framework, code, etc., what I mean is just the plain EPL commands).
I can confirm that the data is in raw, uncompressed binary. It is also inverted-- that is, the 0 bits print as black, at least on my UPS-firmware LP-2844. I have no idea why all the examples from Zebra show the data as encoded into a hex representation.
It's worth noting that most print servers (HP Jetdirect, Lantronix LPS1-T, and almost certainly the Zebra built-in and external print servers) will form a binary connection to the printer if you spit data at them on port 9100 (using netcat for example):
nc printer_hostname_or_ip_address 9100 < test_file.txt
You get no feedback from the printer, except for the label having printed or not.
It takes my LP-2844 (UPS Firmware) printer about 5-6 seconds to print a label containing a 816 wide x 1218 tall downloaded bitmap onto a 4" wide x 6" tall label. It seems to be all imaging time: sending three labels at once is not any faster, and the network connection (through a Lantronix LPS1-T) is held open until the final label prints. That image is at the native resolution of the printer (203 dots/inch), and there is no dithering or resizing going on (I don't think EPL2 even knows how to dither or resize).
It might be possible to speed up the imaging time by optimizing the label into many smaller bitmaps (and horizontal and vertical line segments, and perhaps filled-in rectangular blocks). This wouldn't be a very hard optimization because the image is a single-bit black and white bitmap, and the code would be fairly simple. I don't know if it would really speed it up, though.
A more modern Zebra GX420 running ZPL with a built-in ethernet port ($500 online) can print the same label (with essentially the same graphic download encoding) in 1-2 seconds.
By the way, since I haven't yet actually answered the question, the raw EPL code for this is:
(a blank line)
N
q816
Q1218,20
GW10,10,102,1218,(124236 bytes of inverted bitmap data)
P
all the newlines are 0x0a (unix-style).
Maybe this will help, it has examples (and corrects an error in the manual). Also, it may be easier to use the GM command instead and just delete the image each time (see here for a stackexhange related question).
That being said, I've never gotten my Eltrons to successfully print an image (but my jobs don't require it).
Good luck!!
EDIT: Here's another link with example Perl code. They're aiming for Chinese characters but show how to print the Great Wave image (which oddly is Japanese).
I found that it is not possible to send a graphic to a Zebra printer with EPL using ASCII characters. The data must actually be sent as RAW data. So, for example, you can't send a graphic to the printer using Zebra Setup Utilities, or through any other means that cannot write RAW data from a file directly through the printer.
The only way around this I've found is to create the label as an image and send that image to the printer via a print command within your application.
I have a .xps file generated from build-in Microsoft xps writer printer, I want to print this to a real printer but with modified attributes such as: duplex, grayscale, n-up etc.
I followed examples from MSDN and I can print .xps fine, but the problem is I can only set few attributes of the job. By setting PrintTicket with PrintQueue, job printed correctly with modified copies and duplex settings, but will not convert to grayscale or honor any n-up settings.
It seems I am not alone, from this form , by using event handler of WritingPrintTicketRequired, XPS files PrintTicket has been successfully changed with grayscale, n-up settings, but by using PrintQueue.AddJob() call will not print them in grayscale or n-up setting.
However, if I use PrintDialog and manually select attributes then it would print as expected. If I try to set PrintQueue and PrintTicket property in PrintDialog then it won't honor some of the attributes.
My goal is is programmatically print xps file with attributes. The question is how can I make PrintQueue fully honor PrintTicket?
FYI: the xps file was generated as color and I can see color images in .xps package.
EDIT: it turns out is the printer driver somehow does not honor print settings,even printer capabilities show it support monochrome, veryfied by changing to another driver. However, specify grayscale in print ticket is different than selecting grayscale in print dialog UI: grayscale in print ticket would output monochrome image and in spool file, it is specified to render as colour but the image it self is converted. While the later would generating a more realistic grayscale image.