Ejemplo n.º 1
0
        public virtual void ToPDF(Page page, Rect rect, PDFPainter painter)
        {
            double                      num1;
            double                      num2;
            double                      num3;
            double                      num4;
            Rect                        rect1;
            AnnotationScreen            screen1;
            ActionRendition             rendition1;
            AnnotationAdditionalActions actions1;

            double[] numArray1;
            if (this.mType == 0)
            {
                num1 = (rect.Width / 5f);
                num2 = (rect.Height / 5f);
                painter.q();
                painter.RG(0f, 0f, 0f).w(1f);
                painter.re(rect.x1, rect.y1, rect.Width, rect.Height);
                painter.S();
                painter.RG(1f, 0f, 0f).w((num1 / 2f));
                painter.m((rect.x1 + (1.2f * num1)), (rect.y1 + (1.2f * num2))).l((rect.x2 - (1.2f * num1)), (rect.y2 - (1.2f * num2))).m((rect.x1 + (1.2f * num1)), (rect.y2 - (1.2f * num2))).l((rect.x2 - (1.2f * num1)), (rect.y1 + (1.2f * num2)));
                painter.S();
                painter.Q();
                return;
            }
            if (1 == this.mType)
            {
                page.Resources.Add(this.ResourceID, (this.resource as XObjectImage));
                num3 = ((rect.Width != 0f) ? rect.Width : 1f);
                num4 = ((rect.Height != 0f) ? rect.Height : 1f);
                if (this.FromSvg)
                {
                    painter.q().cm(new CTM(num3, 0f, 0f, num4, rect.x1, (rect.y1 + rect.Height))).cm(new CTM(1f, 0f, 0f, -1f, 0f, 0f)).Do(this.ResourceID).Q();
                    return;
                }
                painter.q().cm(new CTM(num3, 0f, 0f, num4, rect.x1, rect.y1)).Do(this.ResourceID).Q();
                return;
            }
            if (4 == this.mType)
            {
                page.Resources.Add(this.ResourceID, (this.resource as XObjectPS));
                if (rect.Width != 0f)
                {
                    rect.Width;
                }
                if (rect.Height != 0f)
                {
                    rect.Height;
                }
                painter.q().re(rect).W().n().cm(new CTM(1f, 0f, 0f, 1f, rect.x1, rect.y1)).Do(this.ResourceID).Q();
                return;
            }
            if (5 == this.mType)
            {
                page.Resources.Add(this.ResourceID, (this.resource as XObjectPS));
                rect1 = (this.resourceSupport as Rect);
                if (rect.Width != 0f)
                {
                    rect.Width;
                }
                if (rect.Height != 0f)
                {
                    rect.Height;
                }
                painter.q().re(rect).W().n();
                painter.cm(new CTM((rect.Width / rect1.Width), 0f, 0f, (rect.Height / rect1.Height), (rect.x1 - ((rect1.x1 * rect.Width) / rect1.Width)), (rect.y1 - ((rect1.y1 * rect.Height) / rect1.Height))));
                painter.Do(this.ResourceID).Q();
                return;
            }
            if (6 == this.mType)
            {
                if (this.FromSvg)
                {
                    painter.q().cm(new CTM(1f, 0f, 0f, 1f, rect.x1, (rect.y1 + rect.Height))).cm(new CTM(1f, 0f, 0f, -1f, 0f, 0f));
                }
                this.SvgToPDF(page, rect, painter);
                if (!this.FromSvg)
                {
                    return;
                }
                painter.Q();
                return;
            }
            if (PDFPForeignObject.IsMultiMediaType(this.mType))
            {
                screen1                   = AnnotationScreen.Create(rect);
                screen1.Flags             = FlagsEnum.Print;
                screen1.Page              = page;
                screen1.Border            = new BorderCharact(0f, 0f, 0f);
                numArray1                 = new double[1];
                numArray1[0]              = 3f;
                screen1.BorderStyle       = new BorderStyles(0f, EBorderStyle.Solid, numArray1);
                rendition1                = ActionRendition.Create(EPlayOperation.reassign_or_play, (this.resource as RenditionMedia), screen1);
                actions1                  = new AnnotationAdditionalActions();
                actions1.PageVisible      = rendition1;
                actions1.PageInvisible    = rendition1;
                screen1.AdditionalActions = actions1;
                page.Annotations.Add(screen1);
            }
        }
Ejemplo n.º 2
0
 protected abstract void SvgToPDF(Page page, Rect rect, PDFPainter painter);