Comments (3)
You can define attributes like this
IppAttribute("page-ranges", IppTag.RangeOfInteger, listOfIntRange)
and use it as parameter for printJob.
The template attributes are provided for convenience and ease of use.
from ipp-client-kotlin.
Hi @gmuth . Thank you and i hope you had a good holiday.
I've tried above before i opened an issue but IppTemplateAttributes.kt
function arguments relies on IppTag.kt
so,
@JvmStatic
fun pageRanges(vararg range: List<IntRange>) =
IppAttribute("page-ranges", IppTag.RangeOfInteger, range)
the code above won't work because IppTag only validates it as IntRange
and not List<IntRange>
I can also try using String
as an argument with eg "1..2,2..3,10..15" like below:
@JvmStatic
fun pageRanges(vararg range: String) =
IppAttribute("page-ranges", IppTag.RangeOfInteger, listOf(range))
IppTag will cause an error because it does not match IntRange
If i modify IppTag which is a low level interaction, it will break while trying to communicate with Ipp
from ipp-client-kotlin.
I understand your issue and have provided another method that supports Collection<IntRange>
.
Your first try is wrong because you really want to eliminate vararg completley.
Your second try does not work because you again use vararg, but in fact really want just one String and also because you don't convert the string to the required type IntRange and therefore run into class cast exceptions (or failed checks I've implemented for better error handling).
pageRanges("1,3,4,10".toListOfIntRange())
now works together with extension
fun String.toListOfIntRange() = split(",").map { it.toInt()..it.toInt() }
from ipp-client-kotlin.
Related Issues (10)
- Project import not load HOT 4
- Unable to add the ipp network printer to cup server HOT 5
- de.gmuth.ipp.client.IppExchangeException: missing content-type in http response (application/ipp required) HOT 10
- 'application/pdf' is not supported HOT 2
- Initial connection fails HOT 12
- Epson L3250 failed to decode ipp response HOT 9
- Publish library on a public reporsitory HOT 4
- Bought a new HP Smart Tank Wireless 515, still same issue HOT 2
- Create jar files for source files (and javadoc) to promote ease of use of API from IDE HOT 4
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 ipp-client-kotlin.