当前位置: 首页>>代码示例>>C#>>正文


C# PdfDictionary.GetAsName方法代码示例

本文整理汇总了C#中PdfDictionary.GetAsName方法的典型用法代码示例。如果您正苦于以下问题:C# PdfDictionary.GetAsName方法的具体用法?C# PdfDictionary.GetAsName怎么用?C# PdfDictionary.GetAsName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PdfDictionary的用法示例。


在下文中一共展示了PdfDictionary.GetAsName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InspectChildDictionary

        /**
         * If the child of a structured element is a dictionary, we inspect the
         * child; we may also draw a tag.
         * 
         * @param k
         *            the child dictionary to inspect
         */
        virtual public void InspectChildDictionary(PdfDictionary k, bool inspectAttributes) {
            if (k == null)
                return;
            PdfName s = k.GetAsName(PdfName.S);
            if (s != null) {
                String tagN = PdfName.DecodeName(s.ToString());
			    String tag = FixTagName(tagN);
                outp.Write("<");
                outp.Write(tag);
                if (inspectAttributes) {
                    PdfDictionary a = k.GetAsDict(PdfName.A);
                    if (a != null) {
                        Dictionary<PdfName, PdfObject>.KeyCollection keys = a.Keys;
                        foreach (PdfName key in keys) {
                            outp.Write(' ');
                            PdfObject value = a.Get(key);
                            value = PdfReader.GetPdfObject(value);
                            outp.Write(XmlName(key));
                            outp.Write("=\"");
                            outp.Write(value.ToString());
                            outp.Write("\"");
                        }
                    }
                }
                outp.Write(">");
                PdfDictionary dict = k.GetAsDict(PdfName.PG);
                if (dict != null)
                    ParseTag(tagN, k.GetDirectObject(PdfName.K), dict);
                InspectChild(k.GetDirectObject(PdfName.K));
                outp.Write("</");
                outp.Write(tag);
                outp.WriteLine(">");
            } else
                InspectChild(k.GetDirectObject(PdfName.K));
        }
开发者ID:,项目名称:,代码行数:42,代码来源:

示例2: ComputeBytesPerRow

 /**
  * Computes the number of unfiltered bytes that each row of the image will contain.
  * If the number of bytes results in a partial terminating byte, this number is rounded up
  * per the PDF specification
  * @param imageDictionary the dictionary of the inline image
  * @return the number of bytes per row of the image
  */
 private static int ComputeBytesPerRow(PdfDictionary imageDictionary, PdfDictionary colorSpaceDic){
     PdfNumber wObj = imageDictionary.GetAsNumber(PdfName.WIDTH);
     PdfNumber bpcObj = imageDictionary.GetAsNumber(PdfName.BITSPERCOMPONENT);
     int cpp = GetComponentsPerPixel(imageDictionary.GetAsName(PdfName.COLORSPACE), colorSpaceDic);
     
     int w = wObj.IntValue;
     int bpc = bpcObj != null ? bpcObj.IntValue : 1;
     
     
     int bytesPerRow = (w * bpc * cpp + 7) / 8;
     
     return bytesPerRow;
 }
开发者ID:,项目名称:,代码行数:20,代码来源:

示例3: CheckEmbeddedFile

 protected virtual void CheckEmbeddedFile(PdfDictionary embeddedFile) {
     PdfName subtype = embeddedFile.GetAsName(PdfName.SUBTYPE);
     if (subtype == null || !MimeTypePdf.Equals(subtype)) {
         throw new PdfAConformanceException(embeddedFile, MessageLocalization.GetComposedMessage("embedded.file.shall.contain.pdf.mime.type"));
     }
 }
开发者ID:smartleos,项目名称:itextsharp,代码行数:6,代码来源:PdfA2Checker.cs

示例4: GetComponentsPerPixel

        /**
         * @param colorSpaceName the name of the color space. If null, a bi-tonal (black and white) color space is assumed.
         * @return the components per pixel for the specified color space
         */
        private static int GetComponentsPerPixel(PdfName colorSpaceName, PdfDictionary colorSpaceDic){
            if (colorSpaceName == null)
                return 1;
            if (colorSpaceName.Equals(PdfName.DEVICEGRAY))
                return 1;
            if (colorSpaceName.Equals(PdfName.DEVICERGB))
                return 3;
            if (colorSpaceName.Equals(PdfName.DEVICECMYK))
                return 4;
            
            if (colorSpaceDic != null){
                PdfArray colorSpace = colorSpaceDic.GetAsArray(colorSpaceName);
                if (colorSpace != null){
                    if (PdfName.INDEXED.Equals(colorSpace.GetAsName(0))){
                        return 1;
                    }
                }
                else {
                    PdfName tempName = colorSpaceDic.GetAsName(colorSpaceName);
                    if(tempName != null) {
                        return GetComponentsPerPixel(tempName, colorSpaceDic);
                    }
                }
            }

            throw new ArgumentException("Unexpected color space " + colorSpaceName);
        }
开发者ID:,项目名称:,代码行数:31,代码来源:


注:本文中的PdfDictionary.GetAsName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。