示例#1
0
        protected internal override void CheckForm(PdfDictionary form)
        {
            if (form == null)
            {
                return;
            }
            PdfBoolean needAppearances = form.GetAsBoolean(PdfName.NeedAppearances);

            if (needAppearances != null && needAppearances.GetValue())
            {
                throw new PdfAConformanceException(PdfAConformanceException.NEEDAPPEARANCES_FLAG_OF_THE_INTERACTIVE_FORM_DICTIONARY_SHALL_EITHER_NOT_BE_PRESENTED_OR_SHALL_BE_FALSE
                                                   );
            }
            CheckResources(form.GetAsDictionary(PdfName.DR));
            PdfArray fields = form.GetAsArray(PdfName.Fields);

            if (fields != null)
            {
                fields = GetFormFields(fields);
                foreach (PdfObject field in fields)
                {
                    PdfDictionary fieldDic = (PdfDictionary)field;
                    if (fieldDic.ContainsKey(PdfName.A) || fieldDic.ContainsKey(PdfName.AA))
                    {
                        throw new PdfAConformanceException(PdfAConformanceException.WIDGET_ANNOTATION_DICTIONARY_OR_FIELD_DICTIONARY_SHALL_NOT_INCLUDE_A_OR_AA_ENTRY
                                                           );
                    }
                    CheckResources(fieldDic.GetAsDictionary(PdfName.DR));
                }
            }
        }
示例#2
0
文件: Visitor.cs 项目: n9/pdfclown
 public virtual PdfObject Visit(
     PdfBoolean obj,
     object data
     )
 {
     return obj;
 }
示例#3
0
 /// <summary>
 /// Initialize a new instance
 /// </summary>
 public PdfMask()
     : base()
 {
     Compress            = true;
     this["ColorSpace"]  = new PdfName("DeviceGray");
     this["Interpolate"] = new PdfBoolean(false);
 }
示例#4
0
        protected override void CheckImage(PdfWriter writer, int key, Object obj1)
        {
            PdfImage image = (PdfImage)obj1;

            if (image.Get(PdfName.SMASK) != null && !PdfName.NONE.Equals(image.GetAsName(PdfName.SMASK)))
            {
                throw new PdfAConformanceException(obj1, MessageLocalization.GetComposedMessage("the.smask.key.is.not.allowed.in.images"));
            }
            if (image.Contains(PdfName.ALTERNATES))
            {
                throw new PdfAConformanceException(obj1, MessageLocalization.GetComposedMessage("an.image.dictionary.shall.not.contain.alternates.key"));
            }
            if (image.Contains(PdfName.OPI))
            {
                throw new PdfAConformanceException(obj1, MessageLocalization.GetComposedMessage("an.image.dictionary.shall.not.contain.opi.key"));
            }
            PdfBoolean interpolate = image.GetAsBoolean(PdfName.INTERPOLATE);

            if (interpolate != null && interpolate.BooleanValue)
            {
                throw new PdfAConformanceException(obj1, MessageLocalization.GetComposedMessage("the.value.of.interpolate.key.shall.not.be.true"));
            }
            PdfName intent = image.GetAsName(PdfName.INTENT);

            if (intent != null && !(PdfName.RELATIVECOLORIMETRIC.Equals(intent) || PdfName.ABSOLUTECOLORIMETRIC.Equals(intent) || PdfName.PERCEPTUAL.Equals(intent) || PdfName.SATURATION.Equals(intent)))
            {
                throw new PdfAConformanceException(obj1, MessageLocalization.GetComposedMessage("1.value.of.intent.key.is.not.allowed", intent.ToString()));
            }
        }
