Пример #1
0
        protected internal virtual void AddResource(PdfObject resource, PdfName resType, PdfName resName)
        {
            if (resType.Equals(PdfName.XObject))
            {
                CheckAndResolveCircularReferences(resource);
            }
            if (readOnly)
            {
                SetPdfObject(GetPdfObject().Clone(JavaCollectionsUtil.EmptyList <PdfName>()));
                BuildResources(GetPdfObject());
                isModified = true;
                readOnly   = false;
            }
            if (GetPdfObject().ContainsKey(resType) && GetPdfObject().GetAsDictionary(resType).ContainsKey(resName))
            {
                return;
            }
            resourceToName.Put(resource, resName);
            PdfDictionary resourceCategory = GetPdfObject().GetAsDictionary(resType);

            if (resourceCategory == null)
            {
                GetPdfObject().Put(resType, resourceCategory = new PdfDictionary());
            }
            resourceCategory.Put(resName, resource);
            SetModified();
        }
 protected internal override IList <ContextualSubstRule> GetSetOfRulesForStartGlyph(int startGlyphId)
 {
     if (substMap.ContainsKey(startGlyphId) && !openReader.IsSkip(startGlyphId, lookupFlag))
     {
         return(substMap.Get(startGlyphId));
     }
     return(JavaCollectionsUtil.EmptyList <ContextualSubstRule>());
 }
        /* (non-Javadoc)
         * @see com.itextpdf.styledxmlparser.css.resolve.shorthand.IShorthandResolver#resolveShorthand(java.lang.String)
         */
        public virtual IList <CssDeclaration> ResolveShorthand(String shorthandExpression)
        {
            String[] props = iText.IO.Util.StringUtil.Split(shorthandExpression, "\\s+");
            IList <CssDeclaration> resolvedDecl = new List <CssDeclaration>();
            String topProperty    = MessageFormatUtil.Format(_0_TOP_1, GetPrefix(), GetPostfix());
            String rightProperty  = MessageFormatUtil.Format(_0_RIGHT_1, GetPrefix(), GetPostfix());
            String bottomProperty = MessageFormatUtil.Format(_0_BOTTOM_1, GetPrefix(), GetPostfix());
            String leftProperty   = MessageFormatUtil.Format(_0_LEFT_1, GetPrefix(), GetPostfix());

            if (props.Length == 1)
            {
                resolvedDecl.Add(new CssDeclaration(topProperty, props[0]));
                resolvedDecl.Add(new CssDeclaration(rightProperty, props[0]));
                resolvedDecl.Add(new CssDeclaration(bottomProperty, props[0]));
                resolvedDecl.Add(new CssDeclaration(leftProperty, props[0]));
            }
            else
            {
                foreach (String prop in props)
                {
                    if (CommonCssConstants.INHERIT.Equals(prop) || CommonCssConstants.INITIAL.Equals(prop))
                    {
                        ILog logger = LogManager.GetLogger(typeof(AbstractBoxShorthandResolver));
                        logger.Warn(MessageFormatUtil.Format(iText.StyledXmlParser.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION
                                                             , shorthandExpression));
                        return(JavaCollectionsUtil.EmptyList <CssDeclaration>());
                    }
                }
                if (props.Length == 2)
                {
                    resolvedDecl.Add(new CssDeclaration(topProperty, props[0]));
                    resolvedDecl.Add(new CssDeclaration(rightProperty, props[1]));
                    resolvedDecl.Add(new CssDeclaration(bottomProperty, props[0]));
                    resolvedDecl.Add(new CssDeclaration(leftProperty, props[1]));
                }
                else
                {
                    if (props.Length == 3)
                    {
                        resolvedDecl.Add(new CssDeclaration(topProperty, props[0]));
                        resolvedDecl.Add(new CssDeclaration(rightProperty, props[1]));
                        resolvedDecl.Add(new CssDeclaration(bottomProperty, props[2]));
                        resolvedDecl.Add(new CssDeclaration(leftProperty, props[1]));
                    }
                    else
                    {
                        if (props.Length == 4)
                        {
                            resolvedDecl.Add(new CssDeclaration(topProperty, props[0]));
                            resolvedDecl.Add(new CssDeclaration(rightProperty, props[1]));
                            resolvedDecl.Add(new CssDeclaration(bottomProperty, props[2]));
                            resolvedDecl.Add(new CssDeclaration(leftProperty, props[3]));
                        }
                    }
                }
            }
            return(resolvedDecl);
        }
