當前位置: 首頁>>代碼示例>>C#>>正文


C# PdfChunk.ToString方法代碼示例

本文整理匯總了C#中iTextSharp.text.pdf.PdfChunk.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfChunk.ToString方法的具體用法?C# PdfChunk.ToString怎麽用?C# PdfChunk.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.pdf.PdfChunk的用法示例。


在下文中一共展示了PdfChunk.ToString方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Add

        // methods
        /**
         * Adds a <CODE>PdfChunk</CODE> to the <CODE>PdfLine</CODE>.
         *
         * @param        chunk        the <CODE>PdfChunk</CODE> to add
         * @return        <CODE>null</CODE> if the chunk could be added completely; if not
         *                a <CODE>PdfChunk</CODE> containing the part of the chunk that could
         *                not be added is returned
         */
        internal PdfChunk Add(PdfChunk chunk)
        {
            // nothing happens if the chunk is null.
            if (chunk == null || chunk.ToString().Equals("")) {
                return null;
            }

            // we split the chunk to be added
            PdfChunk overflow = chunk.Split(width);
            newlineSplit = (chunk.IsNewlineSplit() || overflow == null);
            //        if (chunk.IsNewlineSplit() && alignment == Element.ALIGN_JUSTIFIED)
            //            alignment = Element.ALIGN_LEFT;
            if (chunk.IsTab()) {
                Object[] tab = (Object[])chunk.GetAttribute(Chunk.TAB);
                float tabPosition = (float)tab[1];
                bool newline = (bool)tab[2];
                if (newline && tabPosition < originalWidth - width) {
                    return chunk;
                }
                width = originalWidth - tabPosition;
                chunk.AdjustLeft(left);
                AddToLine(chunk);
            }
            // if the length of the chunk > 0 we add it to the line
            else if (chunk.Length > 0 || chunk.IsImage()) {
                if (overflow != null)
                    chunk.TrimLastSpace();
                width -= chunk.Width;
                AddToLine(chunk);
            }

                // if the length == 0 and there were no other chunks added to the line yet,
                // we risk to end up in an endless loop trying endlessly to add the same chunk
            else if (line.Count < 1) {
                chunk = overflow;
                overflow = chunk.Truncate(width);
                width -= chunk.Width;
                if (chunk.Length > 0) {
                    AddToLine(chunk);
                    return overflow;
                }
                    // if the chunck couldn't even be truncated, we add everything, so be it
                else {
                    if (overflow != null)
                        AddToLine(chunk);
                    return null;
                }
            }
            else {
                width += ((PdfChunk)(line[line.Count - 1])).TrimLastSpace();
            }
            return overflow;
        }
開發者ID:karino2,項目名稱:wikipediaconv,代碼行數:62,代碼來源:PdfLine.cs

示例2: AddToLine

 private void AddToLine(PdfChunk chunk) {
     if (chunk.ChangeLeading) {
         float f;
         if (chunk.IsImage()) {
             Image img = chunk.Image;
             f = chunk.ImageHeight + chunk.ImageOffsetY
                     + img.BorderWidthTop + img.SpacingBefore;
         } else {
             f = chunk.Leading;
         }
         if (f > height) height = f;
     }
     if (tabStop != null && tabStop.Align == TabStop.Alignment.ANCHOR && float.IsNaN(tabStopAnchorPosition))
     {
         String value = chunk.ToString();
         int anchorIndex = value.IndexOf(tabStop.AnchorChar);
         if (anchorIndex != -1)
         {
             float subWidth = chunk.Width(value.Substring(anchorIndex));
             tabStopAnchorPosition = originalWidth - width - subWidth;
         }
     }
     line.Add(chunk);
 }
開發者ID:joshaxey,項目名稱:Simple-PDFMerge,代碼行數:24,代碼來源:PdfLine.cs

示例3: Add

        // methods
    
        /**
         * Adds a <CODE>PdfChunk</CODE> to the <CODE>PdfLine</CODE>.
         *
         * @param		chunk		        the <CODE>PdfChunk</CODE> to add
         * @param		currentLeading		new value for the height of the line
         * @return		<CODE>null</CODE> if the chunk could be added completely; if not
         *				a <CODE>PdfChunk</CODE> containing the part of the chunk that could
         *				not be added is returned
         */

        internal PdfChunk Add(PdfChunk chunk, float currentLeading) {
            //we set line height to correspond to the current leading
            if (chunk != null && !chunk.ToString().Equals("")) {
                //whitespace shouldn't change leading
                if (!chunk.ToString().Equals(" ")) {
                    if (this.height < currentLeading || this.line.Count == 0)
                        this.height = currentLeading;
                }
            }
            return Add(chunk);
        }
開發者ID:joshaxey,項目名稱:Simple-PDFMerge,代碼行數:23,代碼來源:PdfLine.cs

示例4: Add

        // methods
        /**
         * Adds a <CODE>PdfChunk</CODE> to the <CODE>PdfLine</CODE>.
         *
         * @param        chunk        the <CODE>PdfChunk</CODE> to add
         * @return        <CODE>null</CODE> if the chunk could be added completely; if not
         *                a <CODE>PdfChunk</CODE> containing the part of the chunk that could
         *                not be added is returned
         */
        internal PdfChunk Add(PdfChunk chunk)
        {
            // nothing happens if the chunk is null.
            if (chunk == null || chunk.ToString().Equals("")) {
                return null;
            }

            // we split the chunk to be added
            PdfChunk overflow = chunk.Split(width);
            newlineSplit = (chunk.IsNewlineSplit() || overflow == null);
            //        if (chunk.IsNewlineSplit() && alignment == Element.ALIGN_JUSTIFIED)
            //            alignment = Element.ALIGN_LEFT;

            // if the length of the chunk > 0 we add it to the line
            if (chunk.Length > 0) {
                if (overflow != null)
                    chunk.TrimLastSpace();
                width -= chunk.Width;
                AddToLine(chunk);
            }

                // if the length == 0 and there were no other chunks added to the line yet,
                // we risk to end up in an endless loop trying endlessly to add the same chunk
            else if (line.Count < 1) {
                chunk = overflow;
                overflow = chunk.Truncate(width);
                width -= chunk.Width;
                if (chunk.Length > 0) {
                    AddToLine(chunk);
                    return overflow;
                }
                    // if the chunck couldn't even be truncated, we add everything, so be it
                else {
                    if (overflow != null)
                        AddToLine(chunk);
                    return null;
                }
            }
            else {
                width += ((PdfChunk)(line[line.Count - 1])).TrimLastSpace();
            }
            return overflow;
        }
開發者ID:hjgode,項目名稱:iTextSharpCF,代碼行數:52,代碼來源:PdfLine.cs


注:本文中的iTextSharp.text.pdf.PdfChunk.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。