Exemplo n.º 1
0
        public virtual void IndirectFilterMarkedToBeFlushedBeforeStreamTest()
        {
            // TODO DEVSIX-1193 remove junitExpectedException after fix
            String      inFile = sourceFolder + "indFilterInCatalog.pdf";
            String      @out   = destinationFolder + "indirectFilterMarkedToBeFlushedBeforeStreamTest.pdf";
            PdfWriter   writer = new PdfWriter(@out);
            PdfDocument pdfDoc = new PdfDocument(new PdfReader(inFile), writer);
            // Simulate the case when indirect filter object is marked to be flushed before the stream itself.
            PdfObject filterObject = pdfDoc.GetPdfObject(6);

            filterObject.GetIndirectReference().SetState(PdfObject.MUST_BE_FLUSHED);
            // The image stream will be marked as MUST_BE_FLUSHED after page is flushed.
            pdfDoc.GetFirstPage().GetPdfObject().GetIndirectReference().SetState(PdfObject.MUST_BE_FLUSHED);
            NUnit.Framework.Assert.That(() => {
                writer.FlushWaitingObjects(JavaCollectionsUtil.EmptySet <PdfIndirectReference>());
                pdfDoc.Close();
            }
                                        , NUnit.Framework.Throws.InstanceOf <NullReferenceException>())
            ;
        }
 public DeepFlushingContext(PageFlushingHelper.DeepFlushingContext unconditionalInnerContext)
 {
     this.blackList                 = JavaCollectionsUtil.EmptySet <PdfName>();
     this.innerContexts             = null;
     this.unconditionalInnerContext = unconditionalInnerContext;
 }
Exemplo n.º 3
0
        /// <summary>Gets the names of all resources of specified type.</summary>
        /// <param name="resType">
        /// the resource type. Should be
        /// <see cref="PdfName.ColorSpace"/>
        /// ,
        /// <see cref="PdfName.ExtGState"/>
        /// ,
        /// <see cref="PdfName.Pattern"/>
        /// ,
        /// <see cref="PdfName.Shading"/>
        /// ,
        /// <see cref="PdfName.XObject"/>
        /// ,
        /// <see cref="PdfName.Font"/>.
        /// </param>
        /// <returns>
        /// set of resources name of corresponding type. May be empty.
        /// Will be empty in case of incorrect resource type.
        /// </returns>
        public virtual ICollection <PdfName> GetResourceNames(PdfName resType)
        {
            PdfDictionary resourceCategory = GetPdfObject().GetAsDictionary(resType);

            return(resourceCategory == null?JavaCollectionsUtil.EmptySet <PdfName>() : resourceCategory.KeySet());
        }