Reputation: 809
The following code throws java.lang.ClassCastException
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(new MediaSize(60,80,Size2DSyntax.MM));
I suspect I did line 2 incorrectly, but I cannot find detailed documentation for Java printing services. What is the proper way to define custom media size?
Upvotes: 3
Views: 2461
Reputation: 347314
MediaSize
does not implement PrintRequestAttribute
, hence the error.
Instead, I think, you need to use something like
aset.add(new MediaPrintableArea(5, 5, 50, 80, MediaPrintableArea.MM));
instead...
You can check out MediaPrintableArea for me details.
Upvotes: 4