Пример #1
0
 public Shading(PdfShading shading)
     : base(new PdfDictionary())
 {
     GetPdfObject().Put(PdfName.Type, PdfName.Pattern);
     GetPdfObject().Put(PdfName.PatternType, new PdfNumber(2));
     GetPdfObject().Put(PdfName.Shading, shading.GetPdfObject());
 }
Пример #2
0
        public virtual void ModifyAxialShadingTest()
        {
            String      testName    = "modifyAxialShadingTest";
            String      outName     = destinationFolder + testName + ".pdf";
            String      cmpName     = sourceFolder + "cmp_" + testName + ".pdf";
            String      input       = sourceFolder + "axialShading.pdf";
            PdfDocument pdfDocument = new PdfDocument(new PdfReader(input), new PdfWriter(outName), new StampingProperties
                                                          ().UseAppendMode());
            PdfResources resources = pdfDocument.GetPage(1).GetResources();

            foreach (PdfName resName in resources.GetResourceNames())
            {
                PdfShading shading = resources.GetShading(resName);
                if (shading != null && shading.GetShadingType() == PdfShading.ShadingType.AXIAL)
                {
                    PdfShading.Axial axialShading = (PdfShading.Axial)shading;
                    // "cut" shading and extend colors
                    axialShading.SetDomain(0.1f, 0.8f);
                    axialShading.SetExtend(true, true);
                }
            }
            pdfDocument.Close();
            AssertShadingDictionaryResult(outName, cmpName, "Sh1");
        }
Пример #3
0
 public virtual void SetShading(PdfShading shading)
 {
     GetPdfObject().Put(PdfName.Shading, shading.GetPdfObject());
     SetModified();
 }