Пример #4
0
 protected internal override IList <ContextualSubstRule> GetSetOfRulesForStartGlyph(int startId)
 {
     if (substCoverageGlyphIds.Contains(startId) && !openReader.IsSkip(startId, lookupFlag))
     {
         int gClass = classDefinition.GetOtfClass(startId);
         return(subClassSets[gClass]);
     }
     return(JavaCollectionsUtil.EmptyList <ContextualSubstRule>());
 }
Пример #5
0
 protected internal override IList <ContextualSubstRule> GetSetOfRulesForStartGlyph(int startId)
 {
     SubTableLookup6Format3.SubstRuleFormat3 ruleFormat3 = (SubTableLookup6Format3.SubstRuleFormat3) this.substitutionRule;
     if (ruleFormat3.inputCoverages[0].Contains(startId) && !openReader.IsSkip(startId, lookupFlag))
     {
         return(JavaCollectionsUtil.SingletonList <ContextualSubstRule>(this.substitutionRule));
     }
     return(JavaCollectionsUtil.EmptyList <ContextualSubstRule>());
 }
Пример #6
0
        /* (non-Javadoc)
         * @see com.itextpdf.styledxmlparser.css.resolve.shorthand.IShorthandResolver#resolveShorthand(java.lang.String)
         */
        public virtual IList <CssDeclaration> ResolveShorthand(String shorthandExpression)
        {
            String widthPropName = MessageFormatUtil.Format(_0_WIDTH, GetPrefix());
            String stylePropName = MessageFormatUtil.Format(_0_STYLE, GetPrefix());
            String colorPropName = MessageFormatUtil.Format(_0_COLOR, GetPrefix());

            if (CommonCssConstants.INITIAL.Equals(shorthandExpression) || CommonCssConstants.INHERIT.Equals(shorthandExpression
                                                                                                            ))
            {
                return(JavaUtil.ArraysAsList(new CssDeclaration(widthPropName, shorthandExpression), new CssDeclaration(stylePropName
                                                                                                                        , shorthandExpression), new CssDeclaration(colorPropName, shorthandExpression)));
            }
            String[] props            = iText.IO.Util.StringUtil.Split(shorthandExpression, "\\s+");
            String   borderColorValue = null;
            String   borderStyleValue = null;
            String   borderWidthValue = null;

            foreach (String value in props)
            {
                if (CommonCssConstants.INITIAL.Equals(value) || CommonCssConstants.INHERIT.Equals(value))
                {
                    ILog logger = LogManager.GetLogger(typeof(AbstractBorderShorthandResolver));
                    logger.Warn(MessageFormatUtil.Format(iText.StyledXmlParser.LogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION
                                                         , shorthandExpression));
                    return(JavaCollectionsUtil.EmptyList <CssDeclaration>());
                }
                if (CommonCssConstants.BORDER_WIDTH_VALUES.Contains(value) || CssUtils.IsNumericValue(value) || CssUtils.IsMetricValue
                        (value) || CssUtils.IsRelativeValue(value))
                {
                    borderWidthValue = value;
                }
                else
                {
                    if (CommonCssConstants.BORDER_STYLE_VALUES.Contains(value) || value.Equals(CommonCssConstants.AUTO))
                    {
                        // AUTO property value is needed for outline property only
                        borderStyleValue = value;
                    }
                    else
                    {
                        if (CssUtils.IsColorProperty(value))
                        {
                            borderColorValue = value;
                        }
                    }
                }
            }
            IList <CssDeclaration> resolvedDecl = new List <CssDeclaration>();

            resolvedDecl.Add(new CssDeclaration(widthPropName, borderWidthValue == null ? CommonCssConstants.INITIAL :
                                                borderWidthValue));
            resolvedDecl.Add(new CssDeclaration(stylePropName, borderStyleValue == null ? CommonCssConstants.INITIAL :
                                                borderStyleValue));
            resolvedDecl.Add(new CssDeclaration(colorPropName, borderColorValue == null ? CommonCssConstants.INITIAL :
                                                borderColorValue));
            return(resolvedDecl);
        }
Пример #7
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));
        }
