• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# pdf.PdfDictionary类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



PdfDictionary类属于iTextSharp.text.pdf命名空间,在下文中一共展示了PdfDictionary类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ReadTree

 public static Hashtable ReadTree(PdfDictionary dic)
 {
     Hashtable items = new Hashtable();
     if (dic != null)
         IterateItems(dic, items);
     return items;
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:7,代码来源:PdfNameTree.cs


示例2: ImageRenderInfo

 private ImageRenderInfo(Matrix ctm, PdfIndirectReference refi, PdfDictionary colorSpaceDictionary)
 {
     this.ctm = ctm;
     this.refi = refi;
     this.inlineImageInfo = null;
     this.colorSpaceDictionary = colorSpaceDictionary;
 }
开发者ID:mapo80,项目名称:iTextSharp-Monotouch,代码行数:7,代码来源:ImageRenderInfo.cs


示例3: UnembedTTF

 /**
 * Processes a dictionary.
 * In case of font dictionaries, the dictionary is processed.
 */
 public void UnembedTTF(PdfDictionary dict)
 {
     // we ignore all dictionaries that aren't font dictionaries
     if (!dict.IsFont())
         return;
     // we only remove TTF fonts
     if (dict.GetAsDict(PdfName.FONTFILE2) != null)
     {
         return;
     }
     // check if a subset was used (in which case we remove the prefix)
     PdfName baseFont = dict.GetAsName(PdfName.BASEFONT);
     if (baseFont.GetBytes()[7] == '+')
     {
         baseFont = new PdfName(baseFont.ToString().Substring(8));
         dict.Put(PdfName.BASEFONT, baseFont);
     }
     // we check if there's a font descriptor
     PdfDictionary fontDescriptor = dict.GetAsDict(PdfName.FONTDESCRIPTOR);
     if (fontDescriptor == null)
         return;
     // is there is, we replace the fontname and remove the font file
     fontDescriptor.Put(PdfName.FONTNAME, baseFont);
     fontDescriptor.Remove(PdfName.FONTFILE2);
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:29,代码来源:UnembedFont.cs


示例4: GetDictionaryDetail

 /**
  * Shows the detail of a dictionary.
  * @param dic   the dictionary of which you want the detail
  * @param depth the depth of the current dictionary (for nested dictionaries)
  * @return  a String representation of the dictionary
  */
 public static  String GetDictionaryDetail(PdfDictionary dic, int depth){
     StringBuilder builder = new StringBuilder();
     builder.Append('(');
     IList<PdfName> subDictionaries = new List<PdfName>();
     foreach (PdfName key in dic.Keys) {
         PdfObject val = dic.GetDirectObject(key);
         if (val.IsDictionary())
             subDictionaries.Add(key);
         builder.Append(key);
         builder.Append('=');
         builder.Append(val);
         builder.Append(", ");
     }
     builder.Length = builder.Length-2;
     builder.Append(')');
     foreach (PdfName pdfSubDictionaryName in subDictionaries) {
         builder.Append('\n');
         for (int i = 0; i < depth+1; i++){
             builder.Append('\t');
         }
         builder.Append("Subdictionary ");
         builder.Append(pdfSubDictionaryName);
         builder.Append(" = ");
         builder.Append(GetDictionaryDetail(dic.GetAsDict(pdfSubDictionaryName), depth+1));
     }
     return builder.ToString();
 }
开发者ID:,项目名称:,代码行数:33,代码来源:


示例5: CreatePdf

// ---------------------------------------------------------------------------
    public byte[] CreatePdf() {
      using (MemoryStream ms = new MemoryStream()) {    
        // step 1
        using (Document document = new Document(new Rectangle(850, 600))) {
          // step 2
          PdfWriter writer = PdfWriter.GetInstance(document, ms);
          // step 3
          document.Open();
          // step 4
          PdfContentByte canvas = writer.DirectContent;
          // add the clipped image
          Image img = Image.GetInstance(
            Path.Combine(Utility.ResourceImage, RESOURCE)
          );
          float w = img.ScaledWidth;
          float h = img.ScaledHeight;
          canvas.Ellipse(1, 1, 848, 598);
          canvas.Clip();
          canvas.NewPath();
          canvas.AddImage(img, w, 0, 0, h, 0, -600);

          // Create a transparent PdfTemplate
          PdfTemplate t2 = writer.DirectContent.CreateTemplate(850, 600);
          PdfTransparencyGroup transGroup = new PdfTransparencyGroup();
          transGroup.Put( PdfName.CS, PdfName.DEVICEGRAY);
          transGroup.Isolated = true;
          transGroup.Knockout = false;
          t2.Group = transGroup;

          // Add transparent ellipses to the template
          int gradationStep = 30;
          float[] gradationRatioList = new float[gradationStep];
          for(int i = 0; i < gradationStep; i++) {
/*
* gotta love .NET, guess they forgot to copy java.lang.Math.toRadians
*/
            double radians = (Math.PI / 180) * 90.0f / gradationStep * (i + 1);
            gradationRatioList[i] = 1 - (float) Math.Sin(radians);
          }
          for(int i = 1; i < gradationStep + 1; i++) {
              t2.SetLineWidth(5 * (gradationStep + 1 - i));
              t2.SetGrayStroke(gradationRatioList[gradationStep - i]);
              t2.Ellipse(0, 0, 850, 600);
              t2.Stroke();
          }
          
          // Create an image mask for the direct content
          PdfDictionary maskDict = new PdfDictionary();
          maskDict.Put(PdfName.TYPE, PdfName.MASK);
          maskDict.Put(PdfName.S, new PdfName("Luminosity"));
          maskDict.Put(new PdfName("G"), t2.IndirectReference);
          PdfGState gState = new PdfGState();
          gState.Put(PdfName.SMASK, maskDict );
          canvas.SetGState(gState);
          
          canvas.AddTemplate(t2, 0, 0);        
        }
        return ms.ToArray();
      }
    }
开发者ID:,项目名称:,代码行数:61,代码来源:


示例6: MapRole

 /**
 * Maps the user tags to the standard tags. The mapping will allow a standard application to make some sense of the tagged
 * document whatever the user tags may be.
 * @param used the user tag
 * @param standard the standard tag
 */    
 public void MapRole(PdfName used, PdfName standard) {
     PdfDictionary rm = (PdfDictionary)Get(PdfName.ROLEMAP);
     if (rm == null) {
         rm = new PdfDictionary();
         Put(PdfName.ROLEMAP, rm);
     }
     rm.Put(used, standard);
 }
开发者ID:,项目名称:,代码行数:14,代码来源:


示例7: Write

        // ---------------------------------------------------------------------------
        public void Write(Stream stream)
        {
            // step 1
              using (Document document = new Document()) {
            // step 2
            PdfWriter writer = PdfWriter.GetInstance(document, stream);
            // step 3
            document.Open();
            // step 4
            Rectangle rect = new Rectangle(100, 400, 500, 800);
            rect.Border = Rectangle.BOX;
            rect.BorderWidth = 0.5f;
            rect.BorderColor = new BaseColor(0xFF, 0x00, 0x00);
            document.Add(rect);

            PdfIndirectObject streamObject = null;
            using (FileStream fs =
              new FileStream(RESOURCE, FileMode.Open, FileAccess.Read))
            {
              PdfStream stream3D = new PdfStream(fs, writer);

              stream3D.Put(PdfName.TYPE, new PdfName("3D"));
              stream3D.Put(PdfName.SUBTYPE, new PdfName("U3D"));
              stream3D.FlateCompress();
              streamObject = writer.AddToBody(stream3D);
              stream3D.WriteLength();
            }

            PdfDictionary dict3D = new PdfDictionary();
            dict3D.Put(PdfName.TYPE, new PdfName("3DView"));
            dict3D.Put(new PdfName("XN"), new PdfString("Default"));
            dict3D.Put(new PdfName("IN"), new PdfString("Unnamed"));
            dict3D.Put(new PdfName("MS"), PdfName.M);
            dict3D.Put(
              new PdfName("C2W"),
              new PdfArray(
            new float[] { 1, 0, 0, 0, 0, -1, 0, 1, 0, 3, -235, 28 }
              )
            );
            dict3D.Put(PdfName.CO, new PdfNumber(235));

            PdfIndirectObject dictObject = writer.AddToBody(dict3D);

            PdfAnnotation annot = new PdfAnnotation(writer, rect);
            annot.Put(PdfName.CONTENTS, new PdfString("3D Model"));
            annot.Put(PdfName.SUBTYPE, new PdfName("3D"));
            annot.Put(PdfName.TYPE, PdfName.ANNOT);
            annot.Put(new PdfName("3DD"), streamObject.IndirectReference);
            annot.Put(new PdfName("3DV"), dictObject.IndirectReference);
            PdfAppearance ap = writer.DirectContent.CreateAppearance(
              rect.Width, rect.Height
            );
            annot.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, ap);
            annot.SetPage();

            writer.AddAnnotation(annot);
              }
        }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:59,代码来源:Pdf3D.cs


示例8: Add

     // methods
 
     internal void Add(PdfName key, PdfDictionary resource) {
         if (resource.Size == 0)
             return;
         PdfDictionary dic = GetAsDict(key);
         if (dic == null)
             Put(key, resource);
         else
             dic.Merge(resource);
     }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:11,代码来源:PdfResources.cs


示例9: AddPage

 internal void AddPage(PdfDictionary page) {
     if ((pages.Count % leafSize) == 0)
         parents.Add(writer.PdfIndirectReference);
     PdfIndirectReference parent = parents[parents.Count - 1];
     page.Put(PdfName.PARENT, parent);
     PdfIndirectReference current = writer.CurrentPage;
     writer.AddToBody(page, current);
     pages.Add(current);
 }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:9,代码来源:PdfPages.cs


示例10: PdfAXmpWriter

        /**
         * Creates and XMP writer that adds info about the PDF/A conformance level.
         * @param os
         * @param info
         * @param conformanceLevel
         * @throws IOException
         */

        public PdfAXmpWriter(Stream os, PdfDictionary info, PdfAConformanceLevel conformanceLevel)
            : base(os, info) {
            try {
                AddRdfDescription(conformanceLevel);
            }
            catch (XmpException xmpExc) {
                throw new IOException(xmpExc.Message);
            }
        }
开发者ID:,项目名称:,代码行数:17,代码来源:


示例11: Add

 // methods
 internal void Add(PdfName key, PdfDictionary resource)
 {
     if (resource.Size == 0)
         return;
     PdfDictionary dic = (PdfDictionary)PdfReader.GetPdfObject(Get(key));
     if (dic == null)
         Put(key, resource);
     else
         dic.Merge(resource);
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:11,代码来源:PdfResources.cs


示例12: PdfMediaClipData

 internal PdfMediaClipData(String file, PdfFileSpecification fs, String mimeType) {
     Put(PdfName.TYPE,new PdfName("MediaClip"));
     Put(PdfName.S, new PdfName("MCD"));
     Put(PdfName.N, new PdfString("Media clip for "+file));
     Put(new PdfName("CT"), new PdfString(mimeType));
     PdfDictionary dic = new PdfDictionary();
     dic.Put(new PdfName("TF"), new PdfString("TEMPACCESS"));
     Put(new PdfName("P"), dic);
     Put(PdfName.D, fs.Reference);
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:10,代码来源:PdfMediaClipData.cs


示例13: addAsAttachment

        private void addAsAttachment(IDataExporter exporter, byte[] data)
        {
            if (string.IsNullOrEmpty(exporter.FileName))
                throw new InvalidOperationException("Please fill the exporter.FileName.");

            if (string.IsNullOrEmpty(exporter.Description))
                exporter.Description = "Exported data";

            var pdfDictionary = new PdfDictionary();
            pdfDictionary.Put(PdfName.MODDATE, new PdfDate(DateTime.Now));
            var fs = PdfFileSpecification.FileEmbedded(_sharedData.PdfWriter, null, exporter.FileName, data, true, null, pdfDictionary);
            _sharedData.PdfWriter.AddFileAttachment(exporter.Description, fs);
        }
开发者ID:VahidN,项目名称:PdfReport,代码行数:13,代码来源:ExporterManager.cs


示例14: CMapAwareDocumentFont

        /**
         * Creates an instance of a CMapAwareFont based on an indirect reference to a font.
         * @param refFont   the indirect reference to a font
         */
        public CMapAwareDocumentFont(PRIndirectReference refFont) : base(refFont){
            fontDic = (PdfDictionary)PdfReader.GetPdfObjectRelease(refFont);

            ProcessToUnicode();
            //if (toUnicodeCmap == null)
                ProcessUni2Byte();
            
            spaceWidth = base.GetWidth(' ');
            if (spaceWidth == 0){
                spaceWidth = ComputeAverageWidth();
            }
            
        }
开发者ID:,项目名称:,代码行数:17,代码来源:


示例15: PdfStructureElement

 internal PdfStructureElement(PdfDictionary parent, PdfName structureType) {
     if (parent is PdfStructureElement) {
         top = ((PdfStructureElement) parent).top;
         Init(parent, structureType);
         this.parent = (PdfStructureElement) parent;
         Put(PdfName.P, ((PdfStructureElement) parent).reference);
         Put(PdfName.TYPE, PdfName.STRUCTELEM);
     } else if (parent is PdfStructureTreeRoot) {
         top = (PdfStructureTreeRoot) parent;
         Init(parent, structureType);
         Put(PdfName.P, ((PdfStructureTreeRoot) parent).Reference);
         Put(PdfName.TYPE, PdfName.STRUCTELEM);
     } else {}
 }
开发者ID:,项目名称:,代码行数:14,代码来源:


示例16: SetReader

 protected internal void SetReader(PdfReader reader){
     this.reader = reader;
     PdfObject obj = reader.Catalog.Get(PdfName.STRUCTTREEROOT);
     obj = GetDirectObject(obj);
     if ((obj == null) || (!obj.IsDictionary()))
         throw new BadPdfFormatException(MessageLocalization.GetComposedMessage("no.structtreeroot.found"));
     structTreeRoot = (PdfDictionary)obj;
     obj = PdfStructTreeController.GetDirectObject(structTreeRoot.Get(PdfName.PARENTTREE));
     if (!obj.IsDictionary())
         throw new BadPdfFormatException(MessageLocalization.GetComposedMessage("the.document.does.not.contain.parenttree"));
     parentTree = (PdfDictionary)obj;
     sourceRoleMap = null;
     sourceClassMap = null;
 }
开发者ID:,项目名称:,代码行数:14,代码来源:


示例17: PRStream

 public PRStream(PRStream stream, PdfDictionary newDic) {
     reader = stream.reader;
     offset = stream.offset;
     length = stream.Length;
     compressed = stream.compressed;
     compressionLevel = stream.compressionLevel;
     streamBytes = stream.streamBytes;
     bytes = stream.bytes;
     objNum = stream.objNum;
     objGen = stream.objGen;
     if (newDic != null)
         Merge(newDic);
     else
         Merge(stream);
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:15,代码来源:PRStream.cs


示例18: SetColorProfile

        /// <summary>
        /// Sets PDF/A Conformance ColorProfile.
        /// </summary>
        public void SetColorProfile()
        {
            if (PageSetup.ConformanceLevel == PdfXConformance.PDFXNONE) return;

            var pdfDictionary = new PdfDictionary(PdfName.OUTPUTINTENT);
            pdfDictionary.Put(PdfName.OUTPUTCONDITIONIDENTIFIER, new PdfString("sRGB IEC61966-2.1"));
            pdfDictionary.Put(PdfName.INFO, new PdfString("sRGB IEC61966-2.1"));
            pdfDictionary.Put(PdfName.S, PdfName.GTS_PDFA1);

            var profileStream = StreamHelper.GetResourceByName("PdfRpt.Core.Helper.srgb.profile");
            var pdfICCBased = new PdfICCBased(ICC_Profile.GetInstance(profileStream));
            pdfICCBased.Remove(PdfName.ALTERNATE);
            pdfDictionary.Put(PdfName.DESTOUTPUTPROFILE, PdfWriter.AddToBody(pdfICCBased).IndirectReference);

            PdfWriter.ExtraCatalog.Put(PdfName.OUTPUTINTENTS, new PdfArray(pdfDictionary));
        }
开发者ID:andycarmona,项目名称:TimelyDepotUps,代码行数:19,代码来源:PdfConformance.cs


示例19: ProcessResource

        // ---------------------------------------------------------------------------
        /**
         * Extracts the font names from page or XObject resources.
         * @param set the HashSet with the font names
         * @param resources the resources dictionary
         */
        public void ProcessResource(HashSet<String> set, PdfDictionary resource)
        {
            if (resource == null) return;

            PdfDictionary xobjects = resource.GetAsDict(PdfName.XOBJECT);
            if (xobjects != null) {
              foreach (PdfName key in xobjects.Keys) {
            ProcessResource(set, xobjects.GetAsDict(key));
              }
            }
            PdfDictionary fonts = resource.GetAsDict(PdfName.FONT);
            if (fonts == null) return;

            PdfDictionary font;
            foreach (PdfName key in fonts.Keys) {
              font = fonts.GetAsDict(key);
              String name = font.GetAsName(PdfName.BASEFONT).ToString();
              if (name.Length > 8 && name.Substring(7, 1) == "+") {
            name = String.Format(
              "{0} subset ({1})",
              name.Substring(8), name.Substring(1, 7)
            );
              }
              else {
              name = name.Substring(1);
              PdfDictionary desc = font.GetAsDict(PdfName.FONTDESCRIPTOR);
              if (desc == null) {
                name += " nofontdescriptor";
              }
              else if (desc.Get(PdfName.FONTFILE) != null) {
                name += " (Type 1) embedded";
              }
              else if (desc.Get(PdfName.FONTFILE2) != null) {
                name += " (TrueType) embedded";
              }
              else if (desc.Get(PdfName.FONTFILE3) != null) {
                name += " (" + font.GetAsName(PdfName.SUBTYPE).ToString().Substring(1) + ") embedded";
              }
              }
              set.Add(name);
            }
        }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:48,代码来源:ListUsedFonts.cs


示例20: SetOriginalResources

 internal void SetOriginalResources(PdfDictionary resources, int[] newNamePtr) {
     if (newNamePtr != null)
         namePtr = newNamePtr;
     forbiddenNames = new Dictionary<PdfName,object>();
     usedNames = new Dictionary<PdfName,PdfName>();
     if (resources == null)
         return;
     originalResources = new PdfDictionary();
     originalResources.Merge(resources);
     foreach (PdfName key in resources.Keys) {
         PdfObject sub = PdfReader.GetPdfObject(resources.Get(key));
         if (sub != null && sub.IsDictionary()) {
             PdfDictionary dic = (PdfDictionary)sub;
             foreach (PdfName name in dic.Keys) {
                 forbiddenNames[name] = null;
             }
             PdfDictionary dic2 = new PdfDictionary();
             dic2.Merge(dic);
             originalResources.Put(key, dic2);
         }
     }
 }
开发者ID:,项目名称:,代码行数:22,代码来源:



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# pdf.PdfDocument类代码示例发布时间:2022-05-26
下一篇:
C# pdf.PdfDestination类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap