private RadFixedDocument CreateDocument()
        {
            RadFixedDocument document = new RadFixedDocument();
            RadFixedPage page = document.Pages.AddPage();
            page.Size = new Size(600, 750);
            FixedContentEditor editor = new FixedContentEditor(page);
            editor.Position.Translate(defaultLeftIndent, 50);
            using (Stream stream = FileHelper.GetSampleResourceStream("pdfProcessingSilverlight.jpg"))
            {
                editor.DrawImage(stream);
            }
            double currentTopOffset = 110;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);
            editor.TextProperties.FontSize = 14;
            double maxWidth = page.Size.Width - defaultLeftIndent * 2;

            this.DrawDescription(editor, maxWidth);

            currentTopOffset += defaultLineHeight * 4;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);
            using (editor.SaveProperties())
            {
                this.DrawFunnelFigure(editor);
            }

            editor.Position.Translate(defaultLeftIndent * 4, page.Size.Height - 100);
            using (Stream stream = FileHelper.GetSampleResourceStream("telerik.jpg"))
            {
                editor.DrawImage(stream);
            }

            this.DrawText(editor, maxWidth);

            return document;
        }
        public RadFixedDocument CreateDocument()
        {
            RadFixedDocument document = new RadFixedDocument();
            RadFixedPage page = document.Pages.AddPage();
            page.Size = new Size(600, 800);
            this.editor = new FixedContentEditor(page);
            this.editor.Position.Translate(40, 50);
            using (Stream stream = FileHelper.GetSampleResourceStream("banner.png"))
            {
                ImageSource imageSource = new ImageSource(stream, ImageQuality.High);
                editor.DrawImage(imageSource, new Size(530, 80));
            }

            editor.Position.Translate(ExampleDocumentSizes.DefaultLeftIndent, 160);
            double maxWidth = page.Size.Width - ExampleDocumentSizes.DefaultLeftIndent * 2;

            this.DrawDescription(maxWidth);

            using (editor.SaveProperties())
            {
                using (editor.SavePosition())
                {
                    this.DrawFunnelFigure();
                }
            }

            return document;
        }
示例#3
0
        // This is the method which will be called when the internal logic of the PdfFormatProvider reaches a chart which has to be rendered.
        public void RenderChart(FixedContentEditor editor, FloatingChartShape chart)
        {
            BitmapSource source = this.chartToImageConverter.GetBitmapSourceFromFloatingChartShape(chart, 300d, 300d);

            // The editor draws the image in the PDF.
            editor.DrawImage(this.StreamFromBitmapSource(source), new Size(chart.Width, chart.Height));
        }
示例#4
0
 private void InsertImage(FixedContentEditor editor)
 {
     #region radpdfprocessing-editing-fixedcontenteditor_4
     using (Stream stream = this.GetResourceStream("Telerik_logo.jpg"))
     {
         editor.DrawImage(stream, ImageFormat.Jpeg, new Size(118, 28));
     }
     #endregion
 }
示例#5
0
        // This is the method which will be called when the internal logic of the PdfFormatProvider reaches a chart which has to be rendered.
        public void RenderChart(FixedContentEditor editor, FloatingChartShape chart)
        {
            // The ChartModelToImageConverter object is readily available in the Telerik.Windows.Controls.Spreadsheet assembly and
            // uses internally the RadChartView control to visualize the chart and create an image.
            BitmapSource source = this.chartToImageConverter.GetBitmapSourceFromFloatingChartShape(chart, 300d, 300d);

            // The editor draws the image in the PDF.
            editor.DrawImage(this.StreamFromBitmapSource(source), new Size(chart.Width, chart.Height));
        }