示例#5
0
        public void CastNullThrows()
        {
            PdfBoolean boolean = null;

            // ReSharper disable once ExpressionIsAlwaysNull
            Action action = () => Test(boolean);

            Assert.Throws <ArgumentNullException>(action);
        }
        /// <summary>
        /// Initialize a new catalog
        /// </summary>
        public PdfCatalog()
        {
            this["Type"]    = new PdfName("Catalog");
            this["Version"] = new PdfName("1.5");
            PdfDictionary markInfo = new PdfDictionary();

            markInfo["Marked"] = new PdfBoolean(true);
            this["MarkInfo"]   = markInfo;
        }
 /// <summary>
 /// Initialize a new instance
 /// </summary>
 public PdfImage()
 {
     Compress                 = false;
     this["Type"]             = new PdfName("XObject");
     this["Subtype"]          = new PdfName("Image");
     this["ColorSpace"]       = new PdfName("DeviceRGB");
     this["BitsPerComponent"] = new PdfNumeric(8);
     this["Filter"]           = new PdfName("DCTDecode");
     this["Interpolate"]      = new PdfBoolean(true);
 }
示例#8
0
 /// <summary>Creates a Sound action (section 12.6.4.8 of ISO 32000-1).</summary>
 /// <remarks>Creates a Sound action (section 12.6.4.8 of ISO 32000-1). Deprecated in PDF 2.0.</remarks>
 /// <param name="sound">a sound object defining the sound that shall be played (see section 13.3 of ISO 32000-1)
 ///     </param>
 /// <param name="volume">the volume at which to play the sound, in the range -1.0 to 1.0. Default value: 1.0</param>
 /// <param name="synchronous">
 /// a flag specifying whether to play the sound synchronously or asynchronously.
 /// If this flag is <c>true</c>, the conforming reader retains control, allowing no further user
 /// interaction other than canceling the sound, until the sound has been completely played.
 /// Default value: <c>false</c>
 /// </param>
 /// <param name="repeat">
 /// a flag specifying whether to repeat the sound indefinitely
 /// If this entry is present, the Synchronous entry shall be ignored. Default value: <c>false</c>
 /// </param>
 /// <param name="mix">a flag specifying whether to mix this sound with any other sound already playing</param>
 /// <returns>created action</returns>
 public static iText.Kernel.Pdf.Action.PdfAction CreateSound(PdfStream sound, float volume, bool synchronous
                                                             , bool repeat, bool mix)
 {
     if (volume < -1 || volume > 1)
     {
         throw new ArgumentException("volume");
     }
     return(new iText.Kernel.Pdf.Action.PdfAction().Put(PdfName.S, PdfName.Sound).Put(PdfName.Sound, sound).Put
                (PdfName.Volume, new PdfNumber(volume)).Put(PdfName.Synchronous, PdfBoolean.ValueOf(synchronous)).Put(
                PdfName.Repeat, PdfBoolean.ValueOf(repeat)).Put(PdfName.Mix, PdfBoolean.ValueOf(mix)));
 }
示例#9
0
 protected override void CheckForm(PdfWriter writer, int key, Object obj1)
 {
     if (obj1 is PdfAcroForm)
     {
         PdfAcroForm form            = (PdfAcroForm)obj1;
         PdfBoolean  needAppearances = form.GetAsBoolean(PdfName.NEEDAPPEARANCES);
         if (needAppearances != null && needAppearances.BooleanValue)
         {
             throw new PdfAConformanceException(obj1, MessageLocalization.GetComposedMessage("needappearances.flag.of.the.interactive.form.dictionary.shall.either.not.be.present.or.shall.be.false"));
         }
     }
 }
示例#10
0
        /// <summary>Defines the sort order of the field (ascending or descending).</summary>
        /// <param name="ascending">true is the default, use false for descending order</param>
        public virtual iText.Kernel.Pdf.Collection.PdfCollectionSort SetSortOrder(bool ascending)
        {
            PdfObject obj = GetPdfObject().Get(PdfName.S);

            if (obj.IsName())
            {
                GetPdfObject().Put(PdfName.A, PdfBoolean.ValueOf(ascending));
            }
            else
            {
                throw new PdfException(PdfException.YouHaveToDefineABooleanArrayForThisCollectionSortDictionary);
            }
            return(this);
        }
