public Graphics2D getGraphics2D(Rectangle clipRect) { Graphics2D graphics = template.createGraphics(template.getWidth(), template.getHeight()); graphics.translate(origX, template.getHeight() - origY - clipRect.getHeight()); graphics.clipRect(0, 0, (int) clipRect.getWidth(), (int) clipRect.getHeight()); return graphics; }
/** Creates an Image from a PdfTemplate. * * @param template the PdfTemplate * @throws BadElementException on error */ public ImgTemplate(PdfTemplate template) throws BadElementException{ super((URL)null); if (template == null) throw new BadElementException("The template can not be null."); if (template.getType() == PdfTemplate.TYPE_PATTERN) throw new BadElementException("A pattern can not be used as a template to create an image."); type = IMGTEMPLATE; scaledHeight = template.getHeight(); setTop(scaledHeight); scaledWidth = template.getWidth(); setRight(scaledWidth); setTemplateData(template); plainWidth = getWidth(); plainHeight = getHeight(); }
/** Creates an Image from a PdfTemplate. * * @param template the PdfTemplate * @throws BadElementException on error */ public ImgTemplate(PdfTemplate template) throws BadElementException{ super((URL)null); if (template == null) throw new BadElementException(MessageLocalization.getComposedMessage("the.template.can.not.be.null")); if (template.getType() == PdfTemplate.TYPE_PATTERN) throw new BadElementException(MessageLocalization.getComposedMessage("a.pattern.can.not.be.used.as.a.template.to.create.an.image")); type = IMGTEMPLATE; scaledHeight = template.getHeight(); setTop(scaledHeight); scaledWidth = template.getWidth(); setRight(scaledWidth); setTemplateData(template); plainWidth = getWidth(); plainHeight = getHeight(); }
/** Creates an Image from a PdfTemplate. * * @param template the PdfTemplate * @throws BadElementException on error */ public ImgTemplate(PdfTemplate template) throws BadElementException{ super((URL)null); if (template == null) throw new BadElementException(MessageLocalization.getComposedMessage("the.template.can.not.be.null")); if (template.getType() == PdfTemplate.TYPE_PATTERN) throw new BadElementException(MessageLocalization.getComposedMessage("a.pattern.can.not.be.used.as.a.template.to.create.an.image")); type = IMGTEMPLATE; scaledHeight = template.getHeight(); setTop(scaledHeight); scaledWidth = template.getWidth(); setRight(scaledWidth); setTemplateData(template); plainWidth = getWidth(); plainHeight = getHeight(); }
tp.setBoundingBox(new Rectangle(template.getWidth(), template.getHeight())); writer.addDirectTemplateSimple(tp, PdfName.FRM); tp.addTemplate(template, template.getBoundingBox().getLeft(), template.getBoundingBox().getBottom());
tp.setBoundingBox(new Rectangle(template.getWidth(), template.getHeight())); writer.addDirectTemplateSimple(tp, PdfName.FRM); tp.addTemplate(template, template.getBoundingBox().getLeft(), template.getBoundingBox().getBottom());
tp.setBoundingBox(new Rectangle(template.getWidth(), template.getHeight())); writer.addDirectTemplateSimple(tp, PdfName.FRM); tp.addTemplate(template, template.getBoundingBox().getLeft(), template.getBoundingBox().getBottom());
writer.addDirectImageSimple(image); PdfTemplate template = image.getTemplateData(); float w = template.getWidth(); float h = template.getHeight(); addTemplate(template, a / w, b / w, c / h, d / h, e, f);
writer.addDirectImageSimple(image); PdfTemplate template = image.getTemplateData(); float w = template.getWidth(); float h = template.getHeight(); addTemplate(template, a / w, b / w, c / h, d / h, e, f);
writer.addDirectImageSimple(image); PdfTemplate template = image.getTemplateData(); float w = template.getWidth(); float h = template.getHeight(); addTemplate(template, a / w, b / w, c / h, d / h, e, f);