Ejemplo n.º 1
0
        private static void setFooter(PdfDocument PdfDocument, PdfPage PdfPage, Entrada oE)
        {
            int lblPositionY = 700;

            PdfTextArea taTransportista = new PdfTextArea(new Font("Verdana", 13, FontStyle.Regular), Color.Black
                                                          , new PdfArea(PdfDocument, 20, lblPositionY, 200, 90), ContentAlignment.TopLeft, "--------------------------------------------\nNombre y firma del Transportista Acepto los términos de recepci\\363n y estado de los bultos del presente embarque revisado en mi presencia");

            PdfPage.Add(taTransportista);

            PdfTextArea taAlmacenista = new PdfTextArea(new Font("Verdana", 13, FontStyle.Regular), Color.Black
                                                        , new PdfArea(PdfDocument, 255, lblPositionY - 15, 200, 15), ContentAlignment.TopLeft, oE.PUsuario.Nombre);

            PdfPage.Add(taAlmacenista);

            PdfTextArea taSignAlmacenista = new PdfTextArea(new Font("Verdana", 13, FontStyle.Regular), Color.Black
                                                            , new PdfArea(PdfDocument, 255, lblPositionY, 200, 90), ContentAlignment.TopLeft, "--------------------------------------\nNombre y firma de Almacén.");

            PdfPage.Add(taSignAlmacenista);

            PdfTextArea taVigilancia = new PdfTextArea(new Font("Verdana", 13, FontStyle.Regular), Color.Black
                                                       , new PdfArea(PdfDocument, 470, lblPositionY - 15, 200, 15), ContentAlignment.TopLeft, oE.Vigilante);

            PdfPage.Add(taVigilancia);

            PdfTextArea taSignVigilancia = new PdfTextArea(new Font("Verdana", 13, FontStyle.Regular), Color.Black
                                                           , new PdfArea(PdfDocument, 470, lblPositionY, 200, 90), ContentAlignment.TopLeft, "---------------------------\nVIGILANCIA CASC.");

            PdfPage.Add(taSignVigilancia);
        }
Ejemplo n.º 2
0
        private void ProcessTimeline(PdfPage page, Com.Delta.Print.Engine.Timeline timeline)
        {
            try
            {
                if (timeline.BackgroundColor != Color.Transparent)
                {
                    PdfImage image = new PdfImage(pdfDocument.GetNextId, timeline.Image, false);

                    image.Width   = Convert(timeline.Width);
                    image.Height  = Convert(timeline.Height);
                    image.Quality = System.Convert.ToInt64(timeline.ExportQuality);

                    page.Add(image, Convert(timeline.Bounds.X), Convert(timeline.Bounds.Y), Convert(timeline.Bounds.Width), Convert(timeline.Bounds.Height));
                }
                else
                {
                    PdfImage image = pdfDocument.NewImage(timeline.Image);

                    image.Width   = Convert(timeline.Width);
                    image.Height  = Convert(timeline.Height);
                    image.Quality = System.Convert.ToInt64(timeline.ExportQuality);

                    page.Add(image, Convert(timeline.Bounds.X), Convert(timeline.Bounds.Y), Convert(timeline.Bounds.Width), Convert(timeline.Bounds.Height));
                }
            }
            catch (Exception e) {}
        }
Ejemplo n.º 3
0
        private void ProcessScatter(PdfPage page, Com.Delta.Print.Engine.Scatter chart)
        {
            try
            {
                if (chart.BackgroundColor != Color.Transparent && chart.MapAreaColor != Color.Transparent)
                {
                    PdfImage image = new PdfImage(pdfDocument.GetNextId, chart.Image, false);

                    image.Width   = Convert(chart.Width);
                    image.Height  = Convert(chart.Height);
                    image.Quality = System.Convert.ToInt64(chart.ExportQuality);

                    page.Add(image, Convert(chart.Bounds.X), Convert(chart.Bounds.Y), Convert(chart.Bounds.Width), Convert(chart.Bounds.Height));
                }
                else
                {
                    PdfImage image = pdfDocument.NewImage(chart.Image);

                    image.Width   = Convert(chart.Width);
                    image.Height  = Convert(chart.Height);
                    image.Quality = System.Convert.ToInt64(chart.ExportQuality);

                    page.Add(image, Convert(chart.Bounds.X), Convert(chart.Bounds.Y), Convert(chart.Bounds.Width), Convert(chart.Bounds.Height));
                }
            }
            catch (Exception e) {}
        }
