Beispiel #1
0
        public static IList <int> ReadCoverageFormat(RandomAccessFileOrArray rf, int coverageLocation)
        {
            rf.Seek(coverageLocation);
            int         coverageFormat = rf.ReadShort();
            IList <int> glyphIds;

            if (coverageFormat == 1)
            {
                int glyphCount = rf.ReadShort();
                glyphIds = new List <int>(glyphCount);
                for (int i = 0; i < glyphCount; i++)
                {
                    int coverageGlyphId = rf.ReadShort();
                    glyphIds.Add(coverageGlyphId);
                }
            }
            else
            {
                if (coverageFormat == 2)
                {
                    int rangeCount = rf.ReadShort();
                    glyphIds = new List <int>();
                    for (int i = 0; i < rangeCount; i++)
                    {
                        ReadRangeRecord(rf, glyphIds);
                    }
                }
                else
                {
                    throw new NotSupportedException(MessageFormatUtil.Format("Invalid coverage format: {0}", coverageFormat));
                }
            }
            return(JavaCollectionsUtil.UnmodifiableList(glyphIds));
        }
Beispiel #2
0
        public override IList <TagTreePointer> GetRefsList()
        {
            IList <TagTreePointer> refsList = new List <TagTreePointer>();

            foreach (PdfStructElem @ref in GetBackingElem().GetRefsList())
            {
                refsList.Add(new TagTreePointer(@ref, pointerToBackingElem.GetDocument()));
            }
            return(JavaCollectionsUtil.UnmodifiableList(refsList));
        }
Beispiel #3
0
        public virtual IList <TaggingHintKey> GetKidsHint(TaggingHintKey parent)
        {
            IList <TaggingHintKey> kidsHint = kidsHints.Get(parent);

            if (kidsHint == null)
            {
                return(JavaCollectionsUtil.EmptyList <TaggingHintKey>());
            }
            return(JavaCollectionsUtil.UnmodifiableList <TaggingHintKey>(kidsHint));
        }
 /// <summary>Creates a new TextRenderInfo object</summary>
 /// <param name="str">the PDF string that should be displayed</param>
 /// <param name="gs">the graphics state (note: at this time, this is not immutable, so don't cache it)</param>
 /// <param name="textMatrix">the text matrix at the time of the render operation</param>
 /// <param name="canvasTagHierarchy">the marked content tags sequence, if available</param>
 public TextRenderInfo(PdfString str, CanvasGraphicsState gs, Matrix textMatrix, Stack <CanvasTag> canvasTagHierarchy
                       )
 {
     this.@string = str;
     this.textToUserSpaceTransformMatrix = textMatrix.Multiply(gs.GetCtm());
     this.gs = gs;
     this.canvasTagHierarchy = JavaCollectionsUtil.UnmodifiableList <CanvasTag>(new List <CanvasTag>(canvasTagHierarchy
                                                                                                     ));
     this.fontMatrix = gs.GetFont().GetFontMatrix();
 }
Beispiel #5
0
 /// <summary>Create an ImageRenderInfo</summary>
 /// <param name="ctm">the coordinate transformation matrix at the time the image is rendered</param>
 /// <param name="imageStream">image stream object</param>
 /// <param name="resourceName"/>
 /// <param name="colorSpaceDictionary">the color space dictionary from resources which are associated with the image
 ///     </param>
 /// <param name="isInline">defines if the encountered image was inline</param>
 public ImageRenderInfo(Stack <CanvasTag> canvasTagHierarchy, CanvasGraphicsState gs, Matrix ctm, PdfStream
                        imageStream, PdfName resourceName, PdfDictionary colorSpaceDictionary, bool isInline)
     : base(gs)
 {
     this.canvasTagHierarchy = JavaCollectionsUtil.UnmodifiableList <CanvasTag>(new List <CanvasTag>(canvasTagHierarchy
                                                                                                     ));
     this.resourceName         = resourceName;
     this.ctm                  = ctm;
     this.image                = new PdfImageXObject(imageStream);
     this.colorSpaceDictionary = colorSpaceDictionary;
     this.isInline             = isInline;
 }
 /// <param name="gs">The graphics state.</param>
 /// <param name="path">The path to be rendered.</param>
 /// <param name="operation">
 /// One of the possible combinations of
 /// <see cref="STROKE"/>
 /// and
 /// <see cref="FILL"/>
 /// values or
 /// <see cref="NO_OP"/>
 /// </param>
 /// <param name="rule">
 /// Either
 /// <see cref="iText.Kernel.Pdf.Canvas.PdfCanvasConstants.FillingRule.NONZERO_WINDING"/>
 /// or
 /// <see cref="iText.Kernel.Pdf.Canvas.PdfCanvasConstants.FillingRule.EVEN_ODD"/>.
 /// </param>
 /// <param name="isClip">True indicates that current path modifies the clipping path, false - if not.</param>
 /// <param name="clipRule">
 /// Either
 /// <see cref="iText.Kernel.Pdf.Canvas.PdfCanvasConstants.FillingRule.NONZERO_WINDING"/>
 /// or
 /// <see cref="iText.Kernel.Pdf.Canvas.PdfCanvasConstants.FillingRule.EVEN_ODD"/>.
 /// </param>
 public PathRenderInfo(Stack <CanvasTag> canvasTagHierarchy, CanvasGraphicsState gs, Path path, int operation
                       , int rule, bool isClip, int clipRule)
     : base(gs)
 {
     this.canvasTagHierarchy = JavaCollectionsUtil.UnmodifiableList <CanvasTag>(new List <CanvasTag>(canvasTagHierarchy
                                                                                                     ));
     this.path         = path;
     this.operation    = operation;
     this.rule         = rule;
     this.isClip       = isClip;
     this.clippingRule = clipRule;
 }
