if(imageContent.getURI().endsWith(".svg")) { isSvg = true; ti = new TranscoderInput(new FileInputStream(imageContent.getURI( ))); } else { img = Image.getInstance(imageContent.getURI()); }
if ( imageContent.getURI( ).endsWith( ".svg" ) ) { isSvg = true; ti = new TranscoderInput( new FileInputStream( imageContent.getURI( ) ) ); } else { URL url = new URL( imageContent.getURI( ) ); InputStream in = url.openStream( ); try { byte[] buffer = new byte[in.available( )]; in.read( buffer ); img = Image.getInstance( buffer ); } catch ( Exception ex ) { logger .log( Level.WARNING, ex.getMessage( ), ex ); } finally { in.close( ); }  }
		protected void drawImage( IImageArea image )		{										Image img = null;			TranscoderInput ti = null;			cb.saveState();			ContainerPosition curPos;			if ( !containerStack.isEmpty() )				curPos = (ContainerPosition)containerStack.peek();				else 				curPos = new ContainerPosition(0, 0);			int imageX = curPos.x + image.getX();			int imageY = curPos.y + image.getY();			IImageContent imageContent = ((IImageContent) image.getContent());						try			{								boolean isSvg = false;								//lookup the source type of the image area				switch (imageContent.getImageSource())				{				case IImageContent.IMAGE_FILE:					if (null == imageContent.getURI())						return;										if(imageContent.getURI().endsWith(".svg")) {						isSvg = true;						ti = new TranscoderInput(new FileInputStream(imageContent.getURI( )));					} else {						img = Image.getInstance(imageContent.getURI());					}					break;				case IImageContent.IMAGE_URL:					if (null == imageContent.getURI())						return;										if(imageContent.getURI().endsWith(".svg")) {						isSvg = true;						ti = new TranscoderInput(imageContent.getURI( ));					} else {						img = Image.getInstance(imageContent.getURI());					}					break;				case IImageContent.IMAGE_NAME:				case IImageContent.IMAGE_EXPRESSION:					if (null == imageContent.getData())						return;					isSvg = (( imageContent.getMIMEType( ) != null )							&& imageContent.getMIMEType( ).equalsIgnoreCase( "image/svg+xml" )) //$NON-NLS-1$							|| (( imageContent.getURI( ) != null )							&& imageContent.getURI( ).toLowerCase( ).endsWith( ".svg" )) //$NON-NLS-1$							|| (( imageContent.getExtension( ) != null )							&& imageContent.getExtension( ).toLowerCase( ).endsWith( ".svg" )); //$NON-NLS-1$					if(isSvg)					{						ti = new TranscoderInput(new ByteArrayInputStream(imageContent.getData( ))); 										} else {						img = Image.getInstance(imageContent								.getData());					}									}									//img.setDpi(5*img.getDpiX(),5*img.getDpiY());				// add the image to the given contentByte								if(!isSvg) {					cb.addImage(img, 							pdfMeasure(image.getWidth()), 0f, 0f, pdfMeasure(image.getHeight()),							layoutAreaX2PDF(imageX), 							layoutAreaY2PDF(imageY, image.getHeight()));				} else {										try {						if(ti!=null)						{							double width = pdfMeasure(image.getWidth());							double height = pdfMeasure(image.getHeight());							double x = layoutAreaX2PDF(imageX);							double y = layoutAreaY2PDF(imageY, image.getHeight());											            PdfTemplate template = cb.createTemplate(new Float(width).floatValue(), new Float(height).floatValue());				            Graphics2D g2 = template.createGraphics(new Float(width).floatValue(), new Float(height).floatValue());				            				            PrintTranscoder prm = new PrintTranscoder();				            prm.addTranscodingHint( PrintTranscoder.KEY_SCALE_TO_PAGE, new Boolean(true) );				            prm.transcode(ti, null);				            PageFormat pg = new PageFormat();				            Paper pp= new Paper();				            pp.setSize(width, height);				            pp.setImageableArea(0, 0, width, height);				            pg.setPaper(pp); 				            prm.print(g2, pg, 0); 				            g2.dispose(); 					            cb.addTemplate(template, new Float(x).floatValue(), new Float(y).floatValue());						}											} catch (Exception e) {						e.printStackTrace();					}									}			} catch (BadElementException bee)			{				logger.log( Level.WARNING, bee.getMessage( ), bee );			} catch (IOException ioe)			{				logger.log( Level.WARNING, ioe.getMessage( ), ioe );			} catch (DocumentException de)			{				logger.log( Level.WARNING, de.getMessage( ), de );			}			catch (Throwable t)			{				logger.log( Level.WARNING, t.getMessage( ), t );			}						cb.restoreState();						//Check if itself is the destination of a bookmark.			//if so, make a bookmark; if not, do nothing			makeBookmark(image, curPos);						//handle hyper-link action			handleHyperlinkAction(image, curPos);		}