Пример #8
0
        public virtual void LayerSetIntentsEmpty()
        {
            PdfName  custom   = new PdfName("Custom");
            PdfLayer pdfLayer = PdfLayerTestUtils.PrepareLayerDesignAndCustomIntent(custom);

            pdfLayer.SetIntents(JavaCollectionsUtil.EmptyList <PdfName>());
            ICollection <PdfName> postNullIntents = pdfLayer.GetIntents();

            NUnit.Framework.Assert.AreEqual(new PdfName[] { PdfName.View }, postNullIntents.ToArray(new PdfName[1]));
        }
        public virtual IList <V> Clear()
        {
            IList <V> all;

            lock (cache) {
                all = cache.Clear();
            }
            lastProcessedTime.Set(0);
            ResetWaitTime();
            return(all != null ? all : JavaCollectionsUtil.EmptyList <V>());
        }
Пример #10
0
 public virtual IList <int> GetAllPagesInRange(int nbPages)
 {
     if (page <= nbPages)
     {
         return(JavaCollectionsUtil.SingletonList(page));
     }
     else
     {
         return(JavaCollectionsUtil.EmptyList <int>());
     }
 }
Пример #11
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]);
        }
Пример #12
0
 /// <summary>Retrieves this node's sibling nodes.</summary>
 /// <remarks>
 /// Retrieves this node's sibling nodes. Similar to
 /// <see cref="ChildNodes()">node.parent.childNodes()</see>
 /// , but does not
 /// include this node (a node is not a sibling of itself).
 /// </remarks>
 /// <returns>node siblings. If the node has no parent, returns an empty list.</returns>
 public virtual IList<iText.StyledXmlParser.Jsoup.Nodes.Node> SiblingNodes() {
     if (parentNode == null) {
         return JavaCollectionsUtil.EmptyList<iText.StyledXmlParser.Jsoup.Nodes.Node>();
     }
     IList<iText.StyledXmlParser.Jsoup.Nodes.Node> nodes = parentNode.childNodes;
     IList<iText.StyledXmlParser.Jsoup.Nodes.Node> siblings = new List<iText.StyledXmlParser.Jsoup.Nodes.Node>(
         nodes.Count - 1);
     foreach (iText.StyledXmlParser.Jsoup.Nodes.Node node in nodes) {
         if (node != this) {
             siblings.Add(node);
         }
     }
     return siblings;
 }
            /* (non-Javadoc)
             * @see com.itextpdf.html2pdf.css.resolve.HtmlStylesToCssConverter.IAttributeConverter#convert(com.itextpdf.styledxmlparser.html.node.IElementNode, java.lang.String)
             */
            public virtual IList <CssDeclaration> Convert(IElementNode element, String value)
            {
                float?cellPadding = CssUtils.ParseFloat(value);

                if (cellPadding != null)
                {
                    if (TagConstants.TABLE.Equals(element.Name()))
                    {
                        IDictionary <String, String> styles = new Dictionary <String, String>();
                        styles.Put(CssConstants.PADDING, value + "px");
                        ApplyPaddingsToTableCells(element, styles);
                    }
                }
                return(JavaCollectionsUtil.EmptyList <CssDeclaration>());
            }
Пример #14
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));
        }
