/// <summary>
        /// Constructs a  PdfFormXObject -object.
        /// @since   2.1.3 (Replacing the existing constructor with param compressionLevel)
        /// </summary>
        /// <param name="template">the template</param>
        /// <param name="compressionLevel">the compression level for the stream</param>
        internal PdfFormXObject(PdfTemplate template, int compressionLevel)
        {
            Put(PdfName.TYPE, PdfName.Xobject);
            Put(PdfName.Subtype, PdfName.Form);
            Put(PdfName.Resources, template.Resources);
            Put(PdfName.Bbox, new PdfRectangle(template.BoundingBox));
            Put(PdfName.Formtype, One);
            var matrix = template.Matrix;

            if (template.Layer != null)
            {
                Put(PdfName.Oc, template.Layer.Ref);
            }

            if (template.Group != null)
            {
                Put(PdfName.Group, template.Group);
            }

            if (matrix == null)
            {
                Put(PdfName.Matrix, Matrix);
            }
            else
            {
                Put(PdfName.Matrix, matrix);
            }

            Bytes = template.ToPdf(null);
            Put(PdfName.LENGTH, new PdfNumber(Bytes.Length));
            FlateCompress(compressionLevel);
        }
Example #2
0
 /**
  * Constructs a <CODE>PdfFormXObject</CODE>-object.
  *
  * @param        template        the template
  * @param   compressionLevel    the compression level for the stream
  * @since   2.1.3 (Replacing the existing constructor with param compressionLevel)
  */
 internal PdfFormXObject(PdfTemplate template, int compressionLevel)
     : base()
 {
     Put(PdfName.TYPE, PdfName.XOBJECT);
     Put(PdfName.SUBTYPE, PdfName.FORM);
     Put(PdfName.RESOURCES, template.Resources);
     Put(PdfName.BBOX, new PdfRectangle(template.BoundingBox));
     Put(PdfName.FORMTYPE, ONE);
     PdfArray matrix = template.Matrix;
     if (template.Layer != null)
         Put(PdfName.OC, template.Layer.Ref);
     if (template.Group != null)
         Put(PdfName.GROUP, template.Group);
     if (matrix == null)
         Put(PdfName.MATRIX, MATRIX);
     else
         Put(PdfName.MATRIX, matrix);
     bytes = template.ToPdf(null);
     Put(PdfName.LENGTH, new PdfNumber(bytes.Length));
     FlateCompress(compressionLevel);
 }