Esempio n. 1
0
 internal static void AddTextInsideLayer(IPdfOCG layer, PdfCanvas canvas, String text, float x, float y)
 {
     if (layer != null)
     {
         canvas.BeginLayer(layer);
     }
     canvas.BeginText().MoveText(x, y).ShowText(text).EndText();
     if (layer != null)
     {
         canvas.EndLayer();
     }
 }
Esempio n. 2
0
 internal void RegisterLayer(IPdfOCG layer) {
     PdfWriter.CheckPdfIsoConformance(this, PdfIsoKeys.PDFISOKEY_LAYER, null);
     if (layer is PdfLayer) {
         PdfLayer la = (PdfLayer)layer;
         if (la.Title == null) {
             if (!documentOCG.ContainsKey(layer)) {
                 documentOCG[layer] = null;
                 documentOCGorder.Add(layer);
             }
         }
         else {
             documentOCGorder.Add(layer);
         }
     }
     else
         throw new ArgumentException(MessageLocalization.GetComposedMessage("only.pdflayer.is.accepted"));
 }
Esempio n. 3
0
 override internal void RegisterLayer(IPdfOCG layer) {
     if (!originalLayersAreRead) {
         originalLayersAreRead = true;
         ReadOCProperties();
     }
     base.RegisterLayer(layer);
 }
Esempio n. 4
0
 /// <summary>Sets the layer this XObject belongs to.</summary>
 /// <param name="layer">the layer this XObject belongs to.</param>
 public virtual void SetLayer(IPdfOCG layer)
 {
     GetPdfObject().Put(PdfName.OC, layer.GetIndirectReference());
 }
 /**
 * Begins a graphic block whose visibility is controled by the <CODE>layer</CODE>.
 * Blocks can be nested. Each block must be terminated by an {@link #endLayer()}.<p>
 * Note that nested layers with {@link PdfLayer#addChild(PdfLayer)} only require a single
 * call to this method and a single call to {@link #endLayer()}; all the nesting control
 * is built in.
 * @param layer the layer
 */
 public void BeginLayer(IPdfOCG layer)
 {
     if ((layer is PdfLayer) && ((PdfLayer)layer).Title != null)
         throw new ArgumentException(MessageLocalization.GetComposedMessage("a.title.is.not.a.layer"));
     if (layerDepth == null)
         layerDepth = new List<int>();
     if (layer is PdfLayerMembership) {
         layerDepth.Add(1);
         BeginLayer2(layer);
         return;
     }
     int n = 0;
     PdfLayer la = (PdfLayer)layer;
     while (la != null) {
         if (la.Title == null) {
             BeginLayer2(la);
             ++n;
         }
         la = la.Parent;
     }
     layerDepth.Add(n);
 }
 private void BeginLayer2(IPdfOCG layer)
 {
     PdfName name = (PdfName)writer.AddSimpleProperty(layer, layer.Ref)[0];
     PageResources prs = PageResources;
     name = prs.AddProperty(name, layer.Ref);
     content.Append("/OC ").Append(name.GetBytes()).Append(" BDC").Append_i(separator);
 }