Пример #15
0
        /// <summary>Converts specified degenerate subpaths to squares.</summary>
        /// <remarks>
        /// Converts specified degenerate subpaths to squares.
        /// Note: the list of degenerate subpaths should contain at least 2 elements. Otherwise
        /// we can't determine the direction which the rotation of each square depends on.
        /// </remarks>
        /// <param name="squareWidth">Width of each constructed square.</param>
        /// <param name="sourcePath">The path which dash pattern applied to. Needed to calc rotation angle of each square.
        ///     </param>
        /// <returns>
        ///
        /// <see cref="System.Collections.IList{E}"/>
        /// consisting of squares constructed on given degenerated subpaths.
        /// </returns>
        private static IList <Subpath> ConvertToSquares(IList <Subpath> degenerateSubpaths, double squareWidth, Path
                                                        sourcePath)
        {
            IList <Point> pathApprox = GetPathApproximation(sourcePath);

            if (pathApprox.Count < 2)
            {
                return(JavaCollectionsUtil.EmptyList <Subpath>());
            }
            IEnumerator <Point> approxIter = pathApprox.GetEnumerator();

            approxIter.MoveNext();
            Point approxPt1 = approxIter.Current;

            approxIter.MoveNext();
            Point approxPt2 = approxIter.Current;

            PdfCleanUpFilter.StandardLine line = new PdfCleanUpFilter.StandardLine(approxPt1, approxPt2);
            IList <Subpath> squares            = new List <Subpath>(degenerateSubpaths.Count);
            float           widthHalf          = (float)squareWidth / 2;

            foreach (Subpath subpath in degenerateSubpaths)
            {
                Point point = subpath.GetStartPoint();
                while (!line.Contains(point))
                {
                    approxPt1 = approxPt2;
                    approxIter.MoveNext();
                    approxPt2 = approxIter.Current;
                    line      = new PdfCleanUpFilter.StandardLine(approxPt1, approxPt2);
                }
                double slope = line.GetSlope();
                double angle;
                if (!double.IsPositiveInfinity(slope))
                {
                    angle = Math.Atan(slope);
                }
                else
                {
                    angle = Math.PI / 2;
                }
                squares.Add(ConstructSquare(point, widthHalf, angle));
            }
            return(squares);
        }
Пример #16
0
        /// <summary>
        /// A
        /// <see cref="System.Collections.IList{E}"/>
        /// containing one or more
        /// <see cref="iText.Kernel.Pdf.Filespec.PdfFileSpec"/>
        /// objects, where each specified file
        /// is a pronunciation lexicon, which is an XML file conforming to the Pronunciation Lexicon Specification (PLS) Version 1.0.
        /// These pronunciation lexicons may be used as pronunciation hints when the document’s content is presented via
        /// text-to-speech. Where two or more pronunciation lexicons apply to the same text, the first match – as defined by
        /// the order of entries in the array and the order of entries inside the pronunciation lexicon file – should be used.
        /// <p>
        /// See ISO 32000-2 14.9.6, "Pronunciation hints".
        /// </summary>
        /// <returns>
        /// A
        /// <see cref="System.Collections.IList{E}"/>
        /// containing one or more
        /// <see cref="iText.Kernel.Pdf.Filespec.PdfFileSpec"/>
        /// .
        /// </returns>
        public virtual IList <PdfFileSpec> GetPronunciationLexiconsList()
        {
            PdfArray pronunciationLexicons = GetPdfObject().GetAsArray(PdfName.PronunciationLexicon);

            if (pronunciationLexicons == null)
            {
                return(JavaCollectionsUtil.EmptyList <PdfFileSpec>());
            }
            else
            {
                IList <PdfFileSpec> lexiconsList = new List <PdfFileSpec>(pronunciationLexicons.Size());
                for (int i = 0; i < pronunciationLexicons.Size(); ++i)
                {
                    lexiconsList.Add(PdfFileSpec.WrapFileSpecObject(pronunciationLexicons.Get(i)));
                }
                return(lexiconsList);
            }
        }
Пример #17
0
        /// <summary>Gets namespaces used within the document.</summary>
        /// <remarks>
        /// Gets namespaces used within the document. Essentially this method returns value of
        /// <see cref="GetNamespacesObject()"/>
        /// wrapped in the
        /// <see cref="PdfNamespace"/>
        /// and
        /// <see cref="System.Collections.IList{E}"/>
        /// classes. Therefore limitations of the referred method are
        /// applied to this method too.
        /// </remarks>
        /// <returns>
        /// a
        /// <see cref="System.Collections.IList{E}"/>
        /// of
        /// <see cref="PdfNamespace"/>
        /// s used within the document.
        /// </returns>
        public virtual IList <PdfNamespace> GetNamespaces()
        {
            PdfArray namespacesArray = GetPdfObject().GetAsArray(PdfName.Namespaces);

            if (namespacesArray == null)
            {
                return(JavaCollectionsUtil.EmptyList <PdfNamespace>());
            }
            else
            {
                IList <PdfNamespace> namespacesList = new List <PdfNamespace>(namespacesArray.Size());
                for (int i = 0; i < namespacesArray.Size(); ++i)
                {
                    namespacesList.Add(new PdfNamespace(namespacesArray.GetAsDictionary(i)));
                }
                return(namespacesList);
            }
        }
