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


C# PdfDictionary.GetAsArray方法代码示例

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


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

示例1: SignaturePermissions

        /**
         * Creates an object that can inform you about the type of signature
         * in a signature dictionary as well as some of the permissions
         * defined by the signature.
         */
        public SignaturePermissions(PdfDictionary sigDict, SignaturePermissions previous) {
	        if (previous != null) {
		        annotationsAllowed &= previous.AnnotationsAllowed;
		        fillInAllowed &= previous.FillInAllowed;
		        fieldLocks.AddRange(previous.FieldLocks);
	        }
	        PdfArray reference = sigDict.GetAsArray(PdfName.REFERENCE);
	        if (reference != null) {
		        for (int i = 0; i < reference.Size; i++) {
			        PdfDictionary dict = reference.GetAsDict(i);
			        PdfDictionary parameters = dict.GetAsDict(PdfName.TRANSFORMPARAMS);
			        if (PdfName.DOCMDP.Equals(dict.GetAsName(PdfName.TRANSFORMMETHOD)))
				        certification = true;
    			    
			        PdfName action = parameters.GetAsName(PdfName.ACTION);
			        if (action != null)
                        fieldLocks.Add(new FieldLock(action, parameters.GetAsArray(PdfName.FIELDS)));
    			    
			        PdfNumber p = parameters.GetAsNumber(PdfName.P);
			        if (p == null)
				        continue;
			        switch (p.IntValue) {
			        case 1:
				        fillInAllowed = false;
                        break;
			        case 2:
				        annotationsAllowed = false;
                        break;
			        }
		        }
	        }
        }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:37,代码来源:SignaturePermissions.cs

示例2: RemoveAnnots

 /// <summary>
 /// Removes annotations from a page dictionary </summary>
 /// <param name="page">	a page dictionary </param>
 /// <param name="ocgs">	a set of names of OCG layers </param>
 private void RemoveAnnots(PdfDictionary page, ICollection<string> ocgs)
 {
     PdfArray annots = page.GetAsArray(PdfName.ANNOTS);
     if (annots == null)
     {
         return;
     }
     IList<int?> remove = new List<int?>();
     for (int i = annots.Size; i > 0; )
     {
         PdfDictionary annot = annots.GetAsDict(--i);
         if (IsToBeRemoved(annot.GetAsDict(PdfName.OC), ocgs))
         {
             remove.Add(i);
         }
         else
         {
             RemoveOCGsFromArray(annot.GetAsDict(PdfName.A), PdfName.STATE, ocgs);
         }
     }
     foreach (int i in remove)
     {
         annots.Remove(i);
     }
 }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:29,代码来源:OCGRemover.cs

示例3: 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;
                    }
                }
            }

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

示例4: RemoveOCGsFromArray

 /// <summary>
 /// Gets an array from a dictionary and checks if it contains references to OCGs that need to be removed </summary>
 /// <param name="dict">	the dictionary </param>
 /// <param name="name">	the name of an array entry </param>
 /// <param name="ocgs">	the removal list </param>
 private void RemoveOCGsFromArray(PdfDictionary dict, PdfName name, ICollection<string> ocgs) {
     if (dict == null) {
         return;
     }
     PdfArray array = dict.GetAsArray(name);
     if (array == null) {
         return;
     }
     RemoveOCGsFromArray(array, ocgs);
 }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:15,代码来源:OCGRemover.cs

示例5: Parse

 /**
  * Parses the content of a page, replacing appearances of annotations
  * with Form XObjects.
  * @param page a page dictionary
  * @throws IOException
  */
 virtual public void Parse(PdfDictionary page, PdfIndirectReference pageref) {
     LOGGER.Info("Parsing page with reference " + pageref);
     // initializing member variables
     baos = new MemoryStream();
     this.page = page;
     this.pageref = pageref;
     
     structParents = page.GetAsNumber(PdfName.STRUCTPARENTS);
     if(structParents == null)
         throw new DocumentException(MessageLocalization.GetComposedMessage("can.t.read.document.structure"));
     annots = page.GetAsArray(PdfName.ANNOTS);
     if(annots == null)
         annots = new PdfArray();
     PdfDictionary resources = page.GetAsDict(PdfName.RESOURCES);
     xobjects = resources.GetAsDict(PdfName.XOBJECT);
     if (xobjects == null) {
         xobjects = new PdfDictionary();
         resources.Put(PdfName.XOBJECT, xobjects);
     }
     // parsing the content stream of the page
     PRStream stream = (PRStream) page.GetAsStream(PdfName.CONTENTS);
     byte[] contentBytes = PdfReader.GetStreamBytes(stream);
     PRTokeniser tokeniser = new PRTokeniser(new RandomAccessFileOrArray(RASFACTORY.CreateSource(contentBytes)));
     PdfContentParser ps = new PdfContentParser(tokeniser);
     List<PdfObject> operands = new List<PdfObject>();
     while (ps.Parse(operands).Count > 0) {
         PdfLiteral opr = (PdfLiteral) operands[operands.Count - 1];
         ProcessOperator(opr, operands);
     }
     // dealing with orphans
     while (items.Count > 0 && items[0].GetPageref() == pageref.Number) {
         StructureItem item = items[0];
         if (item is StructureObject) {
             ConvertToXObject((StructureObject) item);
             items.RemoveAt(0);
         }
     }
     if(annots.Length == 0) {
         page.Remove(PdfName.ANNOTS);
     }
     else {
         PdfDictionary annot;
         for(int i = 0; i < annots.Size; i++) {
             annot = annots.GetAsDict(i);
             if(annot.GetAsNumber(PdfName.STRUCTPARENT) == null)
                 throw new DocumentException(MessageLocalization.GetComposedMessage("could.not.flatten.file.untagged.annotations.found"));
         }
     }
     // replacing the content stream
     baos.Flush();
     baos.Close();
     stream.SetData(baos.ToArray());
     // showing how many items are left
     LOGGER.Info(String.Format("There are {0} items left for processing", items.Count));
 }
开发者ID:newlysoft,项目名称:itextsharp,代码行数:61,代码来源:MCParser.cs


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