/** * Constructs a <CODE>PdfFormXObject</CODE>-object. * * @param template the template */ PdfFormXObject(PdfTemplate template) // throws BadPdfFormatException { super(); put(PdfName.TYPE, PdfName.XOBJECT); put(PdfName.SUBTYPE, PdfName.FORM); put(PdfName.RESOURCES, template.getResources()); put(PdfName.BBOX, new PdfRectangle(template.getBoundingBox())); put(PdfName.FORMTYPE, ONE); if (template.getLayer() != null) put(PdfName.OC, template.getLayer().getRef()); if (template.getGroup() != null) put(PdfName.GROUP, template.getGroup()); PdfArray matrix = template.getMatrix(); if (matrix == null) put(PdfName.MATRIX, MATRIX); else put(PdfName.MATRIX, matrix); bytes = template.toPdf(null); put(PdfName.LENGTH, new PdfNumber(bytes.length)); flateCompress(); }