I'm printing labels with a Zebra printer using Java by sending ZPL II commands. I want to show a preview of the label before sending it to the printer.
Rather than trying to send fonts to the printer, I'd like to use the built in fonts.
I can see a list of the fonts on page 60 of the programming guide volume 2. There are 15 of them, each labeled with a single letter and no reference to the name of an equivalent screen font.
I can generate an image to display of the barcode, but I'm having trouble figuring out how to display the text appropriately because outside of the OCR fonts, I don't know of an equivalent font to leverage on-screen.
I haven't found any documentation that lists them at Zebra's website, and my searching is only returning results on how to send screen fonts to the printer (which looks complex enough for me to want to avoid at this point).
Does anybody know where I can get the fonts, or would you be able to provide me with a list of (hopefully free) equivalents?
I took a screenshot of the fonts displayed in the manual for reference.
After much research, I discovered that the fonts Zebra uses are tightly protected because of licensing.
Contacting Zebra about obtaining a license for the fonts is your only option.
The alternative I'm using for now is to preview the label with a free-to-distribute monospaced true-type font (which I haven't yet selected). The document I linked in my question provides size and spacing information for the built-in fonts so I can emulate as close as possible.
The Zebra fonts, except 0, are all bit mapped, fixed width fonts.
Courier should give you a reasonable approximation.
Just scale them using the table in the Zebra manual.
zpl-zbl2-pm-en.pdf
In case anyone stumbles upon this question.
You can generate a label preview using http://labelary.com/ API.
Related
I'm trying to generate an xsl to be printed in a pre-printed sheet which works fine.
Now i want to give the user a better previsualization (in the pdf screen version) adding a background image which emulates the "pre-printed" stuf on the sheet to give the user a "context" of what is he printing.
The question is: Is there any way I can set a background image in xsl (using apache fop) visible only in pdf but not in the printed version of it?
Thank you all for reading or givin any advice.
Although as the comments state, you can't have content in the PDF that does not come out in a physical printed copy, here is one possible work around for you. Depending on how your users are ultimately going to be using FOP for PDF rendering and how your a driving the work flow, it's possible to pass a parameter into an xslt file before the transofrmation phase is run, so potentially, you could do a dual rendering of the same PDF, one that is presented to the user where the background image is enabled, and one that gets printed, you could just set a variable similar to how they do in this Example, and call it something like $isPreview, and just use a simple if or choose statement to check for 'Y' or 'N'.
Since you are sending to a printer, you may even want to take advantage of FOP's ability to generate to Postscript rather than PDF, I've used this feature quite extensively for print documents using FOP while also producing a PDF copy for electronic delivery via email or hosted services, and I've yet to find any discrepancy between the PDF rendering and what is printed after sending a rendered postscript file, so it should work well for you as well.
As I said, this is not truly a solution to your problem as you've presented it, but as a work around, it could get you the desired results if your clever about how you implement it.
I don;t think the statement that it is not possible is true, I am just not sure how to create such a PDF with FOP. Certainly you can add an image field. One would use a button field and place the image in the button. Then you would set the properties of that button to not print (printable false).
PDF support images in fields: https://answers.acrobatusers.com/adding-image-field-form-q41825.aspx
RenderX supports PDF Form fields but I do not see where they support an image inside the button, only text: http://www.renderx.com/reference.html#PDF%20Forms. But they do support setting a field to "printable".
I own a sports apparel company and I'm looking to have an applet built that will allow customers to see how their team names will look in certain colors on jerseys. Below you can see the final result of a competitor site's Flash applet where text is rendered on 2D surfaces/images.
My requirements: I need users to be able to set the font, primary text color, outline text color, and text style (arched or straight).
So my question-- Is this sort of text rendering possible with only Javascript/PHP?
If so, what limitations do you for see? I've been told the arching and outline text color may be issues. I've also been told that I may have to upload library files to a server where the actual rendering may take place.
If not, what scripting would you guys recommend? I'm trying to stay away from Flash because it's slow and costly.
I'll be passing this onto our developers so please feel free to be as detailed as possible. I figure'd I'd save them some leg work!
Thank you!
Depending on how complex you want your graphics to be, html5 drawing abilities could be used. Check Raphaël library, for instance, webGL/canvas renderers already have a lot of features in modern browsers.
As of the solution with server rendering, it's also possible with gd2(php), but imho that would be less convenient, at least try something different from php (btw, what's your backend running on?)
Your competitor's solution with java applet honestly seems the easiest, except that it requires jre, which few people are eager to install =)
That's kind-of a high level question, but yes you can definitely use javascript for it.
If there's a problem with getting characters to look right, you can always save each letter as a separate image and have javascript place them next to each other in preview. I'd try to see how close you could get with the existing fonts first.
Layering the text: one color large font, then a different color smaller font will give you the outline effect your looking for.
Using JSP and Jasper Reports, I made an application for printing A4 label pages.
I have to configure my application (set alignment on the PDF page to be generated) according to different pages (2×5, 2×7, 3×10 and 3×11 grids), different printers (Kyocera, OKI and HP) and different PDF viewers (Adobe, Foxit and Nitro).
Example: I set in Jasper Reports an A4 page with a grid of 2×5 and an user who has Foxit Reader will print it on a Kyocera. If another user has Kyocera too but is using Adobe Reader, the space between the columns gets smaller. But if the user has Foxit Reader but will print on an OKI, the whole document goes left and even gets cut.
To configure each individual label page is unavoidable, but can it be possible for me not have to set the page alignment for specific PDF viewer or printer (at least one of those)? It can be a way to skip the PDF generation or some conventional configuration that all printers would interpret - to get my page printed exactly the same, regardless of PDF viewer or printer.
Are you sure this is not a setting in Foxit Reader and/or Adobe reader that is causing the issue?
I know in Adobe reader there is a setting in the print dialog under Page Sizing & Handling. They should use Actual Size so as to not do any scaling or manipulation of the image.
In Foxit Reader it is under Print Handling. You need to set Scaling Type to None. The default seems to be Fit to Printer Margins.
You should not have to do anything different for each PDF reader and/or each version and combination of printer. That is a maintenance nightmare you should not try to take this on. You would have to make changes every time they bought a new printer, and potentially when an upgrade to their reader comes out.
Best bet is to figure out why they are producing different results, and tackle that issue, instead of brute forcing the problem. I am pretty sure this is more a training issue with your users, and telling them about these settings should clear up the problem.
UPDATE: After some more digging it seems to be possible to set the value of the Print Scaling while exporting. After you create your JRPdfExporter you need to set JRPdfExporterParameter.PRINT_SCALING to JRPdfExporterParameter.PRINT_SCALING_NONE:
exporter.setParameter(JRPdfExporterParameter.PRINT_SCALING, JRPdfExporterParameter.PRINT_SCALING_NONE);
I do not know if this will work for Foxit Reader also, but I would assume it would.
I examined the possibilities of previewing and printing generic text in Java. The requirements which I depend on are:
I should be able to specify font family and size of the font for both the preview component and for printed text.
The print preview must look exactly the same as the printed text.
Printing must be independend of printer device (no printer specific commands to define fonts etc.).
Printing of approx. 20 pages of generic text must start immediately (without any significant delay caused by data processing)
To meet the aformentioned requirements I first tried the Java Print Service API. I created the JTextPane which contained the text to preview and print. By using JTextPane I was able to specify the font so the result looked fancy. To print data from JTextPane I used the standard procedure, which is independend from printer device
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setPrintable(myTextPane);
pj.print();
Everything would be fine if printing 20 pages of plain text wouldn't start in 15 seconds after the print() method was executed.
However printing starts immedialety when I print the same text as raw byte array ('application/octet-stream') with few PCL specific commands to set a proper font. But this approach is printer specific and there is also a problem with previewing the text so that the priview look exactly the same as printed text.
The problem with JTextPane is most likely caused by the fact that the data sent to printer are too large (pixel-by-pixel) while the second solution is a matter of few bytes. Unfortunately none of these solutions are sufficion for me because they don't meet all of the requirements.
Probably the solution would be if there is some 'facade' over printer control languages (PCL, ESC/P, ...) which would allow me to set the text font independently from the printer device. The problem with print preview would not be solved, but at least the printing would start immediately.
Any advice how to print the plain text not breaking the aforemention 4 criteria?
The problems above seems to be linked to Linux print driver and Cups.
I tried to print some text on Windows and everything works fine. Printing even starts immediately.
Iam searching for a PCL syntax to generate and print the BARCODE. If anyone having any information about the same, please help me. I have tried googling it, but didnt find anything.
First you need a barcode font. Once you have this simply move the cursor to the spot you want (in the example 300 x 300 in whatever unit of measure you've defined), and then call the barocde and put your text down. A simple exmample might look like htis:
<ESC>*p300x300Y<ESC>*c100D1234567890
This assumes that you have embedded the barcode as part of the print job and assigned the numeric 1000 to the font call. Just search the web for "pcl barcode font" and you will find many sites that sell these fonts and provide instructions on how to call. If the printer has barcode fonts embedded, try printing a font list and it should provide the escape sequence you need to call.