Ejemplo n.º 4
0
        private void AddTitulosDatosPersonales(int x, int y, PdfPage page)
        {
            var text_tituloDatosPaciente = new PdfTextArea(
                Function_Library.FontTituloDatosPersonales,
                Color.Black,
                new PdfArea(pdfDocument, x, y, 150, 20),
                ContentAlignment.MiddleLeft,
                PDF_Resources.Title_DatosPersonales);
            var underline =
                new PdfLine(pdfDocument, new PointF(x, y + 15), new PointF(225, y + 15), Color.Black, 1);

            page.Add(text_tituloDatosPaciente);
            page.Add(underline);
        }
Ejemplo n.º 5
0
        private void ProcessMap(PdfPage page, Com.Delta.Print.Engine.Map map)
        {
            try
            {
                int      mapHash = map.GetHashCode();
                PdfImage image   = null;
                if (images.Contains(mapHash))
                {
                    image = pdfDocument.GetObject((int)images[mapHash]) as PdfImage;
                }
                else
                {
                    if (map.ForegroundColor != Color.Transparent && map.BackgroundColor != Color.Transparent)
                    {
                        image = new PdfImage(pdfDocument.GetNextId, map.Image, false);
                    }
                    else
                    {
                        image = pdfDocument.NewImage(map.Image);
                    }
                    images[mapHash] = image.PublicID;
                }

                image.Width   = Convert(map.Bounds.Width);
                image.Height  = Convert(map.Bounds.Height);
                image.Quality = System.Convert.ToInt64(map.ExportQuality);

                page.Add(image, Convert(map.Bounds.X), Convert(map.Bounds.Y), Convert(map.Bounds.Width), Convert(map.Bounds.Height));
            }
            catch (Exception e) {}
        }
