1 50 51 package com.lowagie.text; 52 53 import java.net.URL ; 54 55 import com.lowagie.text.pdf.PdfTemplate; 56 57 65 66 public class ImgTemplate extends Image { 67 68 ImgTemplate(Image image) { 69 super(image); 70 } 71 72 77 public ImgTemplate(PdfTemplate template) throws BadElementException{ 78 super((URL )null); 79 if (template == null) 80 throw new BadElementException("The template can not be null."); 81 if (template.getType() == PdfTemplate.TYPE_PATTERN) 82 throw new BadElementException("A pattern can not be used as a template to create an image."); 83 type = IMGTEMPLATE; 84 scaledHeight = template.getHeight(); 85 setTop(scaledHeight); 86 scaledWidth = template.getWidth(); 87 setRight(scaledWidth); 88 setTemplateData(template); 89 plainWidth = getWidth(); 90 plainHeight = getHeight(); 91 } 92 } | Popular Tags |