Hello all;
   I am trying to rotate a generated barcode from Itext for veritical 
representation. Since there are not methods within the barcode classes to do 
this, I used the AWT classes vai the Image Object. However, when I try to get 
the graphics object I get the following error: Any suggestions would be helpful.

Thanks
John Strecker


java.lang.IllegalAccessError: getGraphics() only valid for images created with 
createImage(w, h)
        at sun.awt.windows.WImage.getGraphics(WImage.java:29)


Here is my code snippet:

            Barcode39 code39 = new Barcode39();
            code39.setCode("8004106861");
            code39.setBarHeight(10);
            Image image25 = code39.createAwtImage(Color.black, Color.white);

            Graphics g = image25.getGraphics();
            Graphics2D g2d = (Graphics2D) g;
            AffineTransform tx = new AffineTransform();
            double radians = Math.toRadians(90);
            double xcentre = (image25.getWidth(null) / 2.0);
            double ycentre = (image25.getHeight(null) / 2.0);

            tx.rotate(radians, xcentre, ycentre);
            tx.translate(0, image25.getHeight(null));
            g2d.drawImage(image25, tx, null);





-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to