示例#11
0
 /// <summary>Creates a Hide action (section 12.6.4.10 of ISO 32000-1).</summary>
 /// <param name="annotations">the annotations to be hidden or shown</param>
 /// <param name="hidden">a flag indicating whether to hide the annotation (<c>true</c>) or show it (<c>false</c>)
 ///     </param>
 /// <returns>created action</returns>
 public static iText.Kernel.Pdf.Action.PdfAction CreateHide(PdfAnnotation[] annotations, bool hidden)
 {
     return(new iText.Kernel.Pdf.Action.PdfAction().Put(PdfName.S, PdfName.Hide).Put(PdfName.T, GetPdfArrayFromAnnotationsList
                                                                                         (annotations)).Put(PdfName.H, PdfBoolean.ValueOf(hidden)));
 }
示例#12
0
 /// <summary>Creates a Hide action (section 12.6.4.10 of ISO 32000-1).</summary>
 /// <param name="annotation">the annotation to be hidden or shown</param>
 /// <param name="hidden">a flag indicating whether to hide the annotation (<c>true</c>) or show it (<c>false</c>)
 ///     </param>
 /// <returns>created action</returns>
 public static iText.Kernel.Pdf.Action.PdfAction CreateHide(PdfAnnotation annotation, bool hidden)
 {
     return(new iText.Kernel.Pdf.Action.PdfAction().Put(PdfName.S, PdfName.Hide).Put(PdfName.T, annotation.GetPdfObject
                                                                                         ()).Put(PdfName.H, PdfBoolean.ValueOf(hidden)));
 }
示例#13
0
        /// <summary>
        /// If true, the text specified by the
        /// <see cref="iText.Kernel.Pdf.PdfName.Contents"/>
        /// or
        /// <see cref="iText.Kernel.Pdf.PdfName.RC"/>
        /// entries
        /// (see
        /// <see cref="PdfAnnotation.GetContents()"/>
        /// and
        /// <see cref="PdfMarkupAnnotation.GetRichText()"/>
        /// )
        /// is replicated as a caption in the appearance of the line.
        /// </summary>
        /// <returns>
        /// true, if the annotation text is replicated as a caption, false otherwise. If this property is
        /// not set, default value is used which is <i>false</i>.
        /// </returns>
        public virtual bool GetContentsAsCaption()
        {
            PdfBoolean b = GetPdfObject().GetAsBoolean(PdfName.Cap);

            return(b != null && b.GetValue());
        }
示例#14
0
 /// <summary>Creates a URI action (section 12.6.4.7 of ISO 32000-1).</summary>
 /// <param name="uri">the uniform resource identifier to resolve</param>
 /// <param name="isMap">a flag specifying whether to track the mouse position when the URI is resolved</param>
 /// <returns>created action</returns>
 public static iText.Kernel.Pdf.Action.PdfAction CreateURI(String uri, bool isMap)
 {
     return(new iText.Kernel.Pdf.Action.PdfAction().Put(PdfName.S, PdfName.URI).Put(PdfName.URI, new PdfString(
                                                                                        uri)).Put(PdfName.IsMap, PdfBoolean.ValueOf(isMap)));
 }
示例#15
0
 /// <summary>Creates a GoToE action, or embedded file action (section 12.6.4.4 of ISO 32000-1).</summary>
 /// <param name="fileSpec">The root document of the target relative to the root document of the source</param>
 /// <param name="destination">the destination in the target to jump to</param>
 /// <param name="newWindow">
 /// if true, the destination document should be opened in a new window;
 /// if false, the destination document should replace the current document in the same window
 /// </param>
 /// <param name="targetDictionary">
 /// A target dictionary specifying path information to the target document.
 /// Each target dictionary specifies one element in the full path to the target and
 /// may have nested target dictionaries specifying additional elements
 /// </param>
 /// <returns>created action</returns>
 public static iText.Kernel.Pdf.Action.PdfAction CreateGoToE(PdfFileSpec fileSpec, PdfDestination destination
                                                             , bool newWindow, PdfTarget targetDictionary)
 {
     iText.Kernel.Pdf.Action.PdfAction action = new iText.Kernel.Pdf.Action.PdfAction().Put(PdfName.S, PdfName.
                                                                                            GoToE).Put(PdfName.NewWindow, PdfBoolean.ValueOf(newWindow));
     if (fileSpec != null)
     {
         action.Put(PdfName.F, fileSpec.GetPdfObject());
     }
     if (destination != null)
     {
         ValidateRemoteDestination(destination);
         action.Put(PdfName.D, destination.GetPdfObject());
     }
     else
     {
         LogManager.GetLogger(typeof(iText.Kernel.Pdf.Action.PdfAction)).Warn(iText.IO.LogMessageConstant.EMBEDDED_GO_TO_DESTINATION_NOT_SPECIFIED
                                                                              );
     }
     if (targetDictionary != null)
     {
         action.Put(PdfName.T, targetDictionary.GetPdfObject());
     }
     return(action);
 }