Пример #18
0
        /// <summary>
        /// Split a document by outline title (bookmark name), find outline by name
        /// and places the entire hierarchy in a separate document ( outlines and pages ) .
        /// </summary>
        /// <param name="outlineTitles">list of outline titles .</param>
        /// <exception cref="iText.Kernel.PdfException"/>
        public virtual IList <PdfDocument> SplitByOutlines(IList <String> outlineTitles)
        {
            if (outlineTitles == null || outlineTitles.Count == 0)
            {
                return(JavaCollectionsUtil.EmptyList <PdfDocument>());
            }
            IList <PdfDocument> documentList = new List <PdfDocument>(outlineTitles.Count);

            foreach (String title in outlineTitles)
            {
                PdfDocument document = SplitByOutline(title);
                if (document != null)
                {
                    documentList.Add(document);
                }
            }
            return(documentList);
        }
Пример #19
0
        /// <summary>Gets all siblings of a child node with the type of a child node.</summary>
        /// <param name="node">the child node</param>
        /// <returns>the sibling nodes with the type of a child node</returns>
        internal virtual IList <INode> GetAllSiblingsOfNodeType(INode node)
        {
            INode parentElement = node.ParentNode();

            if (parentElement != null)
            {
                IList <INode> childrenUnmodifiable = parentElement.ChildNodes();
                IList <INode> children             = new List <INode>(childrenUnmodifiable.Count);
                foreach (INode iNode in childrenUnmodifiable)
                {
                    if (iNode is IElementNode && ((IElementNode)iNode).Name().Equals(((IElementNode)node).Name()))
                    {
                        children.Add(iNode);
                    }
                }
                return(children);
            }
            return(JavaCollectionsUtil.EmptyList <INode>());
        }
Пример #20
0
        /// <summary>
        /// A
        /// <see cref="iText.Kernel.Pdf.PdfName.Ref"/>
        /// identifies the structure element or elements to which the item of content, contained
        /// within this structure element, refers (e.g. footnotes, endnotes, sidebars, etc.).
        /// </summary>
        /// <returns>
        /// a
        /// <see cref="System.Collections.IList{E}"/>
        /// &lt;
        /// <see cref="PdfStructElem"/>
        /// &gt; containing zero, one or more structure elements.
        /// </returns>
        public virtual IList <iText.Kernel.Pdf.Tagging.PdfStructElem> GetRefsList()
        {
            PdfArray refsArray = GetPdfObject().GetAsArray(PdfName.Ref);

            if (refsArray == null)
            {
                return(JavaCollectionsUtil.EmptyList <iText.Kernel.Pdf.Tagging.PdfStructElem>());
            }
            else
            {
                IList <iText.Kernel.Pdf.Tagging.PdfStructElem> refs = new List <iText.Kernel.Pdf.Tagging.PdfStructElem>(refsArray
                                                                                                                        .Size());
                for (int i = 0; i < refsArray.Size(); ++i)
                {
                    refs.Add(new iText.Kernel.Pdf.Tagging.PdfStructElem(refsArray.GetAsDictionary(i)));
                }
                return(refs);
            }
        }
Пример #21
0
        /// <summary>Search in existed fonts for PostScript name or full font name.</summary>
        /// <remarks>
        /// Search in existed fonts for PostScript name or full font name.
        /// <p>
        /// Note, this method has O(n) complexity.
        /// </remarks>
        /// <param name="fontName">PostScript or full name.</param>
        /// <returns>
        /// Collection of
        /// <see cref="FontInfo"/>
        /// from set of fonts with given PostScript or full name.
        /// </returns>
        public ICollection <FontInfo> Get(String fontName)
        {
            if (fontName == null || fontName.Length == 0)
            {
                return(JavaCollectionsUtil.EmptyList <FontInfo>());
            }
            fontName = fontName.ToLowerInvariant();
            IList <FontInfo> list = new List <FontInfo>();

            foreach (FontInfo fi in GetFonts())
            {
                if (fontName.Equals(fi.GetDescriptor().GetFullNameLowerCase()) || fontName.Equals(fi.GetDescriptor().GetFontNameLowerCase
                                                                                                      ()))
                {
                    list.Add(fi);
                }
            }
            return(list);
        }