Beispiel #7
0
        /// <summary>Finalize the columns.</summary>
        /// <returns>
        /// this
        /// <see cref="ColgroupWrapper"/>
        /// instance
        /// </returns>
        public virtual iText.Html2pdf.Attach.Wrapelement.ColgroupWrapper FinalizeCols()
        {
            if (indexToColMapping != null)
            {
                return(this);
            }
            if (columns.IsEmpty())
            {
                columns.Add(new ColWrapper(span).SetCellCssProps(cellCssProps).SetWidth(width));
            }
            else
            {
                if (cellCssProps != null)
                {
                    foreach (ColWrapper col in columns)
                    {
                        IDictionary <String, String> colStyles = new Dictionary <String, String>(cellCssProps);
                        if (col.GetCellCssProps() != null)
                        {
                            colStyles.AddAll(col.GetCellCssProps());
                        }
                        if (colStyles.Count > 0)
                        {
                            col.SetCellCssProps(colStyles);
                        }
                        if (col.GetWidth() == null)
                        {
                            col.SetWidth(width);
                        }
                    }
                }
            }
            columns = JavaCollectionsUtil.UnmodifiableList(columns);
            int ncol = 0;

            foreach (ColWrapper col in columns)
            {
                ncol += col.GetSpan();
            }
            indexToColMapping = new int[ncol];
            span = 0;
            for (int i = 0; i < columns.Count; ++i)
            {
                int colSpan = columns[i].GetSpan();
                for (int j = 0; j < colSpan; ++j)
                {
                    indexToColMapping[span + j] = i;
                }
                span += colSpan;
            }
            return(this);
        }
Beispiel #8
0
        public virtual void JavaCollectionsUtilTest()
        {
            IList <int> emptyList = JavaCollectionsUtil.EmptyList <int>();

            Assert.IsEmpty(emptyList);
            Assert.Throws <NotSupportedException>(() => emptyList.Add(10));

            IDictionary <int, int> emptyMap = JavaCollectionsUtil.EmptyMap <int, int>();

            Assert.IsEmpty(emptyMap);
            Assert.Throws <NotSupportedException>(() => { emptyMap[5] = 10; });

            IEnumerator <int> emptyIterator = JavaCollectionsUtil.EmptyIterator <int>();

            Assert.False(emptyIterator.MoveNext());

            IList <int> unmodifiableList = JavaCollectionsUtil.UnmodifiableList <int>(new int[] { 10, 20, 30, 20 }.ToList());

            Assert.Throws <NotSupportedException>(() => unmodifiableList.Insert(0, 20));
            Assert.Throws <NotSupportedException>(() => { unmodifiableList[2] = 50; });
            int test = unmodifiableList[3];

            Assert.Throws <NotSupportedException>(() => JavaCollectionsUtil.Sort(unmodifiableList));

            IDictionary <int, int> unodifiableMap = JavaCollectionsUtil.UnmodifiableMap(new Dictionary <int, int>()
            {
                { 1, 20 },
                { 2, 40 },
                { 70, 80 },
            });

            test = unodifiableMap[2];
            Assert.Throws <KeyNotFoundException>(() => { int temp = unodifiableMap[3]; });
            Assert.Throws <NotSupportedException>(() => { unodifiableMap[11] = 11; });

            IList <int> singletonList = JavaCollectionsUtil.SingletonList(4);

            Assert.AreEqual(4, singletonList[0]);
            Assert.Throws <NotSupportedException>(() => singletonList.Add(9));

            List <int> x = new int[] { 60, 50, 20 }.ToList();

            JavaCollectionsUtil.Sort(x);
            Assert.AreEqual(20, x[0]);
            Assert.AreEqual(60, x[2]);

            x = new int[] { -1, 0, 1 }.ToList();
            JavaCollectionsUtil.Reverse(x);
            Assert.AreEqual(1, x[0]);
            Assert.AreEqual(0, x[1]);
        }
