Hello,

I'm getting an I an IllegalArgumentException when I call the
JComponent.paint() method (the component paints lines, text and two loaded
JPG images on the screen). Below is a code snippet of how I invoke the iText
driver (v0.92). Does anyone have some insight into this problem? I'm a
rookie at using this framework and some guidance would be helpful.

Thanks,
Tim

<-- CODE SNIPPET -->

Document document = new Document();        
PdfWriter writer = PdfWriter.getInstance( document, new FileOutputStream(
file ) );

float width = ( ( Page ) page ).getPaper().getWidth();
float height = ( ( Page ) page ).getPaper().getHeight();

PdfContentByte contentByte = writer.getDirectContent();
contentByte.saveState();
Graphics2D graphics2D = contentByte.createGraphics( width, height );
page.paint( graphics2D );
contentByte.restoreState();
writer.close();

<-- STACK TRACE -->

java.lang.IllegalArgumentException      at
com.lowagie.text.pdf.PdfGraphics2D.drawImage(Unknown Source)    at
com.lowagie.text.pdf.PdfGraphics2D.drawImage(Unknown Source)    at
com.lowagie.text.pdf.PdfGraphics2D.drawImage(Unknown Source)    at
com.lowagie.text.pdf.PdfGraphics2D.drawImage(Unknown Source)    at
javax.swing.JComponent.paint(JComponent.java:670)       at
choreo.core.pdf.ITextWriter.writePage(ITextWriter.java:52)      at
choreo.client.console.ui.action.FileSaveAs.saveAsPDF(FileSaveAs.java:123)
at
choreo.client.console.ui.action.FileSaveAs.actionPerformed(FileSaveAs.java:6
8)      at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButto
n.java:1504)    at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:3
78) at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250) at
javax.swing.AbstractButton.doClick(AbstractButton.java:279) at
javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(Basic
MenuItemUI.java:886)    at
java.awt.Component.processMouseEvent(Component.java:3715)       at
java.awt.Component.processEvent(Component.java:3544)    at
java.awt.Container.processEvent(Container.java:1164)    at
java.awt.Component.dispatchEventImpl(Component.java:2593)       at
java.awt.Container.dispatchEventImpl(Container.java:1213)       at
java.awt.Component.dispatchEvent(Component.java:2497)   at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)  at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)   at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)       at
java.awt.Container.dispatchEventImpl(Container.java:1200)       at
java.awt.Window.dispatchEventImpl(Window.java:914)      at
java.awt.Component.dispatchEvent(Component.java:2497)   at
java.awt.EventQueue.dispatchEvent(EventQueue.java:339)  at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:131) at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:98)    at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)    at
java.awt.EventDispatchThread.run(EventDispatchThread.java:85)




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
No, I will not fix your computer.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to