Пример #22
0
        private IList <char[]> SplitOnNonCharacters(char[] word)
        {
            IList <int> breakPoints = GetNonLetterBreaks(word);

            if (breakPoints.Count == 0)
            {
                return(JavaCollectionsUtil.EmptyList <char[]>());
            }
            IList <char[]> words = new List <char[]>();

            for (int ibreak = 0; ibreak < breakPoints.Count; ibreak++)
            {
                char[] newWord = GetWordFromCharArray(word, ((ibreak == 0) ? 0 : breakPoints[ibreak - 1]), breakPoints[ibreak
                                                      ]);
                words.Add(newWord);
            }
            if (word.Length - breakPoints[breakPoints.Count - 1] - 1 > 1)
            {
                char[] newWord = GetWordFromCharArray(word, breakPoints[breakPoints.Count - 1], word.Length);
                words.Add(newWord);
            }
            return(words);
        }
            /* (non-Javadoc)
             * @see com.itextpdf.html2pdf.css.resolve.HtmlStylesToCssConverter.IAttributeConverter#convert(com.itextpdf.styledxmlparser.html.node.IElementNode, java.lang.String)
             */
            public virtual IList <CssDeclaration> Convert(IElementNode element, String value)
            {
                float?width = CssUtils.ParseFloat(value);

                if (width != null)
                {
                    if (TagConstants.TABLE.Equals(element.Name()) && width != 0)
                    {
                        IList <CssDeclaration>       declarations = new BorderShorthandResolver().ResolveShorthand("1px solid");
                        IDictionary <String, String> styles       = new Dictionary <String, String>(declarations.Count);
                        foreach (CssDeclaration declaration in declarations)
                        {
                            styles.Put(declaration.GetProperty(), declaration.GetExpression());
                        }
                        ApplyBordersToTableCells(element, styles);
                    }
                    if (width >= 0)
                    {
                        return(JavaUtil.ArraysAsList(new CssDeclaration(CssConstants.BORDER, value + "px solid")));
                    }
                }
                return(JavaCollectionsUtil.EmptyList <CssDeclaration>());
            }
Пример #24
0
        public virtual IList <TaggingHintKey> GetAccessibleKidsHint(TaggingHintKey parent)
        {
            IList <TaggingHintKey> kidsHint = kidsHints.Get(parent);

            if (kidsHint == null)
            {
                return(JavaCollectionsUtil.EmptyList <TaggingHintKey>());
            }
            IList <TaggingHintKey> accessibleKids = new List <TaggingHintKey>();

            foreach (TaggingHintKey kid in kidsHint)
            {
                if (IsNonAccessibleHint(kid))
                {
                    accessibleKids.AddAll(GetAccessibleKidsHint(kid));
                }
                else
                {
                    accessibleKids.Add(kid);
                }
            }
            return(accessibleKids);
        }
Пример #25
0
 /// <summary>
 /// Creates a new
 /// <see cref="TextInfo"/>
 /// instance.
 /// </summary>
 public TextInfo()
 {
     text = null;
     bbox = JavaCollectionsUtil.EmptyList <float>();
 }
 /* (non-Javadoc)
  * @see com.itextpdf.html2pdf.html.node.INode#childNodes()
  */
 public override IList <INode> ChildNodes()
 {
     return(JavaCollectionsUtil.EmptyList <INode>());
 }
Пример #27
0
 /* (non-Javadoc)
  * @see com.itextpdf.html2pdf.html.node.INode#childNodes()
  */
 public virtual IList <INode> ChildNodes()
 {
     return(JavaCollectionsUtil.EmptyList <INode>());
 }
Пример #28
0
 public virtual IList <TagTreePointer> GetRefsList()
 {
     return(JavaCollectionsUtil.EmptyList <TagTreePointer>());
 }
Пример #29
0
 /// <summary>
 /// Gets a list of
 /// <see cref="CssRuleSet"/>
 /// objects.
 /// </summary>
 /// <param name="node">a node</param>
 /// <param name="deviceDescription">a media device description</param>
 /// <returns>the css rule sets</returns>
 public virtual IList <CssRuleSet> GetCssRuleSets(INode node, MediaDeviceDescription deviceDescription)
 {
     return(JavaCollectionsUtil.EmptyList <CssRuleSet>());
 }
Пример #30
0
 public virtual IList <PdfStructureAttributes> GetAttributesList()
 {
     return(JavaCollectionsUtil.EmptyList <PdfStructureAttributes>());
 }