Esempio n. 7
0
        /// <summary>
        /// Constructs an Image object duplicate.
        /// </summary>
        /// <param name="image">another Image object.</param>
        public Image(Image image) : base(image) {
            this.type = image.type;
            this.url = image.url;
            this.rawData = image.rawData;
            this.bpc = image.bpc;
            this.template = image.template;
            this.alignment = image.alignment;
            this.alt = image.alt;
            this.absoluteX = image.absoluteX;
            this.absoluteY = image.absoluteY;
            this.plainWidth = image.plainWidth;
            this.plainHeight = image.plainHeight;
            this.scaledWidth = image.scaledWidth;
            this.scaledHeight = image.scaledHeight;
            this.mySerialId = image.mySerialId;

            this.directReference = image.directReference;

            this.rotationRadians = image.rotationRadians;
            this.initialRotation = image.initialRotation;
            this.indentationLeft = image.indentationLeft;
            this.indentationRight = image.indentationRight;
            this.spacingBefore = image.spacingBefore;
            this.spacingAfter = image.spacingAfter;

            this.widthPercentage = image.widthPercentage;
            this.scaleToFitLineWhenOverflow = image.scaleToFitLineWhenOverflow;
            this.scaleToFitHeight = image.scaleToFitHeight;
            this.annotation = image.annotation;
            this.layer = image.layer;
            this.interpolation = image.interpolation;
            this.originalType = image.originalType;
            this.originalData = image.originalData;
            this.deflated = image.deflated;
            this.dpiX = image.dpiX;
            this.dpiY = image.dpiY;
            this.XYRatio = image.XYRatio;

            this.colorspace = image.colorspace;
            this.invert = image.invert;
            this.profile = image.profile;
            this.additional = image.additional;
            this.mask = image.mask;
            this.imageMask = image.imageMask;
            this.smask = image.smask;
            this.transparency = image.transparency;
            this.role = image.role;
            if (image.accessibleAttributes != null)
                this.accessibleAttributes = new Dictionary<PdfName, PdfObject>(image.accessibleAttributes);
            ID = image.ID;
        }
 /// <summary>
 /// Constructs an Image object duplicate.
 /// </summary>
 /// <param name="image">another Image object.</param>
 public Image(Image image)
     : base(image)
 {
     this.type = image.type;
     this.url = image.url;
     this.alignment = image.alignment;
     this.alt = image.alt;
     this.absoluteX = image.absoluteX;
     this.absoluteY = image.absoluteY;
     this.plainWidth = image.plainWidth;
     this.plainHeight = image.plainHeight;
     this.scaledWidth = image.scaledWidth;
     this.scaledHeight = image.scaledHeight;
     this.rotationRadians = image.rotationRadians;
     this.indentationLeft = image.indentationLeft;
     this.indentationRight = image.indentationRight;
     this.colorspace = image.colorspace;
     this.rawData = image.rawData;
     this.template = image.template;
     this.bpc = image.bpc;
     this.transparency = image.transparency;
     this.mySerialId = image.mySerialId;
     this.invert = image.invert;
     this.dpiX = image.dpiX;
     this.dpiY = image.dpiY;
     this.mask = image.mask;
     this.imageMask = image.imageMask;
     this.interpolation = image.interpolation;
     this.annotation = image.annotation;
     this.profile = image.profile;
     this.deflated = image.deflated;
     this.additional = image.additional;
     this.smask = image.smask;
     this.XYRatio = image.XYRatio;
     this.originalData = image.originalData;
     this.originalType = image.originalType;
     this.spacingAfter = image.spacingAfter;
     this.spacingBefore = image.spacingBefore;
     this.widthPercentage = image.widthPercentage;
     this.layer = image.layer;
     this.initialRotation = image.initialRotation;
     this.directReference = image.directReference;
 }
Esempio n. 9
0
 internal void RegisterLayer(IPdfOCG layer)
 {
     PdfXConformanceImp.CheckPDFXConformance(this, PdfXConformanceImp.PDFXKEY_LAYER, null);
     if (layer is PdfLayer) {
         PdfLayer la = (PdfLayer)layer;
         if (la.Title == null) {
             if (!documentOCG.ContainsKey(layer)) {
                 documentOCG[layer] = null;
                 documentOCGorder.Add(layer);
             }
         }
         else {
             documentOCGorder.Add(layer);
         }
     }
     else
         throw new ArgumentException("Only PdfLayer is accepted.");
 }
 /**
 * Begins a graphic block whose visibility is controled by the <CODE>layer</CODE>.
 * Blocks can be nested. Each block must be terminated by an {@link #endLayer()}.<p>
 * Note that nested layers with {@link PdfLayer#addChild(PdfLayer)} only require a single
 * call to this method and a single call to {@link #endLayer()}; all the nesting control
 * is built in.
 * @param layer the layer
 */
 public void BeginLayer(IPdfOCG layer)
 {
     if ((layer is PdfLayer) && ((PdfLayer)layer).Title != null)
         throw new ArgumentException("A title is not a layer");
     if (layerDepth == null)
         layerDepth = new ArrayList();
     if (layer is PdfLayerMembership) {
         layerDepth.Add(1);
         BeginLayer2(layer);
         return;
     }
     int n = 0;
     PdfLayer la = (PdfLayer)layer;
     while (la != null) {
         if (la.Title == null) {
             BeginLayer2(la);
             ++n;
         }
         la = la.Parent;
     }
     layerDepth.Add(n);
 }