Ejemplo n.º 6
0
        private void ProcessBarcode(PdfPage page, Com.Delta.Print.Engine.Barcode barcode)
        {
            try
            {
                int barcodeHash = barcode.GetHashCode();

                PdfImage image = null;
                if (images.Contains(barcodeHash))
                {
                    image = pdfDocument.GetObject((int)images[barcodeHash]) as PdfImage;
                }
                else
                {
                    image               = new PdfImage(pdfDocument.GetNextId, barcode.Image, false);
                    image.Interpolate   = false;
                    images[barcodeHash] = image.PublicID;
                }

                image.Width  = Convert(barcode.Bounds.Width);
                image.Height = Convert(barcode.Bounds.Height);

                page.Add(image, Convert(barcode.Bounds.X), Convert(barcode.Bounds.Y), Convert(barcode.Bounds.Width), Convert(barcode.Bounds.Height));
            }
            catch (Exception e) {}
        }
        public ActionResult Create(FullcalendarModel fullcalendarModel)
        {
            if (ModelState.IsValid)
            {
                // create a new pdf document
                PdfDocument doc = new PdfDocument();

                // add a new page to the document
                PdfPage page = doc.AddPage();

                // create a new pdf font
                PdfFont font = doc.AddFont(PdfStandardFont.Helvetica);
                font.Size = 15;

                // create a new text element and add it to the page
                PdfTextElement text = new PdfTextElement(50, 50, fullcalendarModel.title.ToString() + "\n" + fullcalendarModel.address.ToString() + "\n" + fullcalendarModel.description.ToString() + "\n" + fullcalendarModel.date.ToString() + "\n" + "Signature:_________________________________" + "\n" + "Total:______________________" + "\n" + "Tax:______________________" + "\n" + "Subtotal:______________________", font);
                page.Add(text);
                doc.Save("C:/Users/Charles/Documents/Visual Studio 2015/Projects/CiezkiCapStone/CCiezkiCapstone/CCiezkiCapstone/Invoices/" + fullcalendarModel.title.ToString() + ".pdf");
                // save pdf document
                //doc.Save("~/Sample.pdf");

                // close pdf document
                doc.Close();

                db.FullcalendarModel.Add(fullcalendarModel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(fullcalendarModel));
        }
Ejemplo n.º 8
0
        private string createPDFFile()
        {
            HtmlToPdf converter = new HtmlToPdf();

            converter.Options.MaxPageLoadTime = 200;
            // create a new pdf document
            PdfDocument doc = new PdfDocument();

            // add a new page to the document
            PdfPage page = doc.AddPage();


            // create html element
            PdfHtmlElement html = new PdfHtmlElement(createTempHTMLFile());

            // add the html element to the document
            page.Add(html);

            // save pdf document
            string myTempFile = Server.MapPath("~/App_Data/") + "Reservation " + reservationNumber + ".pdf";

            //Stream stream=new MemoryStream();
            doc.Save(myTempFile);

            // close pdf document
            doc.Close();
            return(myTempFile);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Saves the PDF from the disk swap file
        /// </summary>
        /// <param name="b"></param>
        /// <param name="output"></param>
        public void SaveAsPDF(BitmapFile b, string output)
        {
            FileInfo fi = new FileInfo(output);

            // Following are the calls to the Gios PDF library
            PdfDocument   myPdfDocument  = new PdfDocument(PdfDocumentFormat.InCentimeters(m_PDF_Width, m_PDF_Height));
            int           horizontalStep = Convert.ToInt32(m_PDF_Width * m_PDF_DPI / 2.54);
            int           verticalStep   = Convert.ToInt32(m_PDF_Height * m_PDF_DPI / 2.54);
            int           origin         = 0;
            List <string> tmpFiles       = new List <string>();
            int           tmpFileCount   = 0;

            while (origin < b.Y)
            {
                Bitmap tmp       = b.GetBitmap(0, origin, horizontalStep, verticalStep);
                string temp_file = fi.DirectoryName + "\\_tempPDFComponent_" + tmpFileCount.ToString().PadLeft(5, '0') + ".jpg";
                tmp.Save(temp_file, ImageFormat.Jpeg);
                tmpFiles.Add(temp_file);
                PdfPage  newPdfPage = myPdfDocument.NewPage();
                PdfImage myImage    = myPdfDocument.NewImage(temp_file);
                newPdfPage.Add(myImage, 0.0, 0.0, m_PDF_DPI);
                newPdfPage.SaveToDocument();
                origin += verticalStep;
                tmpFileCount++;
                tmp.Dispose();
            }
            myPdfDocument.SaveToFile(output);
            foreach (string f in tmpFiles)
            {
                try { File.Delete(f); }
                catch (Exception) { }
            }
        }
Ejemplo n.º 10
0
        public static void getReport(string path, Entrada oE, string pathImg)
        {
            PdfDocument myPdfDocument = new PdfDocument(PdfDocumentFormat.InCentimeters(21.59, 27.94));

            PdfPage newPdfPage = myPdfDocument.NewPage();

            // This will load the image without placing into the document. The good thing
            // is that the image will be written into the document just once even if we put it
            // more times and in different sizes and places!
            PdfImage LogoImage = myPdfDocument.NewImage(pathImg);

            //// now we start putting the logo into the right place with a high resoluton...
            newPdfPage.Add(LogoImage, 10, 20, 300);

            setHeader(myPdfDocument, newPdfPage, oE);
            setBody(myPdfDocument, newPdfPage, oE);
            setFooter(myPdfDocument, newPdfPage, oE);

            try
            {
                newPdfPage.SaveToDocument();
                myPdfDocument.SaveToFile(path);
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 11
0
        private string createPDFReport(string htmlReport, string airline)
        {
            string htmlFileDir = createHTMLFileReport(htmlReport, airline);
            // create a new pdf document
            PdfDocument doc = new PdfDocument();

            // add a new page to the document
            PdfPage page = doc.AddPage();


            // create html element
            PdfHtmlElement html = new PdfHtmlElement(htmlFileDir);

            // add the html element to the document
            page.Add(html);

            // save pdf document
            string myTempFile = Path.Combine(Path.GetTempPath(), airline + "Flights.pdf");

            //Stream stream=new MemoryStream();
            doc.Save(myTempFile);

            // close pdf document
            doc.Close();
            return(myTempFile);
        }
Ejemplo n.º 12
0
        private static void setHeader(PdfDocument PdfDocument, PdfPage PdfPage, Entrada oE)
        {
            PdfTextArea taBodega = new PdfTextArea(new Font("Verdana", 24, FontStyle.Regular), Color.Black
                                                   , new PdfArea(PdfDocument, 0, 20, 590, 65), ContentAlignment.MiddleRight, "Bodega: " + oE.PBodega.Nombre + "\nCortina: " + oE.PCortina.Nombre);

            PdfPage.Add(taBodega);

            PdfTextArea taTitleEntrada = new PdfTextArea(new Font("Verdana", 24, FontStyle.Regular), Color.Black
                                                         , new PdfArea(PdfDocument, 0, 70, 590, 30), ContentAlignment.MiddleCenter, "Entrada de Almacén");

            PdfPage.Add(taTitleEntrada);

            PdfTextArea taFolio = new PdfTextArea(new Font("Verdana", 18, FontStyle.Regular), Color.Black
                                                  , new PdfArea(PdfDocument, 0, 105, 590, 20), ContentAlignment.MiddleRight, "Folio: " + oE.Folio + oE.Folio_indice);

            PdfPage.Add(taFolio);
        }
Ejemplo n.º 13
0
        private void AddLogoTASPrincipio(PdfPage page)
        {
            PdfImage image = Function_Library.TAS_Logo(pdfDocument);

            if (image != null)
            {
                page.Add(image, 375, 20, 450);
            }
        }
Ejemplo n.º 14
0
        private void AddLogoTASPortada(int x, int y, PdfPage page)
        {
            PdfImage LogoImage = Function_Library.TAS_Logo(pdfDocument);

            if (LogoImage != null)
            {
                page.Add(LogoImage, x, y, 220);
            }
        }
Ejemplo n.º 15
0
 private void ProcessLine(PdfPage page, Com.Delta.Print.Engine.Line line)
 {
     try
     {
         PdfLine pdfLine = new PdfLine(pdfDocument, new PointF((float)Convert(line.Coordinates[0].X), (float)Convert(line.Coordinates[0].Y)), new PointF((float)Convert(line.Coordinates[1].X), (float)Convert(line.Coordinates[1].Y)), line.Color, Convert(line.LineWidth));
         page.Add(pdfLine);
     }
     catch (Exception) {}
 }
Ejemplo n.º 16
0
        private void AddLogoAlFinal(PdfPage page)
        {
            PdfImage image = Function_Library.Logo(pdfDocument);

            if (image != null)
            {
                page.Add(image, 230, 750, 400);
            }
        }
Ejemplo n.º 17
0
        private void AddLeyenda(int yPos, PdfPage page, params string[] leyendas)
        {
            var colores = new[]
            { FunctionLibrary.ChartBarColorBlue, FunctionLibrary.ChartBarColorRed, FunctionLibrary.ChartBarColorGreen };

            for (int i = 0; i < leyendas.Length && i < 3; i++)
            {
                var lArea = new PdfArea(pdfDocument, 410, yPos + i * 15, 5, 5);
                var r     = new PdfRectangle(pdfDocument, lArea, colores[i], 1, colores[i]);
                var text  = new PdfTextArea(
                    Function_Library.FontTexto09,
                    Color.Black,
                    new PdfArea(pdfDocument, 425, (yPos - 2) + i * 15, 100, 20),
                    ContentAlignment.TopLeft,
                    leyendas[i]);
                page.Add(r);
                page.Add(text);
            }
        }
Ejemplo n.º 18
0
        private void AddConclusiones(int y, PdfPage page)
        {
            var text = new PdfTextArea(
                Function_Library.FontTitulo,
                Color.Black,
                new PdfArea(pdfDocument, 80, y, 450, 20),
                ContentAlignment.MiddleLeft,
                PDF_Resources.Title_Conclusiones);

            page.Add(text);
            var textConlusiones = new PdfTextArea(
                Function_Library.FontTexto11,
                Color.Black,
                new PdfArea(pdfDocument, 80, y + 10, 450, 80),
                ContentAlignment.MiddleLeft,
                this.datos.Orientaciones.Conclusiones);

            page.Add(textConlusiones);
        }
Ejemplo n.º 19
0
        private PdfDocument CreatePdfWithImageFile(string fullName, string name)
        {
            PdfDocument doc  = new PdfDocument();
            PdfPage     page = doc.AddPage();
            PdfFont     font = doc.AddFont(PdfStandardFont.Helvetica);

            font.Size = 12;

            PdfRenderingResult result;

            PdfTextElement text = new PdfTextElement(0, 0, name, font);

            result = page.Add(text);
            PdfImageElement img = new PdfImageElement(0, result.PdfPageLastRectangle.Bottom + 50, fullName);

            result = page.Add(img);

            return(doc);
        }
Ejemplo n.º 20
0
        private void ProcessBox(PdfPage page, Com.Delta.Print.Engine.Box box)
        {
            try
            {
                if (box.FillStyle == Box.FillStyles.Solid)
                {
                    PdfArea area = new PdfArea(pdfDocument, Convert(box.Bounds.X), Convert(box.Bounds.Y), Convert(box.Bounds.Width), Convert(box.Bounds.Height));

                    if (box.BorderWidth > 0 || box.Color != Color.Transparent)
                    {
                        PdfRectangle pdfBox = new PdfRectangle(pdfDocument, area, box.BorderColor, box.BorderWidth, box.Color);
                        page.Add(pdfBox);
                    }
                }
                else
                {
                    int      boxHash = box.GetHashCode();
                    PdfImage image   = null;
                    if (images.Contains(boxHash))
                    {
                        image = pdfDocument.GetObject((int)images[boxHash]) as PdfImage;
                    }
                    else
                    {
                        if (box.Color != Color.Transparent && box.GradientColor != Color.Transparent)
                        {
                            image = new PdfImage(pdfDocument.GetNextId, box.Image, false);
                        }
                        else
                        {
                            image = pdfDocument.NewImage(box.Image);
                        }
                        images[boxHash] = image.PublicID;
                    }

                    image.Width  = Convert(box.Width);
                    image.Height = Convert(box.Height);

                    page.Add(image, Convert(box.Bounds.X), Convert(box.Bounds.Y), Convert(box.Bounds.Width), Convert(box.Bounds.Height));
                }
            }
            catch (Exception e) {}
        }
Ejemplo n.º 21
0
        public void GenerateUsingText(string saveAs, RichTextBox inText)
        {
            try
            {
                PdfDocument myPdfDocument = new PdfDocument(PdfDocumentFormat.InCentimeters(21, 29.7));
                PdfImage    LogoImage     = myPdfDocument.NewImage(@"logo.jpg");
                PdfPage     newPdfPage    = null;
                int         lineNo        = 1;
                string      text          = "";
                PdfTextArea ptasubtext    = null;
                for (int i = 0; i < inText.Lines.Length; i++, lineNo++)
                {
                    if (i % 50 == 0)
                    {
                        newPdfPage = myPdfDocument.NewPage();
                        lineNo     = 1;
                    }
                    text += "\n" + inText.Lines[i];

                    if (i % 50 == 0 && i != 0)
                    {
                        newPdfPage.Add(LogoImage, 15, 10, 100);
                        ptasubtext = new PdfTextArea(new Font("Verdana", 12, FontStyle.Bold), Color.Black
                                                     , new PdfArea(myPdfDocument, 18, 120, 400, 930), ContentAlignment.TopLeft, text);
                        newPdfPage.Add(ptasubtext);
                        newPdfPage.SaveToDocument();
                        text = "";
                    }
                }

                newPdfPage = myPdfDocument.NewPage();
                newPdfPage.Add(LogoImage, 15, 10, 100);
                ptasubtext = new PdfTextArea(new Font("Verdana", 12, FontStyle.Bold), Color.Black
                                             , new PdfArea(myPdfDocument, 18, 120, 400, 930), ContentAlignment.TopLeft, text);
                newPdfPage.Add(ptasubtext);
                newPdfPage.SaveToDocument();

                myPdfDocument.SaveToFile(saveAs);
                MessageBox.Show("PDF Saved.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex) { }
        }
Ejemplo n.º 22
0
        private void AddTextoPrincipal(PdfPage page)
        {
            var text = new PdfTextArea(
                Function_Library.FontTexto11,
                Color.Black,
                new PdfArea(pdfDocument, 80, 650, 450, 80),
                ContentAlignment.MiddleLeft,
                PDF_Resources.TextoPrincipal);

            page.Add(text);
        }
Ejemplo n.º 23
0
        private void ProcessRichTextField(PdfPage page, Com.Delta.Print.Engine.RichTextField richTextField)
        {
            try
            {
                PdfArea area = new PdfArea(pdfDocument, Convert(richTextField.Bounds.X), Convert(richTextField.Bounds.Y), Convert(richTextField.Bounds.Width), Convert(richTextField.Bounds.Height));

                if ((richTextField.BorderWidth > 0 && richTextField.BorderColor != Color.Transparent) || richTextField.BackgroundColor != Color.Transparent)
                {
                    PdfRectangle border = new PdfRectangle(pdfDocument, area, richTextField.BorderColor, Convert(richTextField.BorderWidth), richTextField.BackgroundColor);
                    page.Add(border);
                }

                PdfRichTextBox p = new PdfRichTextBox(pdfDocument, (int)Convert(richTextField.Bounds.X + richTextField.Padding), (int)Convert(richTextField.Bounds.Y + richTextField.Padding), (int)Convert(richTextField.Bounds.Width - 2 * richTextField.Padding), (int)Convert(richTextField.Bounds.Height - 2 * richTextField.Padding));
                p.SetLines(new ArrayList(richTextField.lines));

                page.Add(p);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
            }
        }
Ejemplo n.º 24
0
        private void ProcessTextField(PdfPage page, Com.Delta.Print.Engine.TextField textField)
        {
            try
            {
                //PdfArea area = new PdfArea(pdfDocument, Convert(textField.X), Convert(textField.Y), Convert(textField.Width), Convert(textField.Height));
                PdfArea area = new PdfArea(pdfDocument, Convert(textField.Bounds.X), Convert(textField.Bounds.Y), Convert(textField.Bounds.Width), Convert(textField.Bounds.Height));

                if ((textField.BorderWidth > 0 && textField.BorderColor != Color.Transparent) || textField.BackgroundColor != Color.Transparent)
                {
                    PdfRectangle border = new PdfRectangle(pdfDocument, area, textField.BorderColor, textField.BorderWidth, textField.BackgroundColor);
                    page.Add(border);
                }

                string content = textField.CurrentText.Replace("\r", "");

                if (content != String.Empty)
                {
                    //PdfArea textArea = new PdfArea(pdfDocument, Convert(textField.X + textField.Padding), Convert(textField.Y + textField.Padding), Convert(textField.Width - 2*textField.Padding), Convert(textField.Height - 2*textField.Padding));
                    PdfArea textArea = new PdfArea(pdfDocument, Convert(textField.Bounds.X + textField.Padding), Convert(textField.Bounds.Y + textField.Padding), Convert(textField.Bounds.Width - 2 * textField.Padding), Convert(textField.Bounds.Height - 2 * textField.Padding));

                    float ratio = 96f / textField.Section.Document.GetGraphics().DpiX;

                    PdfTextArea pdfTextArea = new PdfTextArea(textField.Font, textField.ForegroundColor, textArea, GetTextHorizontalAlignment(textField.TextAlignment), GetTextVerticalAlignment(textField.TextVerticalAlignment), content, textField.TextOrientation == TextField.Orientation.Vertical);

                    pdfTextArea.Underline = textField.Font.Underline;
                    pdfTextArea.SetFontRatio(ratio);
                    pdfTextArea.SetLineSpacing(Convert(textField.Spacing));
                    if (textField.TextAlignment == TextField.TextAlignmentType.Justified)
                    {
                        pdfTextArea.SetJustification(textField.Justification);
                    }

                    page.Add(pdfTextArea);
                }
            }
            catch (Exception e) {}
        }
Ejemplo n.º 25
0
        private void AddTablaPrincipal(PdfPage page)
        {
            var dataTable = new DataTable();

            dataTable.Columns.Add(PDF_Resources.Header_Parametro);
            dataTable.Columns.Add(PDF_Resources.Header_Puntaje);
            dataTable.Columns.Add(PDF_Resources.Header_Percentil);
            dataTable.Columns.Add(PDF_Resources.Header_Orientacion);

            int rows    = datos.TNotaciones.Parametros.Length;
            int columns = dataTable.Columns.Count;

            PdfTable myPdfTable = pdfDocument.NewTable(Function_Library.FontTexto11, rows, columns, 3);

            var str_orientacion = new[]
            {
                datos.Orientaciones.O_indice_atencion_total,
                //datos.O_Error_estandar_IA,
                datos.Orientaciones.O_Aciertos,
                datos.Orientaciones.O_Omision,
                datos.Orientaciones.O_Comision,
                datos.Orientaciones.O_TR,
                datos.Orientaciones.O_ErrorTR,
                datos.Orientaciones.O_d,
                datos.Orientaciones.O_C
            };

            for (int i = 0; i < datos.TNotaciones.Parametros.Length; i++)
            {
                DataRow row = dataTable.NewRow();
                row[PDF_Resources.Header_Parametro]   = datos.TNotaciones.Parametros[i];
                row[PDF_Resources.Header_Puntaje]     = FunctionLibrary.ShowDouble(datos.Puntuaciones[i]);
                row[PDF_Resources.Header_Percentil]   = (i >= 6 && i <= 7) ? string.Empty : FunctionLibrary.ShowDouble(datos.TNotaciones[i]);
                row[PDF_Resources.Header_Orientacion] = str_orientacion[i];
                dataTable.Rows.Add(row);
            }

            myPdfTable.ImportDataTable(dataTable);
            myPdfTable.HeadersRow.SetColors(Color.Black, Color.FromArgb(229, 229, 229));
            myPdfTable.SetColors(Color.Black, Color.White);
            myPdfTable.SetBorders(Color.Black, 1, BorderType.CompleteGrid);
            myPdfTable.SetColumnsWidth(new[] { 35, 12, 12, 41 });
            myPdfTable.SetContentAlignment(ContentAlignment.TopLeft);
            myPdfTable.HeadersRow[0].SetContent(string.Empty);
            myPdfTable.Columns[0].SetBackgroundColor(Color.FromArgb(242, 242, 242));
            PdfTablePage newPdfTablePage = myPdfTable.CreateTablePage(new PdfArea(pdfDocument, 80, 480, 450, 420));

            page.Add(newPdfTablePage);
        }
Ejemplo n.º 26
0
        private void ProcessElipse(PdfPage page, Com.Delta.Print.Engine.Elipse elipse)
        {
            try
            {
                if (elipse.FillStyle == Elipse.FillStyles.Solid)
                {
                    if (elipse.BorderWidth > 0 || elipse.Color != Color.Transparent)
                    {
                        PdfCircle pdfCircle = new PdfCircle(Convert(elipse.Bounds.X), Convert(elipse.Bounds.Y), elipse.Color, elipse.BorderColor, elipse.BorderWidth);
                        pdfCircle.AxesArea = new PdfArea(pdfDocument, Convert(elipse.Bounds.X), Convert(elipse.Bounds.Y), Convert(elipse.Bounds.Width), Convert(elipse.Bounds.Height));

                        page.Add(pdfCircle);
                    }
                }
                else
                {
                    int      elipseHash = elipse.GetHashCode();
                    PdfImage image      = null;
                    if (images.Contains(elipseHash))
                    {
                        image = pdfDocument.GetObject((int)images[elipseHash]) as PdfImage;
                    }
                    else
                    {
                        image = pdfDocument.NewImage(elipse.Image);
                        images[elipseHash] = image.PublicID;
                    }

                    image.Width  = Convert(elipse.Bounds.Width);
                    image.Height = Convert(elipse.Bounds.Height);

                    page.Add(image, Convert(elipse.Bounds.X), Convert(elipse.Bounds.Y), Convert(elipse.Bounds.Width), Convert(elipse.Bounds.Height));
                }
            }
            catch (Exception e) {}
        }
Ejemplo n.º 27
0
        private void AddGraficoPercentiles(int y, PdfPage page)
        {
            var text = new PdfTextArea(
                Function_Library.FontTitulo,
                Color.Black,
                new PdfArea(pdfDocument, 80, y, 450, 20),
                ContentAlignment.MiddleCenter,
                PDF_Resources.Title_GraficosResultadosGenerales);

            page.Add(text);

            var      chart   = new Ar_Chart(ChartReportClass.PERCENTILES, 1000, 650, datos.TNotaciones.ChR_TNotaciones);
            PdfImage grafico = Function_Library.ToPDFImage(chart.ToBinary(), pdfDocument);

            if (grafico != null)
            {
                page.Add(grafico, 55, y + 25, 170);
            }

            var lArea = new PdfArea(pdfDocument, 55, y + 20, 490, 280);
            var r     = new PdfRectangle(pdfDocument, lArea, Color.LightGray);

            page.Add(r);
        }
Ejemplo n.º 28
0
        private void AddGraficoErrores(int y, PdfPage page)
        {
            var text = new PdfTextArea(
                Function_Library.FontTitulo,
                Color.Black,
                new PdfArea(pdfDocument, 80, y, 450, 20),
                ContentAlignment.MiddleCenter,
                PDF_Resources.Title_GraficoErrores);

            page.Add(text);
            var      chart   = new Ar_Chart(ChartReportClass.ERRORES, 1000, 600, datos.ChR_Errores);
            PdfImage grafico = Function_Library.ToPDFImage(chart.ToBinary(), pdfDocument);

            if (grafico != null)
            {
                page.Add(grafico, 55, y + 25, 200);
            }
            AddLeyenda(y + 95, page, PDF_Resources.Leyend_EComision, PDF_Resources.Leyend_EOmision, PDF_Resources.Leyend_IA);

            var lArea = new PdfArea(pdfDocument, 55, y + 20, 490, 250);
            var r     = new PdfRectangle(pdfDocument, lArea, Color.LightGray);

            page.Add(r);
        }
Ejemplo n.º 29
0
        private void ProcessUserPaint(PdfPage page, Com.Delta.Print.Engine.UserPaint userPaint)
        {
            try
            {
                PdfImage image = pdfDocument.NewImage(userPaint.Image);

                image.Width  = Convert(userPaint.Width);
                image.Height = Convert(userPaint.Height);

                page.Add(image, Convert(userPaint.Bounds.X), Convert(userPaint.Bounds.Y), Convert(userPaint.Bounds.Width), Convert(userPaint.Bounds.Height));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
            }
        }
Ejemplo n.º 30
0
        private void AddDatosPersonales(int x, int y, PdfPage page)
        {
            const int linespace = 20;
            var       tags      = new[]
            {
                string.Format(PDF_Resources.DP_NombreFormat, this.datos.Paciente.Nombre, this.datos.Paciente.Apellido1, this.datos.Paciente.Apellido2),
                string.Format(PDF_Resources.DP_FechaNacimientoFormat, this.datos.Paciente.Fecha_Nacimiento.ToShortDateString()),
                string.Format(PDF_Resources.DP_EdadFormat, this.datos.Paciente.Edad),
                string.Format(PDF_Resources.DP_SexoFormat, this.datos.Paciente.Sexo),
                string.Format(PDF_Resources.DP_NivelFormat, this.datos.Paciente.Escolaridad),
                string.Format(PDF_Resources.DP_FechaAplicacionFormat, datos.CastResultadoForResultadoAS.Fecha.ToShortDateString())
            };

            for (int i = 0; i < tags.Length; i++)
            {
                var text = new PdfTextArea(
                    Function_Library.FontTexto11,
                    Color.Black,
                    new PdfArea(pdfDocument, x, y + i * linespace, 450, 20),
                    ContentAlignment.MiddleLeft,
                    tags[i]);
                page.Add(text);
            }
        }
Ejemplo n.º 31
0
        public PdfPage GetPage()
        {
            PdfPage page = new PdfPage();
            page.Resources = new PdfDictionary();
            page.Ref = NextRef;
            page.Add("Type", "/Page");
            page.Add("Parent", string.Format("{0} 0 R", Pages.Ref));
            page.Add("Contents", "");
            //TODO: Hard coded A4 - Do this properly
            //page.Add("MediaBox", "[0 0 595.27 841.88]");
            page.Add("MediaBox", "[0 0 133.22 189.92]");

            //PageList.Add(page);
            return page;
        }