示例#16
0
        /**
         * <summary>Parses the current PDF object [PDF:1.6:3.2].</summary>
         */
        public virtual PdfDataObject ParsePdfObject(
            )
        {
            switch (TokenType)
            {
            case TokenTypeEnum.Integer:
                return(PdfInteger.Get((int)Token));

            case TokenTypeEnum.Name:
                return(new PdfName((string)Token, true));

            case TokenTypeEnum.DictionaryBegin:
            {
                PdfDictionary dictionary = new PdfDictionary();
                dictionary.Updateable = false;
                while (true)
                {
                    // Key.
                    MoveNext(); if (TokenType == TokenTypeEnum.DictionaryEnd)
                    {
                        break;
                    }
                    PdfName key = (PdfName)ParsePdfObject();
                    // Value.
                    MoveNext();
                    PdfDirectObject value = (PdfDirectObject)ParsePdfObject();
                    // Add the current entry to the dictionary!
                    dictionary[key] = value;
                }
                dictionary.Updateable = true;
                return(dictionary);
            }

            case TokenTypeEnum.ArrayBegin:
            {
                PdfArray array = new PdfArray();
                array.Updateable = false;
                while (true)
                {
                    // Value.
                    MoveNext(); if (TokenType == TokenTypeEnum.ArrayEnd)
                    {
                        break;
                    }
                    // Add the current item to the array!
                    array.Add((PdfDirectObject)ParsePdfObject());
                }
                array.Updateable = true;
                return(array);
            }

            case TokenTypeEnum.Literal:
                if (Token is DateTime)
                {
                    return(PdfDate.Get((DateTime)Token));
                }
                else
                {
                    return(new PdfTextString(
                               Encoding.Pdf.Encode((string)Token)
                               ));
                }

            case TokenTypeEnum.Hex:
                return(new PdfTextString(
                           (string)Token,
                           PdfString.SerializationModeEnum.Hex
                           ));

            case TokenTypeEnum.Real:
                return(PdfReal.Get((double)Token));

            case TokenTypeEnum.Boolean:
                return(PdfBoolean.Get((bool)Token));

            case TokenTypeEnum.Null:
                return(null);

            default:
                throw new PostScriptParseException(String.Format("Unknown type beginning: '{0}'", Token), this);
            }
        }
示例#17
0
        /// <summary>Creates a Set-OCG-State action (section 12.6.4.12 of ISO 32000-1).</summary>
        /// <param name="states">
        /// states a list of
        /// <see cref="PdfActionOcgState"/>
        /// state descriptions
        /// </param>
        /// <param name="preserveRb">
        /// If true, indicates that radio-button state relationships between optional content groups
        /// should be preserved when the states are applied
        /// </param>
        /// <returns>created action</returns>
        public static iText.Kernel.Pdf.Action.PdfAction CreateSetOcgState(IList <PdfActionOcgState> states, bool preserveRb
                                                                          )
        {
            PdfArray stateArr = new PdfArray();

            foreach (PdfActionOcgState state in states)
            {
                stateArr.AddAll(state.GetObjectList());
            }
            return(new iText.Kernel.Pdf.Action.PdfAction().Put(PdfName.S, PdfName.SetOCGState).Put(PdfName.State, stateArr
                                                                                                   ).Put(PdfName.PreserveRB, PdfBoolean.ValueOf(preserveRb)));
        }
