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


C# PdfDictionary.Resolve方法代码示例

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


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

示例1: LoadEncodingDifferences

        /**
          <summary>Loads the encoding differences into the given collection.</summary>
          <param name="encodingDictionary">Encoding dictionary.</param>
          <param name="codes">Encoding to alter applying differences.</param>
        */
        protected void LoadEncodingDifferences(
      PdfDictionary encodingDictionary,
      IDictionary<ByteArray,int> codes
      )
        {
            PdfArray differenceObjects = (PdfArray)encodingDictionary.Resolve(PdfName.Differences);
              if(differenceObjects == null)
            return;

              /*
            NOTE: Each code is the first index in a sequence of character codes to be changed.
            The first character name after the code becomes the name corresponding to that code.
            Subsequent names replace consecutive code indices until the next code appears
            in the array or the array ends.
              */
              byte[] charCodeData = new byte[1];
              foreach(PdfDirectObject differenceObject in differenceObjects)
              {
            if(differenceObject is PdfInteger)
            {charCodeData[0] = (byte)(((int)((PdfInteger)differenceObject).Value) & 0xFF);}
            else // NOTE: MUST be PdfName.
            {
              ByteArray charCode = new ByteArray(charCodeData);
              string charName = (string)((PdfName)differenceObject).Value;
              if(charName.Equals(".notdef"))
              {codes.Remove(charCode);}
              else
              {
            int? code = GlyphMapping.NameToCode(charName);
            codes[charCode] = (code ?? charCodeData[0]);
              }
              charCodeData[0]++;
            }
              }
        }
开发者ID:josuecorrea,项目名称:DanfeSharp,代码行数:40,代码来源:SimpleFont.cs

示例2: SetScript

 /**
   <summary>Sets the Javascript script into the specified base data object.</summary>
 */
 internal static void SetScript(
     PdfDictionary baseDataObject,
     PdfName key,
     string value
     )
 {
     PdfDataObject scriptObject = baseDataObject.Resolve(key);
       if(!(scriptObject is PdfStream) && value.Length > 256)
       {baseDataObject[key] = baseDataObject.File.Register(scriptObject = new PdfStream());}
       // Insert the script!
       if(scriptObject is PdfStream)
       {
     bytes::IBuffer scriptBuffer = ((PdfStream)scriptObject).Body;
     scriptBuffer.SetLength(0);
     scriptBuffer.Append(value);
       }
       else
       {baseDataObject[key] = new PdfTextString(value);}
 }
开发者ID:n9,项目名称:pdfclown,代码行数:22,代码来源:JavaScript.cs

示例3: GetScript

 /**
   <summary>Gets the Javascript script from the specified base data object.</summary>
 */
 internal static string GetScript(
     PdfDictionary baseDataObject,
     PdfName key
     )
 {
     PdfDataObject scriptObject = baseDataObject.Resolve(key);
       if(scriptObject == null)
     return null;
       else if(scriptObject is PdfTextString)
     return ((PdfTextString)scriptObject).StringValue;
       else
       {
     bytes::IBuffer scriptBuffer = ((PdfStream)scriptObject).Body;
     return scriptBuffer.GetString(0,(int)scriptBuffer.Length);
       }
 }
开发者ID:n9,项目名称:pdfclown,代码行数:19,代码来源:JavaScript.cs


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