Comments (9)
The current SNAPSHOT version has a method
public boolean isPrinterClass()
on CupsPrinter class in order to ease use of printer classes.
from cups4j.
Hi Shambarick,
Printer classes are not supported (yet).
Cups4j mainly aims to query printers on CUPS-Servers, print documents and check job state in order to be able to signal problems or success of print jobs to applications an users. Cups4J mainly supports IPP-Operations and only some CUPS extensions so far.
As I understand printer classes are more a feature to organize printers in groups than a key feature used for printing.
Can you describe what you want to do with it in your application? This should make it more transparent, what changes in Cups4j are needed to support classes for you.
from cups4j.
I have several printers for different specific needs: ID card, license, ...
So when I have to print an ID card, I would just create a printing job to the class "ID Card", and one of the available printers of the class would print it. Also, if I add more printers or replace them, it won't affect the application, since the only thing it needs to know is the class to use for printing.
from cups4j.
That sounds interesting and might be of good use for others too. I will take a look at this and will come back to this thread.
from cups4j.
So, cups4j supports printer classes already out of the box.
Say you have a class of printers called "test" on your CUPS server on localhost and a pdf file in /tmp/test.pdf that should be printed.
CupsClient client = new CupsClient(host, port);
CupsPrinter printer = client.getPrinter(new URL("http://localhost:631/classes/test"));
PrintJob printJob = new PrintJob.Builder(new FileInputStream(new File("/tmp/test.pdf"))).build();
printer.print(printJob);
Please check if this works in your scenario.
from cups4j.
Thanks, just tested it, and it seems to work great.
Now I'm looking for how to get the list of classes. I didn't find how to get it with cups4j. I plan to have an API to expose the available classes, so the clients know which ones to use.
from cups4j.
Printer classes contain "classes" in their CUPS URL.
You can find your classes this way:
CupsClient client = new CupsClient(host, port);
Map<String, CupsPrinter> classMap=new HashMap<String, CupsPrinter>();
for(CupsPrinter printer: client.getPrinters()) {
if(printer.getPrinterURL().toString().contains("classes")) {
classMap.put(printer.getName(),printer);
}
}
from cups4j.
Thanks, I didn't notice that part. Actually the library already supports what I need 😄
from cups4j.
Thank you for the update.
from cups4j.
Related Issues (20)
- cannot set resolution & metadata (user & jobname) not set HOT 5
- Publish new version with latest in master HOT 2
- CupsGetPrintersOperation make-and-model requested but not captured
- cups printer getPrinterState() returns 'null' HOT 4
- Inability to use secure print feature after setting job-password attribute
- Make getPrinters return CupsPrinter objects with a correct isDefault() return value
- May I ask a question about number-up-layout?
- Override duplex settings HOT 4
- who published 0.7.9? HOT 6
- getState() returning null
- getPrinters() returns no printers when I use 192.168.0.213 instead of 127.0.0.1 HOT 4
- In java cups library want to fetch all the jobs attributes of given print job with the completion time? HOT 1
- Unable to add the ipp network printer to cup server HOT 1
- how can i get media source info【tray】 HOT 2
- Cups4j sometimes does not connect correctly
- Compatibility with cups 1.6.3 HOT 1
- printJob 的color方法设置不起作用,大神们该如何设置,跟cups的版本有关系么?
- Failed resolution of: Lorg/apache/http/client/config/RequestConfig;
- There seems to be a version conflict issue with the pache HttpClient library.
- HTTPS protocol is not supported HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cups4j.