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


C# pdf.PdfIndirectReference类代码示例

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


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

示例1: RichMediaExecuteAction

 /**
  * Creates a RichMediaExecute action dictionary.
  * @param   ref a reference to rich media annotation dictionary for
  * an annotation for which to execute the script command.
  * @param   command the command name and arguments to be
  * executed when the rich-media-execute action is invoked.
  */
 public RichMediaExecuteAction(PdfIndirectReference refi, RichMediaCommand command)
     : base()
 {
     Put(PdfName.S, PdfName.RICHMEDIAEXECUTE);
     Put(PdfName.TA, refi);
     Put(PdfName.CMD, command);
 }
开发者ID:jomamorales,项目名称:createPDF,代码行数:14,代码来源:RichMediaExecuteAction.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: AddDocumentField

 internal void AddDocumentField(PdfIndirectReference ref_p) {
     PdfDictionary catalog = reader.Catalog;
     PdfDictionary acroForm = (PdfDictionary)PdfReader.GetPdfObject(catalog.Get(PdfName.ACROFORM), catalog);
     if (acroForm == null) {
         acroForm = new PdfDictionary();
         catalog.Put(PdfName.ACROFORM, acroForm);
         MarkUsed(catalog);
     }
     PdfArray fields = (PdfArray)PdfReader.GetPdfObject(acroForm.Get(PdfName.FIELDS), acroForm);
     if (fields == null) {
         fields = new PdfArray();
         acroForm.Put(PdfName.FIELDS, fields);
         MarkUsed(acroForm);
     }
     if (!acroForm.Contains(PdfName.DA)) {
         acroForm.Put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g "));
         MarkUsed(acroForm);
     }
     fields.Add(ref_p);
     MarkUsed(fields);
 }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:21,代码来源:PdfStamperImp.cs

示例4: AddDocumentField

 /**
  * Adds documentFields.
  */
 virtual public void AddDocumentField(PdfIndirectReference piref) {
     documentFields.Add(piref);
 }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:6,代码来源:PdfAcroForm.cs

示例5: PdfCatalog

 // constructors
 
 /**
 * Constructs a <CODE>PdfCatalog</CODE>.
 *
 * @param        pages       an indirect reference to the root of the document's Pages tree.
 * @param writer the writer the catalog applies to
 */
 
 internal PdfCatalog(PdfIndirectReference pages, PdfWriter writer) : base(CATALOG) {
     this.writer = writer;
     Put(PdfName.PAGES, pages);
 }
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:13,代码来源:PdfDocument.cs

示例6: PdfAppearance

 internal PdfAppearance(PdfIndirectReference iref)
 {
     thisReference = iref;
 }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:4,代码来源:PdfAppearance.cs

示例7: Close

 protected virtual void Close(PdfIndirectReference info, int skipInfo) {
     AlterContents();
     int rootN = ((PRIndirectReference)reader.trailer.Get(PdfName.ROOT)).Number;
     if (append) {
         int[] keys = marked.GetKeys();
         for (int k = 0; k < keys.Length; ++k) {
             int j = keys[k];
             PdfObject obj = reader.GetPdfObjectRelease(j);
             if (obj != null && skipInfo != j && j < initialXrefSize) {
                 AddToBody(obj, obj.IndRef, j != rootN);
             }
         }
         for (int k = initialXrefSize; k < reader.XrefSize; ++k) {
             PdfObject obj = reader.GetPdfObject(k);
             if (obj != null) {
                 AddToBody(obj, GetNewObjectNumber(reader, k, 0));
             }
         }
     } else {
         for (int k = 1; k < reader.XrefSize; ++k) {
             PdfObject obj = reader.GetPdfObjectRelease(k);
             if (obj != null && skipInfo != k) {
                 AddToBody(obj, GetNewObjectNumber(reader, k, 0), k != rootN);
             }
         }
     }
     PdfIndirectReference encryption = null;
     PdfObject fileID = null;
     if (crypto != null) {
         if (append) {
             encryption = reader.GetCryptoRef();
         } else {
             PdfIndirectObject encryptionObject = AddToBody(crypto.GetEncryptionDictionary(), false);
             encryption = encryptionObject.IndirectReference;
         }
         fileID = crypto.GetFileID(true);
     }
     else {
         PdfArray IDs = reader.trailer.GetAsArray(PdfName.ID);
         if(IDs != null && IDs.GetAsString(0) != null) {
             fileID = PdfEncryption.CreateInfoId(IDs.GetAsString(0).GetBytes(), true);
         }
         else {
             fileID = PdfEncryption.CreateInfoId(PdfEncryption.CreateDocumentId(), true);
         }
     }
     PRIndirectReference iRoot = (PRIndirectReference)reader.trailer.Get(PdfName.ROOT);
     PdfIndirectReference root = new PdfIndirectReference(0, GetNewObjectNumber(reader, iRoot.Number, 0));
     // write the cross-reference table of the body
     body.WriteCrossReferenceTable(os, root, info, encryption, fileID, prevxref);
     if (fullCompression) {
         WriteKeyInfo(os);
         byte[] tmp = GetISOBytes("startxref\n");
         os.Write(tmp, 0, tmp.Length);
         tmp = GetISOBytes(body.Offset.ToString());
         os.Write(tmp, 0, tmp.Length);
         tmp = GetISOBytes("\n%%EOF\n");
         os.Write(tmp, 0, tmp.Length);
     } else {
         PdfTrailer trailer = new PdfTrailer(body.Size,
         body.Offset,
         root,
         info,
         encryption,
         fileID, prevxref);
         trailer.ToPdf(this, os);
     }
     os.Flush();
     if (CloseStream)
         os.Close();
     GetCounter().Written(os.Counter);
 }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:72,代码来源:PdfStamperImp.cs

