I am printing a receipt using Zebra printer ( Android SDK).
I have checked the documentation of the SDk but could not find any utility class that can help in setting of font size/name/height.
Currently i am hard-coding the parameters and creating a .lbl file but i think that is not a good approach.
So, is their any utility class that would generate the script for .lbl file depending on set of parameters i provided to it.
The Zebra SDK does not provide extensive label design support. It is designed to help with discovery, communication, configuration, and printing to Zebra printers. To my knowledge there is no real element of the SDK that will help you change font sizes dynamically.
Your approach is correct: defined a .LBL template file, and populate the data at print-time. Often, an end-user wil want to use a nearly identical label (in terms of font size, graphics, positioning) and will simply change the printed data. Dynamically changing those elements (font size, for example) doesn't seem to be a common need. That is just my impression.
Related
I am currently working on a desktop application in which one can generate a responsive website for documentation (java-doc like) by providing nothing more than a simple word document.
I currently have a prototype working in which I select for styles on certain paragraphs to determine its function and how it should be transformed to a correct HTML representation. I also found a way to dynamically link to certain section of the document. Everything is working however I would really like to combine the list of documents to generate, a preview of the to-be generated website and a text editor program in 1.
since this will be relying on word heavily I was wondering if Java FX provides a means to display an application such as word or openoffice within an internal frame. Much like how Java Fx's webview displays websites.
In an ideal situation it would look something like this:
Any help would be greatly appreciated.
Alas, not possible in a plausible way.
I am working under eclipse plugin and trying to load fonts into the application as resources, so they will appear in project explorer tree.
In SWT we have method loadFont of Display class which loads font from specified file, so it will appear in list of available fonts of application. I am using this method.
But when I am trying to delete the font from project explorer I am getting following exception:
org.eclipse.core.internal.resources.ResourceException:
Problems encountered while deleting resources
I have following questions:
Is it possible to unload font from application in SWT ?
Is there any way to deal with it?
Is there another scenario to deal with custom fonts in eclipse?
Classes of the type FontData don't need to be disposed of, as they simply contain a small amount of information about the font. When you create an actual Font object then yes, it is your responsibility to call .dispose() and free up those resources.
If you are using JFace as well as SWT, then you may want to look at FontRegistry, which assists in keeping track of font resources.
Apologies for not linking any javadocs, the SWT docs aren't loading for me right now. I did find a small example of FontRegistry usage which explains the difference between FontData and Font.
Have done some research into this topic, but found no relevant answers. What I need is to print a number of PDF files on one of three forms, which are loaded into different trays of a particular printer. I need to specify which printer to use and it's not the default printer. Additionally, I need to specify which tray to use based upon an attribute of each PDF file and be able to switch between them at run time. Java PrintService seems to only be interested in the local default printer. I'd appreciate any suggestions on how to accomplish this task. Thanks.
The Printer API does allow for talking to different printers other than the default. That being said it is limited. What we did in our shop is to write a JNI layer that talks directly to the Print Queue of Windows and we use that. If you want finer control than the PrintService API provides you will need to write a JNI layer and access that from Java.
You could configure a different printer for each tray in your OS, Then print to that printer depending on the properties of your file.
Thanks for all the suggestions, but I think I have worked this out now. I'm using LPR for the printing and org.apache.commons.net.ftp.FTPClient for the tray switching commands. The actual tray commands are in text files. My tests (so far) have been successful and I did not have to install the printer on my workstation.
I'm using a third-party library which accesses fonts through the GraphicsEnvironment: getAllFonts() call. This includes fonts in font registries belonging to both the JRE and the operating system.
But on client machines that connect to our server I will likely not be able to install fonts into either of these locations. So how can I make other fonts available to the JRE so that this call will pick them up? Is there a way to expand its search path?
I can access a font from an arbitrary file with the Font.createFont() call. But then it still doesn't show up in GraphicsEnvironment.getAllFonts(). Is there a method I can pass that Font to that will add it to the list of fonts available? I'm reading that there are calls that access fonts from a system property, but I'm still not understanding, yet, and I think that just translates a font property I set up into a font name from the available list.
asalamon has provided the correct answer, but I'm stuck on an earlier version of Java that doesn't support it, at least until next year. So more answers are still very welcome! I'm probably going to try to use reflection to hack the library we are using and insert fonts directly into its cache.
Use GraphicsEnvironment.registerFont. (For JDK 1.6)
Try Font.createFont() and bundling the fonts you want to use.
I am trying to make IBM jre to use PCF fonts from default X11 installation on my linux box. In particular adobe-helvetica font. I have toyed to modify fontconfig.properties in jre/lib folder but no matter what I do Java seams to use some other fonts. I guess there is some algorithm how java VM tries to link java logical fonts to actual physical fonts in the system even in case when font specified in config could not be used. On Windows it is pretty straight forward, but on Linux I was unable to make it work with anything except TrueType fonts.
Anybody have experience with configuring fonts on IBM jre on Linux?
I've spent all morning learning about Java fonts. There's a lot of limitations, some of which are removed in Java 1.6. I don't have any answers, but here is some information I have that might be helpful.
Java distinguishes internally between system fonts and created fonts. (News flash to Sun: it'd be nice to make that clear through subclassing!) The system fonts seem to be fonts installed in the JRE possibly plus some of the fonts installed on your system. But apparently not all of the fonts installed on your system; I, too, have adobe-helvetica on my Linux system but it doesn't seem to be accessible from Java under any name I can think of.
Meanwhile, you can create fonts from a font file with the Font.createFont() method. You have to specify the font file type. The only constants I found to specify these types in the Font class are TRUETYPE_FONT and TYPE1_FONT. So it looks like if PCF fonts are available, it isn't made explicit through providing a constant to specify them. Maybe somebody else knows more. I did see some information online about using bitmap fonts in Java ME, so it must somehow be possible to use other types of fonts.
Once you have a created font, you can add it to the JVM's concept of available fonts with the GraphicsEnvironment.registerFont() call, but that is only available on Java 1.6 and later.
The PCFFont package seems to provide the ability to use PCF fonts from Java. Unfortunately I think it does so with a custom PCFFont class which does not extend the java.awt.Font class, so I would say its usefulness is probably limited. However, it might give some pointers to implementation details for writing a custom subclass of Font which can handle PCF fonts. Finding the source code isn't immediately obvious; code for that exact class is here.
I would say the author seems a little confused, because he talks about converting TrueType fonts to PCF so you can use them with his library, and Java already supports TrueType fonts natively. But he appears to be an engineer from Sun, so maybe he knew more than I think; also, this could just be very out of date (was there ever a time when Java didn't support TrueType?).