示例#18
0
 /// <summary>Sets the initial visibility of the field.</summary>
 /// <param name="visible"/>
 public virtual iText.Kernel.Pdf.Collection.PdfCollectionField SetVisibility(bool visible)
 {
     GetPdfObject().Put(PdfName.V, PdfBoolean.ValueOf(visible));
     return(this);
 }
示例#19
0
 /// <summary>Creates a GoToE action, or embedded file action (section 12.6.4.4 of ISO 32000-1).</summary>
 /// <param name="fileSpec">The root document of the target relative to the root document of the source</param>
 /// <param name="destination">the destination in the target to jump to</param>
 /// <param name="newWindow">
 /// if true, the destination document should be opened in a new window;
 /// if false, the destination document should replace the current document in the same window
 /// </param>
 /// <param name="targetDictionary">
 /// A target dictionary specifying path information to the target document.
 /// Each target dictionary specifies one element in the full path to the target and
 /// may have nested target dictionaries specifying additional elements
 /// </param>
 /// <returns>created action</returns>
 public static iText.Kernel.Pdf.Action.PdfAction CreateGoToE(PdfFileSpec fileSpec, PdfDestination destination
                                                             , bool newWindow, PdfTarget targetDictionary)
 {
     iText.Kernel.Pdf.Action.PdfAction action = new iText.Kernel.Pdf.Action.PdfAction().Put(PdfName.S, PdfName.
                                                                                            GoToE).Put(PdfName.NewWindow, PdfBoolean.ValueOf(newWindow));
     if (fileSpec != null)
     {
         action.Put(PdfName.F, fileSpec.GetPdfObject());
     }
     if (destination != null)
     {
         action.Put(PdfName.D, destination.GetPdfObject());
     }
     if (targetDictionary != null)
     {
         action.Put(PdfName.T, targetDictionary.GetPdfObject());
     }
     return(action);
 }
 public virtual iText.Kernel.Pdf.Annot.PdfRedactAnnotation SetRepeat(PdfBoolean repeat)
 {
     return((iText.Kernel.Pdf.Annot.PdfRedactAnnotation)Put(PdfName.Repeat, repeat));
 }
示例#21
0
 /// <summary>
 /// If set to true, the text specified by the
 /// <see cref="iText.Kernel.Pdf.PdfName.Contents"/>
 /// or
 /// <see cref="iText.Kernel.Pdf.PdfName.RC"/>
 /// entries
 /// (see
 /// <see cref="PdfAnnotation.GetContents()"/>
 /// and
 /// <see cref="PdfMarkupAnnotation.GetRichText()"/>
 /// )
 /// will be replicated as a caption in the appearance of the line.
 /// </summary>
 /// <param name="contentsAsCaption">true, if the annotation text should be replicated as a caption, false otherwise.
 ///     </param>
 /// <returns>
 /// this
 /// <see cref="PdfLineAnnotation"/>
 /// instance.
 /// </returns>
 public virtual iText.Kernel.Pdf.Annot.PdfLineAnnotation SetContentsAsCaption(bool contentsAsCaption)
 {
     return((iText.Kernel.Pdf.Annot.PdfLineAnnotation)Put(PdfName.Cap, PdfBoolean.ValueOf(contentsAsCaption)));
 }