示例8: PdfLayerMembership

 /**
 * Creates a new, empty, membership layer.
 * @param writer the writer
 */    
 public PdfLayerMembership(PdfWriter writer) : base(PdfName.OCMD) {
     Put(PdfName.OCGS, members);
     refi = writer.PdfIndirectReference;
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:8,代码来源:PdfLayerMembership.cs

示例9: Close

 internal void Close(Hashtable moreInfo)
 {
     if (closed)
         return;
     if (useVp) {
         reader.SetViewerPreferences(viewerPreferences);
         MarkUsed(reader.Trailer.Get(PdfName.ROOT));
     }
     if (flat)
         FlatFields();
     if (flatFreeText)
         FlatFreeTextFields();
     AddFieldResources();
     PdfDictionary acroForm = (PdfDictionary)PdfReader.GetPdfObject(reader.Catalog.Get(PdfName.ACROFORM), reader.Catalog);
     if (acroFields != null && acroFields.Xfa.Changed) {
         MarkUsed(acroForm);
         if (!flat)
             acroFields.Xfa.SetXfa(this);
     }
     if (sigFlags != 0) {
         if (acroForm != null) {
             acroForm.Put(PdfName.SIGFLAGS, new PdfNumber(sigFlags));
             MarkUsed(acroForm);
         }
     }
     closed = true;
     AddSharedObjectsToBody();
     SetOutlines();
     SetJavaScript();
     AddFileAttachments();
     PdfDictionary catalog = reader.Catalog;
     if (openAction != null) {
         catalog.Put(PdfName.OPENACTION, openAction);
     }
     byte[] altMetadata = xmpMetadata;
     if (altMetadata == null) {
         PdfObject xmpo = PdfReader.GetPdfObject(catalog.Get(PdfName.METADATA));
         if (xmpo != null && xmpo.IsStream()) {
             altMetadata = PdfReader.GetStreamBytesRaw((PRStream)xmpo);
             PdfReader.KillIndirect(xmpo);
         }
     }
     // if there is XMP data to add: add it
     if (altMetadata != null) {
         PdfStream xmp = new PdfStream(altMetadata);
         xmp.Put(PdfName.TYPE, PdfName.METADATA);
         xmp.Put(PdfName.SUBTYPE, PdfName.XML);
         if (crypto != null && !crypto.IsMetadataEncrypted()) {
             PdfArray ar = new PdfArray();
             ar.Add(PdfName.CRYPT);
             xmp.Put(PdfName.FILTER, ar);
         }
         catalog.Put(PdfName.METADATA, body.Add(xmp).IndirectReference);
         MarkUsed(catalog);
     }
     PRIndirectReference iInfo = null;
     try {
         file.ReOpen();
         AlterContents();
         iInfo = (PRIndirectReference)reader.trailer.Get(PdfName.INFO);
         int skip = -1;
         if (iInfo != null)
             skip = iInfo.Number;
         int rootN = ((PRIndirectReference)reader.trailer.Get(PdfName.ROOT)).Number;
         if (append) {
             int[] keys = marked.GetKeys();
             for (int k = 0; k < keys.Length; ++k) {
                 int j = keys[k];
                 PdfObject obj = reader.GetPdfObjectRelease(j);
                 if (obj != null && skip != j && j < initialXrefSize) {
                     AddToBody(obj, j, j != rootN);
                 }
             }
             for (int k = initialXrefSize; k < reader.XrefSize; ++k) {
                 PdfObject obj = reader.GetPdfObject(k);
                 if (obj != null) {
                     AddToBody(obj, GetNewObjectNumber(reader, k, 0));
                 }
             }
         }
         else {
             for (int k = 1; k < reader.XrefSize; ++k) {
                 PdfObject obj = reader.GetPdfObjectRelease(k);
                 if (obj != null && skip != k) {
                     AddToBody(obj, GetNewObjectNumber(reader, k, 0), k != rootN);
                 }
             }
         }
     }
     finally {
         try {
             file.Close();
         }
         catch  {
             // empty on purpose
         }
     }
     PdfIndirectReference encryption = null;
     PdfObject fileID = null;
     if (crypto != null) {
//.........这里部分代码省略.........
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:101,代码来源:PdfStamperImp.cs

示例10: PdfImage

        // constructor
        /**
        * Constructs a <CODE>PdfImage</CODE>-object.
        *
        * @param image the <CODE>Image</CODE>-object
        * @param name the <CODE>PdfName</CODE> for this image
        * @throws BadPdfFormatException on error
        */
        public PdfImage(Image image, String name, PdfIndirectReference maskRef)
        {
            if (name == null)
                GenerateImgResName(image);
            else
                this.name = new PdfName(name);
            Put(PdfName.TYPE, PdfName.XOBJECT);
            Put(PdfName.SUBTYPE, PdfName.IMAGE);
            Put(PdfName.WIDTH, new PdfNumber(image.Width));
            Put(PdfName.HEIGHT, new PdfNumber(image.Height));
            if (image.Layer != null)
                Put(PdfName.OC, image.Layer.Ref);
            if (image.IsMask() && (image.Bpc == 1 || image.Bpc > 0xff))
                Put(PdfName.IMAGEMASK, PdfBoolean.PDFTRUE);
            if (maskRef != null) {
                if (image.Smask)
                    Put(PdfName.SMASK, maskRef);
                else
                    Put(PdfName.MASK, maskRef);
            }
            if (image.IsMask() && image.Inverted)
                Put(PdfName.DECODE, new PdfLiteral("[1 0]"));
            if (image.Interpolation)
                Put(PdfName.INTERPOLATE, PdfBoolean.PDFTRUE);
            Stream isp = null;
            try {
                // Raw Image data
                if (image.IsImgRaw()) {
                    // will also have the CCITT parameters
                    int colorspace = image.Colorspace;
                    int[] transparency = image.Transparency;
                    if (transparency != null && !image.IsMask() && maskRef == null) {
                        StringBuilder s = new StringBuilder("[");
                        for (int k = 0; k < transparency.Length; ++k)
                            s.Append(transparency[k]).Append(' ');
                        s.Append(']');
                        Put(PdfName.MASK, new PdfLiteral(s.ToString()));
                    }
                    bytes = image.RawData;
                    Put(PdfName.LENGTH, new PdfNumber(bytes.Length));
                    int bpc = image.Bpc;
                    if (bpc > 0xff) {
                        if (!image.IsMask())
                            Put(PdfName.COLORSPACE, PdfName.DEVICEGRAY);
                        Put(PdfName.BITSPERCOMPONENT, new PdfNumber(1));
                        Put(PdfName.FILTER, PdfName.CCITTFAXDECODE);
                        int k = bpc - Image.CCITTG3_1D;
                        PdfDictionary decodeparms = new PdfDictionary();
                        if (k != 0)
                            decodeparms.Put(PdfName.K, new PdfNumber(k));
                        if ((colorspace & Image.CCITT_BLACKIS1) != 0)
                            decodeparms.Put(PdfName.BLACKIS1, PdfBoolean.PDFTRUE);
                        if ((colorspace & Image.CCITT_ENCODEDBYTEALIGN) != 0)
                            decodeparms.Put(PdfName.ENCODEDBYTEALIGN, PdfBoolean.PDFTRUE);
                        if ((colorspace & Image.CCITT_ENDOFLINE) != 0)
                            decodeparms.Put(PdfName.ENDOFLINE, PdfBoolean.PDFTRUE);
                        if ((colorspace & Image.CCITT_ENDOFBLOCK) != 0)
                            decodeparms.Put(PdfName.ENDOFBLOCK, PdfBoolean.PDFFALSE);
                        decodeparms.Put(PdfName.COLUMNS, new PdfNumber(image.Width));
                        decodeparms.Put(PdfName.ROWS, new PdfNumber(image.Height));
                        Put(PdfName.DECODEPARMS, decodeparms);
                    }
                    else {
                        switch (colorspace) {
                            case 1:
                                Put(PdfName.COLORSPACE, PdfName.DEVICEGRAY);
                                if (image.Inverted)
                                    Put(PdfName.DECODE, new PdfLiteral("[1 0]"));
                                break;
                            case 3:
                                Put(PdfName.COLORSPACE, PdfName.DEVICERGB);
                                if (image.Inverted)
                                    Put(PdfName.DECODE, new PdfLiteral("[1 0 1 0 1 0]"));
                                break;
                            case 4:
                            default:
                                Put(PdfName.COLORSPACE, PdfName.DEVICECMYK);
                                if (image.Inverted)
                                    Put(PdfName.DECODE, new PdfLiteral("[1 0 1 0 1 0 1 0]"));
                                break;
                        }
                        PdfDictionary additional = image.Additional;
                        if (additional != null)
                            Merge(additional);
                        if (image.IsMask() && (image.Bpc == 1 || image.Bpc > 8))
                            Remove(PdfName.COLORSPACE);
                        Put(PdfName.BITSPERCOMPONENT, new PdfNumber(image.Bpc));
                        if (image.Deflated)
                            Put(PdfName.FILTER, PdfName.FLATEDECODE);
                        else {
                            FlateCompress(image.CompressionLevel);
                        }
//.........这里部分代码省略.........
开发者ID:boecko,项目名称:iTextSharp,代码行数:101,代码来源:PdfImage.cs

示例11: SetDestinationPage

 /**
  * Set the page of the <CODE>PdfDestination</CODE>-object.
  *
  * @param pageReference indirect reference to the page
  * @return <CODE>true</CODE> if this page was set as the <CODE>PdfDestination</CODE>-page.
  */
 public bool SetDestinationPage(PdfIndirectReference pageReference)
 {
     if (destination == null) {
         return false;
     }
     return destination.AddPage(pageReference);
 }
开发者ID:medvedttn,项目名称:itextsharp_mod-src,代码行数:13,代码来源:PdfOutline.cs

示例12: GetCatalog

        /**
        * Gets the <CODE>PdfCatalog</CODE>-object.
        *
        * @param pages an indirect reference to this document pages
        * @return <CODE>PdfCatalog</CODE>
        */
        internal PdfCatalog GetCatalog(PdfIndirectReference pages) {
            PdfCatalog catalog = new PdfCatalog(pages, writer);
            
            // [C1] outlines
            if (rootOutline.Kids.Count > 0) {
                catalog.Put(PdfName.PAGEMODE, PdfName.USEOUTLINES);
                catalog.Put(PdfName.OUTLINES, rootOutline.IndirectReference);
            }
            
            // [C2] version
            writer.GetPdfVersion().AddToCatalog(catalog);
            
            // [C3] preferences
            viewerPreferences.AddToCatalog(catalog);
            
            // [C4] pagelabels
            if (pageLabels != null) {
                catalog.Put(PdfName.PAGELABELS, pageLabels.GetDictionary(writer));
            }
            
            // [C5] named objects
            catalog.AddNames(localDestinations, GetDocumentLevelJS(), documentFileAttachment, writer);
            
            // [C6] actions
            if (openActionName != null) {
                PdfAction action = GetLocalGotoAction(openActionName);
                catalog.OpenAction = action;
            }
            else if (openActionAction != null)
                catalog.OpenAction = openActionAction;
            if (additionalActions != null)   {
                catalog.AdditionalActions = additionalActions;
            }
            
            // [C7] portable collections
            if (collection != null) {
                catalog.Put(PdfName.COLLECTION, collection);
            }

            // [C8] AcroForm
            if (annotationsImp.HasValidAcroForm()) {
                catalog.Put(PdfName.ACROFORM, writer.AddToBody(annotationsImp.AcroForm).IndirectReference);
            }

            if (language != null) {
                catalog.Put(PdfName.LANG, language);
            }

            return catalog;
        }
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:56,代码来源:PdfDocument.cs


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