Пример #1
0
        public override void CheckExtGState(CanvasGraphicsState extGState)
        {
            if (extGState.GetTransferFunction() != null)
            {
                throw new PdfAConformanceException(PdfAConformanceException.AN_EXTGSTATE_DICTIONARY_SHALL_NOT_CONTAIN_THE_TR_KEY
                                                   );
            }
            PdfObject transferFunction2 = extGState.GetTransferFunction2();

            if (transferFunction2 != null && !PdfName.Default.Equals(transferFunction2))
            {
                throw new PdfAConformanceException(PdfAConformanceException.AN_EXTGSTATE_DICTIONARY_SHALL_NOT_CONTAIN_THE_TR_2_KEY_WITH_A_VALUE_OTHER_THAN_DEFAULT
                                                   );
            }
            CheckRenderingIntent(extGState.GetRenderingIntent());
            PdfObject softMask = extGState.GetSoftMask();

            if (softMask != null && !PdfName.None.Equals(softMask))
            {
                throw new PdfAConformanceException(PdfAConformanceException.THE_SMASK_KEY_IS_NOT_ALLOWED_IN_EXTGSTATE);
            }
            PdfObject bm = extGState.GetBlendMode();

            if (bm != null && !PdfName.Normal.Equals(bm) && !PdfName.Compatible.Equals(bm))
            {
                throw new PdfAConformanceException(PdfAConformanceException.BLEND_MODE_SHALL_HAVE_VALUE_NORMAL_OR_COMPATIBLE
                                                   );
            }
            float?ca = extGState.GetStrokeOpacity();

            if (ca != null && ca != 1)
            {
                throw new PdfAConformanceException(PdfAConformanceException.TRANSPARENCY_IS_NOT_ALLOWED_CA_SHALL_BE_EQUAL_TO_1
                                                   );
            }
            ca = extGState.GetFillOpacity();
            if (ca != null && ca != 1)
            {
                throw new PdfAConformanceException(PdfAConformanceException.TRANSPARENCY_IS_NOT_ALLOWED_AND_CA_SHALL_BE_EQUAL_TO_1
                                                   );
            }
        }
Пример #2
0
        public override void CheckExtGState(CanvasGraphicsState extGState)
        {
            if (extGState.GetTransferFunction() != null)
            {
                throw new PdfAConformanceException(PdfAConformanceException.AnExtgstateDictionaryShallNotContainTheTrKey);
            }
            PdfObject transferFunction2 = extGState.GetTransferFunction2();

            if (transferFunction2 != null && !PdfName.Default.Equals(transferFunction2))
            {
                throw new PdfAConformanceException(PdfAConformanceException.AnExtgstateDictionaryShallNotContainTheTR2KeyWithAValueOtherThanDefault
                                                   );
            }
            CheckRenderingIntent(extGState.GetRenderingIntent());
            PdfObject softMask = extGState.GetSoftMask();

            if (softMask != null && !PdfName.None.Equals(softMask))
            {
                throw new PdfAConformanceException(PdfAConformanceException.TheSmaskKeyIsNotAllowedInExtgstate);
            }
            PdfObject bm = extGState.GetBlendMode();

            if (bm != null && !PdfName.Normal.Equals(bm) && !PdfName.Compatible.Equals(bm))
            {
                throw new PdfAConformanceException(PdfAConformanceException.BlendModeShallHhaveValueNormalOrCompatible);
            }
            float?ca = extGState.GetStrokeOpacity();

            if (ca != null && ca != 1)
            {
                throw new PdfAConformanceException(PdfAConformanceException.TransparencyIsNotAllowedCAShallBeEqualTo1);
            }
            ca = extGState.GetFillOpacity();
            if (ca != null && ca != 1)
            {
                throw new PdfAConformanceException(PdfAConformanceException.TransparencyIsNotAllowedCaShallBeEqualTo1);
            }
        }