示例#22
0
        private void DrawOverlayText(PdfCanvas canvas, String overlayText, Rectangle annotRect, PdfBoolean repeat,
                                     PdfString defaultAppearance, int justification)
        {
            IDictionary <String, IList> parsedDA;

            try {
                parsedDA = ParseDAParam(defaultAppearance);
            }
            catch (NullReferenceException) {
                throw new PdfException(PdfException.DefaultAppearanceNotFound);
            }
            PdfFont       font;
            float         fontSize       = 12;
            IList         fontArgs       = parsedDA.Get("Tf");
            PdfDictionary formDictionary = pdfDocument.GetCatalog().GetPdfObject().GetAsDictionary(PdfName.AcroForm);

            if (fontArgs != null && formDictionary != null)
            {
                font     = GetFontFromAcroForm((PdfName)fontArgs[0]);
                fontSize = ((PdfNumber)fontArgs[1]).FloatValue();
            }
            else
            {
                font = PdfFontFactory.CreateFont();
            }
            if (pdfDocument.IsTagged())
            {
                canvas.OpenTag(new CanvasArtifact());
            }
            iText.Layout.Canvas modelCanvas   = new iText.Layout.Canvas(canvas, pdfDocument, annotRect, false);
            Paragraph           p             = new Paragraph(overlayText).SetFont(font).SetFontSize(fontSize).SetMargin(0);
            TextAlignment?      textAlignment = TextAlignment.LEFT;

            switch (justification)
            {
            case 1: {
                textAlignment = TextAlignment.CENTER;
                break;
            }

            case 2: {
                textAlignment = TextAlignment.RIGHT;
                break;
            }

            default: {
                break;
            }
            }
            p.SetTextAlignment(textAlignment);
            IList strokeColorArgs;

            parsedDA.TryGetValue("StrokeColor", out strokeColorArgs);
            if (strokeColorArgs != null)
            {
                p.SetStrokeColor(GetColor(strokeColorArgs));
            }
            IList fillColorArgs;

            parsedDA.TryGetValue("FillColor", out fillColorArgs);
            if (fillColorArgs != null)
            {
                p.SetFontColor(GetColor(fillColorArgs));
            }
            modelCanvas.Add(p);
            if (repeat != null && repeat.GetValue())
            {
                bool?isFull = modelCanvas.GetRenderer().GetPropertyAsBoolean(Property.FULL);
                while (isFull == null || (bool)!isFull)
                {
                    p.Add(overlayText);
                    LayoutArea previousArea = modelCanvas.GetRenderer().GetCurrentArea().Clone();
                    modelCanvas.Relayout();
                    if (modelCanvas.GetRenderer().GetCurrentArea().Equals(previousArea))
                    {
                        // Avoid infinite loop. This might be caused by the fact that the font does not support the text we want to show
                        break;
                    }
                    isFull = modelCanvas.GetRenderer().GetPropertyAsBoolean(Property.FULL);
                }
            }
            modelCanvas.GetRenderer().Flush();
            if (pdfDocument.IsTagged())
            {
                canvas.CloseTag();
            }
        }
示例#23
0
        public virtual bool GetOpen()
        {
            PdfBoolean open = GetPdfObject().GetAsBoolean(PdfName.Open);

            return(open != null && open.GetValue());
        }
示例#24
0
 /// <summary>Creates a Hide action (section 12.6.4.10 of ISO 32000-1).</summary>
 /// <param name="text">
 /// a text string giving the fully qualified field name of an interactive form field whose
 /// associated widget annotation or annotations are to be affected
 /// </param>
 /// <param name="hidden">a flag indicating whether to hide the annotation (<c>true</c>) or show it (<c>false</c>)
 ///     </param>
 /// <returns>created action</returns>
 public static iText.Kernel.Pdf.Action.PdfAction CreateHide(String text, bool hidden)
 {
     return(new iText.Kernel.Pdf.Action.PdfAction().Put(PdfName.S, PdfName.Hide).Put(PdfName.T, new PdfString(text
                                                                                                              )).Put(PdfName.H, PdfBoolean.ValueOf(hidden)));
 }
示例#25
0
 /// <summary>Creates a Hide action (section 12.6.4.10 of ISO 32000-1).</summary>
 /// <param name="text">
 /// a text string array giving the fully qualified field names of interactive form fields whose
 /// associated widget annotation or annotations are to be affected
 /// </param>
 /// <param name="hidden">a flag indicating whether to hide the annotation (<c>true</c>) or show it (<c>false</c>)
 ///     </param>
 /// <returns>created action</returns>
 public static iText.Kernel.Pdf.Action.PdfAction CreateHide(String[] text, bool hidden)
 {
     return(new iText.Kernel.Pdf.Action.PdfAction().Put(PdfName.S, PdfName.Hide).Put(PdfName.T, GetArrayFromStringList
                                                                                         (text)).Put(PdfName.H, PdfBoolean.ValueOf(hidden)));
 }
