Example #1
0
        protected virtual PDFObjectRef RenderShadingDictionary(PDFContextBase context, PDFWriter writer)
        {
            PDFPoint offset = new PDFPoint(this.Start.X, this.Start.Y);// this.Start;
            PDFSize  size   = this.Size;

            PDFSize graphicsSize = new PDFSize(size.Width + offset.X, size.Height + offset.Y);
            var     func         = this._descriptor.GetGradientFunction(offset, size);
            var     coords       = GetCoords(offset, size, _descriptor.Size, _descriptor.XCentre, _descriptor.YCentre);


            writer.BeginDictionaryEntry("Shading");
            writer.BeginDictionary();
            writer.WriteDictionaryNumberEntry("ShadingType", (int)ShadingType.Radial);
            writer.WriteDictionaryNameEntry("ColorSpace", "DeviceRGB");
            writer.WriteDictionaryBooleanEntry("AntiAlias", true);

            writer.BeginDictionaryEntry("BBox");
            writer.WriteArrayRealEntries(true, offset.X.PointsValue,
                                         offset.Y.PointsValue,
                                         offset.X.PointsValue + size.Width.PointsValue,
                                         offset.Y.PointsValue + size.Height.PointsValue);
            writer.EndDictionaryEntry();

            writer.BeginDictionaryEntry("Coords");
            writer.WriteArrayRealEntries(true, coords);
            writer.EndDictionaryEntry();

            writer.BeginDictionaryEntry("Extend");
            writer.BeginArray();

            writer.BeginArrayEntry();
            writer.WriteBooleanS(true);
            writer.EndArrayEntry();

            writer.BeginArrayEntry();
            writer.WriteBooleanS(true);
            writer.EndArrayEntry();

            writer.EndArray();
            writer.EndDictionaryEntry();

            if (null != func)
            {
                writer.BeginDictionaryEntry("Function");
                func.WriteFunctionDictionary(context, writer);
                writer.EndDictionaryEntry();
            }


            writer.EndDictionary();//shading
            return(null);
        }
        /// <summary>
        /// Overrides the abstract base method to render the remote destination
        /// </summary>
        /// <param name="context"></param>
        /// <param name="writer"></param>
        /// <returns></returns>
        public override PDFObjectRef OutputToPDF(PDFRenderContext context, PDFWriter writer)
        {
            writer.BeginDictionary();
            writer.WriteDictionaryNameEntry("Type", "Action");
            writer.WriteDictionaryNameEntry("S", "GoToR");
            writer.WriteDictionaryStringEntry("F", this.File);
            if (!string.IsNullOrEmpty(this.DestinationName))
            {
                writer.WriteDictionaryStringEntry("D", this.DestinationName);
            }
            writer.WriteDictionaryBooleanEntry("NewWindow", this.NewWindow);
            writer.EndDictionary();

            if (context.ShouldLogDebug)
            {
                context.TraceLog.Add(TraceLevel.Debug, "Remote Action", "Added remote destination action to file " + this.File);
            }

            return(null);
        }