示例#6
0
        private RadFixedDocument CreateDocument()
        {
            RadFixedDocument document = new RadFixedDocument();
            RadFixedPage     page     = document.Pages.AddPage();

            page.Size = new Size(600, 750);
            FixedContentEditor editor = new FixedContentEditor(page);

            editor.Position.Translate(defaultLeftIndent, 50);
            using (Stream stream = FileHelper.GetSampleResourceStream("pdfProcessingSilverlight.jpg"))
            {
                editor.DrawImage(stream);
            }
            double currentTopOffset = 110;

            editor.Position.Translate(defaultLeftIndent, currentTopOffset);
            editor.TextProperties.FontSize   = 14;
            editor.TextProperties.LineHeight = defaultLineHeight;
            double maxWidth = page.Size.Width - defaultLeftIndent * 2;

            this.DrawDescription(editor, maxWidth);

            currentTopOffset += defaultLineHeight * 5;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);

            using (editor.SaveGraphicProperties())
            {
                using (editor.SaveTextProperties())
                {
                    this.DrawFunnelFigure(editor);
                }
            }

            editor.Position.Translate(defaultLeftIndent * 4, page.Size.Height - 100);
            using (Stream stream = FileHelper.GetSampleResourceStream("telerik.jpg"))
            {
                editor.DrawImage(stream);
            }

            this.DrawText(editor);

            return(document);
        }
        private static void DrawDescription(FixedContentEditor editor, double maxWidth)
        {
            double WriteWhere = 0;                    //Define el actual tope del editor en 500

            editor.Position.Translate(0, WriteWhere); //Traslada el editor al nuevo punto de escritura

            //using (FileStream fss = new FileStream(System.Web.HttpContext.Current.Server.MapPath("~/Images/Blank.PNG"), FileMode.Open, FileAccess.Read))
            //{ editor.DrawImage(fss); }

            WriteWhere = 20;                                              //Define el actual tope del editor en 500
            editor.Position.Translate(MargenIzquierdo + 300, WriteWhere); //Traslada el editor al nuevo punto de escritura

            using (FileStream fs = new FileStream(System.Web.HttpContext.Current.Server.MapPath("~/Images/LogoBae.jpeg"), FileMode.Open, FileAccess.Read))
            { editor.DrawImage(fs); }
            Block block = new Block();

            WriteWhere += AnchoDeLinea * 4;
            editor.Position.Translate(MargenIzquierdo, WriteWhere);//Traslada el editor al nuevo punto de escritura
            block.InsertText("BAE SYSTEMS");
            block.TextProperties.Font     = FontsRepository.Helvetica;
            block.TextProperties.FontSize = 13;
            editor.DrawBlock(block);
            block = new Block();
            editor.Position.Translate(450, WriteWhere);//Traslada el editor al nuevo punto de escritura
            using (block.SaveTextProperties())
            {
                block.TextProperties.Font = FontsRepository.CourierBold;
                block.InsertText(new FontFamily("Calibri"), "DATE: ");
            }
            block.InsertText(new FontFamily("Calibri"), System.DateTime.Now.ToShortDateString());
            editor.DrawBlock(block);
            WriteWhere += AnchoDeLinea * 2;
            editor.Position.Translate(MargenIzquierdo, WriteWhere);//Traslada el editor al nuevo punto de escritura

            block = new Block();
            block.InsertText("Carretera Internacional KM.129 Salida");
            block.TextProperties.FontSize = 11;
            editor.DrawBlock(block);
            WriteWhere += AnchoDeLinea * 1.5;
            editor.Position.Translate(MargenIzquierdo, WriteWhere);//Traslada el editor al nuevo punto de escritura

            block = new Block();
            block.InsertText("Norte Parque Industrial Roca Fuerte");
            editor.DrawBlock(block);
            block.TextProperties.FontSize = 11;
            WriteWhere += AnchoDeLinea * 1.5;
            editor.Position.Translate(MargenIzquierdo, WriteWhere);//Traslada el editor al nuevo punto de escritura

            block = new Block();
            block.InsertText("Edificio#19 Guaymas Sonora, Mexico");
            editor.DrawBlock(block);
            block.TextProperties.FontSize = 11;
            WriteWhere += AnchoDeLinea * 2;
            editor.Position.Translate(MargenIzquierdo, WriteWhere);//Traslada el editor al nuevo punto de escritura
        }
示例#8
0
 private void Positioning(FixedContentEditor editor)
 {
     #region radpdfprocessing-editing-fixedcontenteditor_7
     editor.Position.Scale(1.5, 0.5);
     editor.Position.Rotate(10);
     editor.DrawText("Image:");
     editor.Position.Translate(0, 20);
     using (Stream stream = this.GetResourceStream("Telerik_logo.jpg"))
     {
         editor.DrawImage(stream, ImageFormat.Jpeg, new Size(118, 28));
     }
     #endregion
 }
示例#9
0
        private RadFixedDocument CreateDocument()
        {
            RadFixedDocument document = new RadFixedDocument();
            RadFixedPage     page     = document.Pages.AddPage();

            page.Size = new Size(600, 800);
            FixedContentEditor editor = new FixedContentEditor(page);

            editor.Position.Translate(defaultLeftIndent, 50);
            using (Stream stream = File.OpenRead(sampleDataPath + "pdfProcessingWpf.jpg"))
            {
                editor.DrawImage(stream);
            }

            double currentTopOffset = 110;

            editor.Position.Translate(defaultLeftIndent, currentTopOffset);
            double maxWidth = page.Size.Width - defaultLeftIndent * 2;

            this.DrawDescription(editor, maxWidth);

            currentTopOffset += defaultLineHeight * 4;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);

            using (editor.SaveProperties())
            {
                this.DrawFunnelFigure(editor);
            }

            editor.Position.Translate(defaultLeftIndent * 4, page.Size.Height - 100);
            using (Stream stream = File.OpenRead(sampleDataPath + "telerik.jpg"))
            {
                editor.DrawImage(stream);
            }

            this.DrawText(editor, maxWidth);

            return(document);
        }
        private static RadFixedPage GenerateBackgroundImageContent(string watermarkImage)
        {
            using (Stream imageStream = File.OpenRead(watermarkImage))
            {
                ImageSource  image = new ImageSource(imageStream);
                RadFixedPage backgroundContentOwner = new RadFixedPage();
                backgroundContentOwner.Size = new Size(image.Width, image.Height);
                FixedContentEditor imagePageEditor = new FixedContentEditor(backgroundContentOwner);
                imagePageEditor.DrawImage(image);

                return(backgroundContentOwner);
            }
        }
 private void DrawCompanyLogo(FixedContentEditor editor)
 {
     editor.Position.Translate(230, 80);
     using (Stream stream = this.CompanyLogoImageStream)
     {
         ImageSource imageSource = new ImageSource(stream, ImageQuality.High);
         editor.DrawImage(imageSource);
     }
     editor.Position.Translate(0, 0);
 }