示例#26
0
        private void DrawOverlayText(PdfContentByte canvas, IList <Rectangle> textRectangles, PdfString overlayText,
                                     PdfString otDA, PdfNumber otQ, PdfBoolean otRepeat)
        {
            ColumnText ct = new ColumnText(canvas);

            ct.SetLeading(0, 1.2F);
            ct.UseAscender = true;

            String otStr = overlayText.ToUnicodeString();

            canvas.SaveState();
            IDictionary <string, IList <object> > parsedDA = ParseDAParam(otDA);

            Font font = null;

            if (parsedDA.ContainsKey(STROKE_COLOR))
            {
                IList <object> strokeColorArgs = parsedDA[STROKE_COLOR];
                SetStrokeColor(canvas, strokeColorArgs);
            }

            if (parsedDA.ContainsKey(FILL_COLOR))
            {
                IList <object> fillColorArgs = parsedDA[FILL_COLOR];
                SetFillColor(canvas, fillColorArgs);
            }

            if (parsedDA.ContainsKey("Tf"))
            {
                IList <object> tfArgs = parsedDA["Tf"];
                font = RetrieveFontFromAcroForm((PdfName)tfArgs[0], (PdfNumber)tfArgs[1]);
            }

            foreach (Rectangle textRect in textRectangles)
            {
                ct.SetSimpleColumn(textRect);

                if (otQ != null)
                {
                    ct.Alignment = otQ.IntValue;
                }

                Phrase otPhrase;

                if (font != null)
                {
                    otPhrase = new Phrase(otStr, font);
                }
                else
                {
                    otPhrase = new Phrase(otStr);
                }

                float y = ct.YLine;

                if (otRepeat != null && otRepeat.BooleanValue)
                {
                    int status = ct.Go(true);

                    while (!ColumnText.HasMoreText(status))
                    {
                        otPhrase.Add(otStr);
                        ct.SetText(otPhrase);
                        ct.YLine = y;
                        status   = ct.Go(true);
                    }
                }

                ct.SetText(otPhrase);
                ct.YLine = y;
                ct.Go();
            }

            canvas.RestoreState();
        }
示例#27
0
 /// <summary>Creates a GoToR action, or remote action (section 12.6.4.3 of ISO 32000-1).</summary>
 /// <param name="fileSpec">the file in which the destination shall be located</param>
 /// <param name="destination">the destination in the remote document to jump to</param>
 /// <param name="newWindow">a flag specifying whether to open the destination document in a new window</param>
 /// <returns>created action</returns>
 public static iText.Kernel.Pdf.Action.PdfAction CreateGoToR(PdfFileSpec fileSpec, PdfDestination destination
                                                             , bool newWindow)
 {
     return(CreateGoToR(fileSpec, destination).Put(PdfName.NewWindow, PdfBoolean.ValueOf(newWindow)));
 }
示例#28
0
 public virtual iText.Kernel.Pdf.Filespec.PdfFileSpec SetVolatile(PdfBoolean isVolatile)
 {
     return(Put(PdfName.Volatile, isVolatile));
 }
示例#29
0
 /// <summary>Indication if the field value should be editable in the viewer.</summary>
 /// <param name="editable"/>
 public virtual iText.Kernel.Pdf.Collection.PdfCollectionField SetEditable(bool editable)
 {
     GetPdfObject().Put(PdfName.E, PdfBoolean.ValueOf(editable));
     return(this);
 }
示例#30
0
 /// <summary>
 /// Writes the specified value to the PDF stream.
 /// </summary>
 public void Write(PdfBoolean value)
 {
   WriteSeparator(CharCat.Character);
   WriteRaw(value.Value ? "true" : "false");
   this.lastCat = CharCat.Character;
 }
示例#31
0
 /// <summary>
 /// Writes the specified value to the PDF stream.
 /// </summary>
 public void Write(PdfBoolean value)
 {
     WriteSeparator(CharCat.Character);
     WriteRaw(value.Value ? "true" : "false");
     _lastCat = CharCat.Character;
 }
 private bool ObjectsIsEquals(PdfBoolean outBoolean, PdfBoolean cmpBoolean)
 {
     return(Util.ArraysAreEqual(cmpBoolean.GetBytes(), outBoolean.GetBytes()));
 }