Beispiel #9
0
        /// <summary>Get the attributes as a List, for iteration.</summary>
        /// <remarks>
        /// Get the attributes as a List, for iteration. Do not modify the keys of the attributes via this view, as changes
        /// to keys will not be recognised in the containing set.
        /// </remarks>
        /// <returns>an view of the attributes as a List.</returns>
        public virtual IList <iText.StyledXmlParser.Jsoup.Nodes.Attribute> AsList()
        {
            if (attributes == null)
            {
                return(JavaCollectionsUtil.EmptyList <Attribute>());
            }

            IList <iText.StyledXmlParser.Jsoup.Nodes.Attribute> list = new List <iText.StyledXmlParser.Jsoup.Nodes.Attribute>(attributes.Count());

            foreach (KeyValuePair <String, iText.StyledXmlParser.Jsoup.Nodes.Attribute> entry in attributes)
            {
                list.Add(entry.Value);
            }
            return(JavaCollectionsUtil.UnmodifiableList(list));
        }
Beispiel #10
0
 /// <summary>Gets the list of page classes.</summary>
 /// <returns>the page classes</returns>
 public virtual IList <String> GetPageClasses()
 {
     return(JavaCollectionsUtil.UnmodifiableList(pageClasses));
 }
Beispiel #11
0
 public IList <ISvgNodeRenderer> GetChildren()
 {
     // final method, in order to disallow modifying the List
     return(JavaCollectionsUtil.UnmodifiableList(children));
 }
Beispiel #12
0
 /* (non-Javadoc)
  * @see com.itextpdf.styledxmlparser.html.node.INode#childNodes()
  */
 public virtual IList <INode> ChildNodes()
 {
     return(JavaCollectionsUtil.UnmodifiableList(childNodes));
 }
Beispiel #13
0
 /// <summary>Sets list of languages to be recognized in provided images.</summary>
 /// <remarks>
 /// Sets list of languages to be recognized in provided images.
 /// Consult with documentation of specific engine implementations
 /// to check on which format to give the language in.
 /// </remarks>
 /// <param name="requiredLanguages">
 ///
 /// <see cref="System.Collections.IList{E}"/>
 /// of languages in string
 /// format
 /// </param>
 /// <returns>
 /// the
 /// <see cref="OcrEngineProperties"/>
 /// instance
 /// </returns>
 public iText.Pdfocr.OcrEngineProperties SetLanguages(IList <String> requiredLanguages)
 {
     languages = JavaCollectionsUtil.UnmodifiableList <String>(requiredLanguages);
     return(this);
 }
Beispiel #14
0
 /// <summary>
 /// Sets list of page of processing image as list of
 /// <see cref="System.Drawing.Bitmap"/>
 /// , one per page.
 /// </summary>
 /// <param name="listOfPages">
 /// list of
 /// <see cref="System.Drawing.Bitmap"/>
 /// for
 /// each page.
 /// </param>
 internal void SetListOfPages(IList <Bitmap> pages)
 {
     imagePages = JavaCollectionsUtil.UnmodifiableList <Bitmap>(pages);
 }
 /// <summary>Gets the CSS statements of this style sheet.</summary>
 /// <returns>the CSS statements</returns>
 public virtual IList <CssStatement> GetStatements()
 {
     return(JavaCollectionsUtil.UnmodifiableList(statements));
 }
Beispiel #16
0
 /// <summary>Sets bbox coordinates.</summary>
 /// <param name="bbox">
 ///
 /// <see cref="System.Collections.IList{E}"/>
 /// of bbox parameters
 /// </param>
 public virtual void SetBbox(IList <float> bbox)
 {
     this.bbox = JavaCollectionsUtil.UnmodifiableList <float>(bbox);
 }
 public virtual IList <ICssSelectorItem> GetSelectorItems()
 {
     return(JavaCollectionsUtil.UnmodifiableList(selectorItems));
 }
 public override IList <TagTreePointer> GetRefsList()
 {
     return(JavaCollectionsUtil.UnmodifiableList(refs));
 }
Beispiel #19
0
 /// <returns>Returns a read-only copy of child nodes list.</returns>
 public virtual IList GetUnmodifiableChildren()
 {
     return(JavaCollectionsUtil.UnmodifiableList(GetChildren()));
 }
Beispiel #20
0
 /// <summary>Gets the cells of the row.</summary>
 /// <returns>the cells</returns>
 public virtual IList <Cell> GetCells()
 {
     return(JavaCollectionsUtil.UnmodifiableList(cells));
 }
Beispiel #21
0
 /// <summary>Get this node's children.</summary>
 /// <remarks>
 /// Get this node's children. Presented as an unmodifiable list: new children can not be added, but the child nodes
 /// themselves can be manipulated.
 /// </remarks>
 /// <returns>list of children. If no children, returns an empty list.</returns>
 public virtual IList <iText.StyledXmlParser.Jsoup.Nodes.Node> ChildNodes()
 {
     return(JavaCollectionsUtil.UnmodifiableList(childNodes));
 }
Beispiel #22
0
 /// <summary>
 /// Creates a new
 /// <see cref="TextInfo"/>
 /// instance.
 /// </summary>
 /// <param name="text">any text</param>
 /// <param name="bbox">
 ///
 /// <see cref="System.Collections.IList{E}"/>
 /// of bbox parameters
 /// </param>
 public TextInfo(String text, IList <float> bbox)
 {
     this.text = text;
     this.bbox = JavaCollectionsUtil.UnmodifiableList <float>(bbox);
 }