private iTextSharp.text.Table Obtener_Titulo(String pNro_Solicitud)
 {
     iTextSharp.text.Table tbTitulo = null;
     iTextSharp.text.Cell  tdCell   = null;
     iTextSharp.text.Chunk oChunk   = null;
     // Tabla
     tbTitulo             = new iTextSharp.text.Table(1);
     tbTitulo.Width       = 90;
     tbTitulo.Cellpadding = 1;
     tbTitulo.Cellspacing = 0;
     tbTitulo.Border      = iTextSharp.text.Rectangle.NO_BORDER;
     // Texto
     oChunk = new iTextSharp.text.Chunk("SOLICITUD DE ATENCIÓN MÚLTIPLE", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 12, iTextSharp.text.Font.BOLD, new iTextSharp.text.Color(0, 0, 0)));
     // Celda > Título
     tdCell        = new iTextSharp.text.Cell(oChunk);
     tdCell.Header = false;
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbTitulo.AddCell(tdCell);
     // Texto
     oChunk = new iTextSharp.text.Chunk(String.Format("Nro.: {0}", pNro_Solicitud), iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 12, iTextSharp.text.Font.BOLD, new iTextSharp.text.Color(0, 0, 0)));
     // Celda > Nro
     tdCell        = new iTextSharp.text.Cell(oChunk);
     tdCell.Header = false;
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbTitulo.AddCell(tdCell);
     //
     return(tbTitulo);
 }
        private iTextSharp.text.Table Obtener_Pie(FirmaElectronicaModel oFirmaElectronicaModel)
        {
            String[] strArreglo          = null;
            iTextSharp.text.Table tbPie  = null;
            iTextSharp.text.Cell  tdCell = null;
            iTextSharp.text.Chunk oChunk = null;
            //
            tbPie                = new iTextSharp.text.Table(1);
            tbPie.Width          = 90;
            tbPie.Cellpadding    = 0;
            tbPie.Cellspacing    = 0;
            tbPie.Border         = iTextSharp.text.Rectangle.NO_BORDER;
            tbPie.BorderWidthTop = (float)1;
            // Footer

            oChunk = new iTextSharp.text.Chunk("Be careful! In Oracle, TIMESTAMP means a datatype, similar to but distinct from DATE. You'll avoid confusion if you don't use the word  to mean anything else.", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
            tdCell = new iTextSharp.text.Cell(oChunk);
            tdCell.HorizontalAlignment = iTextSharp.text.Rectangle.ALIGN_JUSTIFIED;
            tdCell.VerticalAlignment   = iTextSharp.text.Rectangle.ALIGN_BASELINE;
            tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
            tbPie.AddCell(tdCell);

            //
            return(tbPie);
        }
 private iTextSharp.text.Table Obtener_Cuenta(FirmaElectronicaModel oFirmaElectronicaModel)
 {
     iTextSharp.text.Table tbCuenta = null;
     iTextSharp.text.Cell  tdCell   = null;
     iTextSharp.text.Chunk oChunk   = null;
     // Tabla
     tbCuenta        = new iTextSharp.text.Table(4);
     tbCuenta.Widths = new float[4] {
         20, 25, 20, 25
     };
     tbCuenta.Width       = 90;
     tbCuenta.Cellpadding = 1;
     tbCuenta.Cellspacing = 0;
     tbCuenta.Border      = iTextSharp.text.Rectangle.NO_BORDER;
     // Sub-Título
     oChunk                     = new iTextSharp.text.Chunk(" Datos de la Cuenta", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 12, iTextSharp.text.Font.BOLD, new iTextSharp.text.Color(255, 255, 255)));
     tdCell                     = new iTextSharp.text.Cell(oChunk);
     tdCell.Header              = true;
     tdCell.Colspan             = 4;
     tdCell.HorizontalAlignment = iTextSharp.text.Rectangle.ALIGN_LEFT;
     tdCell.BackgroundColor     = new iTextSharp.text.Color(66, 139, 202);
     tdCell.Border              = iTextSharp.text.Rectangle.NO_BORDER;
     tbCuenta.AddCell(tdCell);
     tdCell                 = new iTextSharp.text.Cell(String.Empty);
     tdCell.Colspan         = 4;
     tdCell.BackgroundColor = new iTextSharp.text.Color(66, 139, 202);
     tdCell.Border          = iTextSharp.text.Rectangle.NO_BORDER;
     tbCuenta.AddCell(tdCell);
     // Producto y Cuenta
     oChunk = new iTextSharp.text.Chunk("Producto:", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbCuenta.AddCell(tdCell);
     oChunk = new iTextSharp.text.Chunk("VISA", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbCuenta.AddCell(tdCell);
     oChunk = new iTextSharp.text.Chunk("Nro. Cuenta:", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbCuenta.AddCell(tdCell);
     oChunk = new iTextSharp.text.Chunk("544656157671165", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbCuenta.AddCell(tdCell);
     //
     return(tbCuenta);
 }
Exemplo n.º 4
0
        protected void createPDF(Stream output)
        {
            //SecondaryAntibody tempAntibody = myConn.getSecondaryAntibodyByID(Convert.ToInt16(Request.QueryString["id"]));
            SecondaryAntibody tempAntibody = myConn.getSecondaryAntibodyByID(2);

            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", "attachment; filename=secondary_antibody_" + tempAntibody.id + ".pdf");
            iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.LETTER, 72, 72, 72, 72);
            PdfWriter writer = PdfWriter.GetInstance(document, Response.OutputStream);

            document.Open();
            //Page title and spacing
            iTextSharp.text.Chunk pageTitle = new iTextSharp.text.Chunk("Secondary Antibody Record", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 20));
            document.Add(pageTitle);
            iTextSharp.text.Paragraph spacing = new iTextSharp.text.Paragraph(" ");
            document.Add(spacing);

            //Antibody Name
            iTextSharp.text.Paragraph tempParagraph = new iTextSharp.text.Paragraph();
            iTextSharp.text.Chunk     tempLabel     = new iTextSharp.text.Chunk("Antibody Name: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            iTextSharp.text.Chunk     tempValue     = new iTextSharp.text.Chunk(tempAntibody.antibodyName, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Concentration
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Concentration: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.concentration, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Excitation
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Excitation: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.excitation, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Host Species
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Host Species: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.hostSpecies, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Reactive Species
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Reactive Species: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.reactiveSpecies, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Fluorophore
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Fluorophore: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.fluorophore, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Working Dilution
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Working Dilution: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.workingDilution, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Lot Number
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Lot Number: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.lotNumber, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Antigen
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Antigen: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.antigen, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Applications
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Applications: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempAntibody.applications, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            document.Close();
        }
Exemplo n.º 5
0
        void ExportReport(iTextSharp.text.Document doc, DataTable dt)
        {
            iTextSharp.text.pdf.draw.LineSeparator line = new iTextSharp.text.pdf.draw.LineSeparator(2f, 100f, iTextSharp.text.BaseColor.BLACK, iTextSharp.text.Element.ALIGN_CENTER, -1);
            iTextSharp.text.Chunk linebreak             = new iTextSharp.text.Chunk(line);
            iTextSharp.text.Font  black = new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.COURIER, 9f, iTextSharp.text.Font.NORMAL, iTextSharp.text.BaseColor.BLACK);
            var logo = new iTextSharp.text.Paragraph()
            {
                Alignment = 0
            };

            logo.Add(new iTextSharp.text.Chunk("Tachyon", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 36, iTextSharp.text.Font.BOLD, iTextSharp.text.BaseColor.BLACK)));
            logo.Add(new iTextSharp.text.Chunk("FIX", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 36, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(26, 188, 156))));
            doc.Add(logo);
            doc.Add(new iTextSharp.text.Chunk(line));
            doc.Add(new iTextSharp.text.Paragraph(new iTextSharp.text.Chunk(ConcatStrings("Log List", DateTime.Now.ToString()), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.COURIER, 9f, iTextSharp.text.Font.BOLD, iTextSharp.text.BaseColor.BLACK)))
            {
                Alignment = 0
            });

            doc.Add(new iTextSharp.text.Paragraph(new iTextSharp.text.Chunk(" ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.COURIER, 9f, iTextSharp.text.Font.BOLD, iTextSharp.text.BaseColor.BLACK)))
            {
                Alignment = 0
            });

            doc.Add(linebreak);
            doc.Add(new iTextSharp.text.Paragraph(" "));

            var bf = BaseFont.CreateFont(Environment.CurrentDirectory + @"\arial.ttf", BaseFont.IDENTITY_H, true);

            iTextSharp.text.Font NormalFont = new iTextSharp.text.Font(bf, 12, iTextSharp.text.Font.NORMAL, iTextSharp.text.BaseColor.BLACK);
            iTextSharp.text.Font TFont      = new iTextSharp.text.Font(bf, 12, iTextSharp.text.Font.NORMAL, iTextSharp.text.BaseColor.GREEN);
            iTextSharp.text.Font XFont      = new iTextSharp.text.Font(bf, 12, iTextSharp.text.Font.NORMAL, iTextSharp.text.BaseColor.RED);

            PdfPTable table = new PdfPTable(dt.Columns.Count)
            {
                WidthPercentage = 100
            };

            for (int i = 0; i < dt.Columns.Count; i++)
            {
                table.AddCell(new PdfPCell()
                {
                    Phrase = new iTextSharp.text.Phrase(dt.Columns[i].ColumnName), BackgroundColor = iTextSharp.text.BaseColor.GRAY
                });
            }



            //table.SetWidths(new float[] { 3, 25, 25, 8 });

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ReportProgress((i / (double)dt.Rows.Count) * 100, "Exporting Rows...");
                DataRow GridRow = dt.Rows[i];
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    table.AddCell(new iTextSharp.text.Phrase(GridRow.ItemArray[j].ToString(), NormalFont));
                }
            }

            doc.Add(table);
        }
        protected void Exportchart(ArrayList chart)
        {
            string uid = Session["UserID"].ToString();
            MemoryStream msReport = new MemoryStream();

            try
            {
                document = new iTextSharp.text.Document(iTextSharp.text.PageSize.LETTER, 72, 72, 82, 72);
                iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(document, msReport);
                document.AddAuthor("Test");
                document.AddSubject("Export to PDF");
                document.Open();

                for (int i = 0; i < chart.Count; i++)
                {
                    iTextSharp.text.Chunk c = new iTextSharp.text.Chunk("Export chart to PDF", iTextSharp.text.FontFactory.GetFont("VERDANA", 15));
                    iTextSharp.text.Paragraph p = new iTextSharp.text.Paragraph();
                    p.Alignment = iTextSharp.text.Element.ALIGN_CENTER;
                    iTextSharp.text.Image hImage = null;
                    hImage = iTextSharp.text.Image.GetInstance(MapPath(chart[i].ToString()));

                    float NewWidth = 500;
                    float MaxHeight = 400;

                    if (hImage.Width <= NewWidth) { NewWidth = hImage.Width; } float NewHeight = hImage.Height * NewWidth / hImage.Width; if (NewHeight > MaxHeight)
                    {
                        NewWidth = hImage.Width * MaxHeight / hImage.Height;
                        NewHeight = MaxHeight;
                    }

                    float ratio = hImage.Width / hImage.Height;
                    hImage.ScaleAbsolute(NewWidth, NewHeight);
                    document.Add(p);
                    document.Add(hImage);
                }
                // close it
                document.Close();
                string filename = "Appraisal Overview for " + Session["Name"].ToString() + ".pdf";
                Response.AddHeader("Content-type", "application/pdf");
                Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
                Response.OutputStream.Write(msReport.GetBuffer(), 0, msReport.GetBuffer().Length);

            }
            catch (System.Threading.ThreadAbortException ex)
            {
                throw new Exception("Error occured: " + ex);
            }
        }
Exemplo n.º 7
0
        protected void createPDF(Stream output)
        {
            //Construct tempConstruct = myConn.getConstructByID(Convert.ToInt16(Request.QueryString["id"]));
            Construct tempConstruct = myConn.getConstructByID(2);
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", "attachment; filename=construct_" + tempConstruct.id + ".pdf");
            iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.LETTER, 72, 72, 72, 72);
            PdfWriter writer = PdfWriter.GetInstance(document, Response.OutputStream);
            document.Open();
            //Page title and spacing
            iTextSharp.text.Chunk pageTitle = new iTextSharp.text.Chunk("Construct Record", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 20));
            document.Add(pageTitle);
            iTextSharp.text.Paragraph spacing = new iTextSharp.text.Paragraph(" ");
            document.Add(spacing);

            //Name
            iTextSharp.text.Paragraph tempParagraph = new iTextSharp.text.Paragraph();
            iTextSharp.text.Chunk tempLabel = new iTextSharp.text.Chunk("Construct Name: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            iTextSharp.text.Chunk tempValue = new iTextSharp.text.Chunk(tempConstruct.name, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Insert
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Insert: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempConstruct.insert, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Vector
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Vector: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempConstruct.vector, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Species
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Species: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempConstruct.species, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Antibiotic Resistance
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Antibiotic Resistance: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempConstruct.antibioticResistance, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //5' Digest Site
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("5' Digest Site: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempConstruct.digestSite5, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //3' Digest Site
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Working Dilution: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempConstruct.digestSite3, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Notes
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Notes: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempConstruct.notes, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            document.Close();
        }
Exemplo n.º 8
0
        protected void createPDF(Stream output)
        {
            //Vector tempVector = myConn.getVectorByID(Convert.ToInt16(Request.QueryString["id"]));
            Vector tempVector = myConn.getVectorByID(2);
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", "attachment; filename=vector_" + tempVector.id + ".pdf");
            iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.LETTER, 72, 72, 72, 72);
            PdfWriter writer = PdfWriter.GetInstance(document, Response.OutputStream);
            document.Open();
            //Page title and spacing
            iTextSharp.text.Chunk pageTitle = new iTextSharp.text.Chunk("Vector Record", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 20));
            document.Add(pageTitle);
            iTextSharp.text.Paragraph spacing = new iTextSharp.text.Paragraph(" ");
            document.Add(spacing);

            //Name
            iTextSharp.text.Paragraph tempParagraph = new iTextSharp.text.Paragraph();
            iTextSharp.text.Chunk tempLabel = new iTextSharp.text.Chunk("Vector Name: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            iTextSharp.text.Chunk tempValue = new iTextSharp.text.Chunk(tempVector.vectorName, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Multiple Cloning Site
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Multiple Cloning Site: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempVector.multipleCloningSite, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Antibiotic Resistance
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Antibiotic Resistance: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempVector.antibioticResistance, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Vector Size
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Vector Size: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempVector.vectorSize, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Promoter
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Promoter: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempVector.promoter, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Notes
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Notes: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempVector.notes, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            document.Close();
        }
Exemplo n.º 9
0
        protected void createPDF(Stream output)
        {
            //Vector tempVector = myConn.getVectorByID(Convert.ToInt16(Request.QueryString["id"]));
            Vector tempVector = myConn.getVectorByID(2);

            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", "attachment; filename=vector_" + tempVector.id + ".pdf");
            iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.LETTER, 72, 72, 72, 72);
            PdfWriter writer = PdfWriter.GetInstance(document, Response.OutputStream);

            document.Open();
            //Page title and spacing
            iTextSharp.text.Chunk pageTitle = new iTextSharp.text.Chunk("Vector Record", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 20));
            document.Add(pageTitle);
            iTextSharp.text.Paragraph spacing = new iTextSharp.text.Paragraph(" ");
            document.Add(spacing);

            //Name
            iTextSharp.text.Paragraph tempParagraph = new iTextSharp.text.Paragraph();
            iTextSharp.text.Chunk     tempLabel     = new iTextSharp.text.Chunk("Vector Name: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            iTextSharp.text.Chunk     tempValue     = new iTextSharp.text.Chunk(tempVector.vectorName, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Multiple Cloning Site
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Multiple Cloning Site: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempVector.multipleCloningSite, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Antibiotic Resistance
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Antibiotic Resistance: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempVector.antibioticResistance, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Vector Size
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Vector Size: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempVector.vectorSize, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Promoter
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Promoter: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempVector.promoter, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Notes
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Notes: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempVector.notes, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            document.Close();
        }
 private void FormatImgInChunks(List<iTextSharp.text.Chunk> chunks)
 {
     for (int i = 0; i < chunks.Count; i++ )
     {
         if (chunks[i].Chunks.Count > 1)
         {
             FormatImgInChunks(chunks[i].Chunks.ToList());
         }
         else if (chunks[i].Role == PdfName.FIGURE)
         {
             var img = chunks[i].GetImage();
             img.ScaleAbsolute(100f, 100f);
             iTextSharp.text.Chunk imgChunk = new iTextSharp.text.Chunk(img, 120f, 120f);
             chunks.RemoveAt(i);
             chunks.Insert(i, imgChunk);
         }
     }
 }
 private iTextSharp.text.Table Obtener_Firma()
 {
     iTextSharp.text.Table tbFirma = null;
     iTextSharp.text.Cell  tdCell  = null;
     iTextSharp.text.Chunk oChunk  = null;
     // Tabla
     tbFirma        = new iTextSharp.text.Table(3);
     tbFirma.Widths = new float[3] {
         25, 30, 25
     };
     tbFirma.Width             = 80;;
     tbFirma.Cellpadding       = 1;
     tbFirma.Cellspacing       = 0;
     tbFirma.Alignment         = iTextSharp.text.Element.ALIGN_CENTER;
     tbFirma.Border            = 1;
     tbFirma.BorderWidth       = (float)1;
     tbFirma.BorderWidthBottom = (float)1;
     tbFirma.BorderWidthLeft   = (float)1;
     tbFirma.BorderWidthRight  = (float)1;
     //
     oChunk        = new iTextSharp.text.Chunk("A", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 10, iTextSharp.text.Color.WHITE));
     tdCell        = new iTextSharp.text.Cell(oChunk);
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbFirma.AddCell(tdCell);
     tdCell                  = new iTextSharp.text.Cell(String.Empty);
     tdCell.Border           = iTextSharp.text.Rectangle.NO_BORDER;
     tdCell.BorderWidthLeft  = (float)1;
     tdCell.BorderWidthRight = (float)1;
     tbFirma.AddCell(tdCell);
     tdCell        = new iTextSharp.text.Cell(String.Empty);
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbFirma.AddCell(tdCell);
     oChunk        = new iTextSharp.text.Chunk("B", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 10, iTextSharp.text.Color.WHITE));
     tdCell        = new iTextSharp.text.Cell(oChunk);
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbFirma.AddCell(tdCell);
     tdCell                  = new iTextSharp.text.Cell(String.Empty);
     tdCell.Border           = iTextSharp.text.Rectangle.NO_BORDER;
     tdCell.BorderWidthLeft  = (float)1;
     tdCell.BorderWidthRight = (float)1;
     tbFirma.AddCell(tdCell);
     tdCell        = new iTextSharp.text.Cell(String.Empty);
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbFirma.AddCell(tdCell);
     oChunk = new iTextSharp.text.Chunk("V°B° Autorizador", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.BOLD, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbFirma.AddCell(tdCell);
     oChunk = new iTextSharp.text.Chunk("Firma y sello del Asesor de Servicio", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.BOLD, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER;
     tdCell.Border           = iTextSharp.text.Rectangle.NO_BORDER;
     tdCell.BorderWidthLeft  = (float)1;
     tdCell.BorderWidthRight = (float)1;
     tbFirma.AddCell(tdCell);
     oChunk = new iTextSharp.text.Chunk("Firma del cliente", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.BOLD, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbFirma.AddCell(tdCell);
     tdCell        = new iTextSharp.text.Cell(String.Empty);
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbFirma.AddCell(tdCell);
     tdCell                  = new iTextSharp.text.Cell(String.Empty);
     tdCell.Border           = iTextSharp.text.Rectangle.NO_BORDER;
     tdCell.BorderWidthLeft  = (float)1;
     tdCell.BorderWidthRight = (float)1;
     tbFirma.AddCell(tdCell);
     tdCell        = new iTextSharp.text.Cell(String.Empty);
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbFirma.AddCell(tdCell);
     //
     return(tbFirma);
 }
        private iTextSharp.text.Table Obtener_Solicitud(FirmaElectronicaModel oFirmaElectronicaModel, String pUsuario)
        {
            Boolean boFlag_Titular = false, boFlag_Adicional = false;

            iTextSharp.text.Table tbSolicitud = null;
            iTextSharp.text.Cell  tdCell      = null;
            iTextSharp.text.Chunk oChunk      = null;
            // Tabla
            tbSolicitud        = new iTextSharp.text.Table(4);
            tbSolicitud.Widths = new float[4] {
                20, 25, 20, 25
            };
            tbSolicitud.Width       = 90;
            tbSolicitud.Cellpadding = 1;
            tbSolicitud.Cellspacing = 0;
            tbSolicitud.Border      = iTextSharp.text.Rectangle.NO_BORDER;

            #region "Solicitud > Superior"
            // Sub-Título
            oChunk                     = new iTextSharp.text.Chunk(" Datos de la Solicitud", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 12, iTextSharp.text.Font.BOLD, new iTextSharp.text.Color(255, 255, 255)));
            tdCell                     = new iTextSharp.text.Cell(oChunk);
            tdCell.Header              = true;
            tdCell.Colspan             = 4;
            tdCell.HorizontalAlignment = iTextSharp.text.Rectangle.ALIGN_LEFT;
            tdCell.BackgroundColor     = new iTextSharp.text.Color(66, 139, 202);
            tdCell.Border              = iTextSharp.text.Rectangle.NO_BORDER;
            tbSolicitud.AddCell(tdCell);
            tdCell                 = new iTextSharp.text.Cell(String.Empty);
            tdCell.Colspan         = 4;
            tdCell.BackgroundColor = new iTextSharp.text.Color(66, 139, 202);
            tdCell.Border          = iTextSharp.text.Rectangle.NO_BORDER;
            tbSolicitud.AddCell(tdCell);
            // Fecha y Agencia
            oChunk = new iTextSharp.text.Chunk("Fecha de Solicitud:", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
            tdCell = new iTextSharp.text.Cell(oChunk);
            tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
            tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
            tbSolicitud.AddCell(tdCell);
            oChunk = new iTextSharp.text.Chunk(DateTime.Now.ToShortDateString(), iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
            tdCell = new iTextSharp.text.Cell(oChunk);
            tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
            tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
            tbSolicitud.AddCell(tdCell);
            oChunk = new iTextSharp.text.Chunk("Agencia:", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
            tdCell = new iTextSharp.text.Cell(oChunk);
            tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
            tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
            tbSolicitud.AddCell(tdCell);
            oChunk = new iTextSharp.text.Chunk("Principal", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
            tdCell = new iTextSharp.text.Cell(oChunk);
            tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
            tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
            tbSolicitud.AddCell(tdCell);
            // Tipo de Requerimiento
            oChunk = new iTextSharp.text.Chunk("Tipo de atención:", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
            tdCell = new iTextSharp.text.Cell(oChunk);
            tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
            tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
            tbSolicitud.AddCell(tdCell);
            oChunk                     = new iTextSharp.text.Chunk("Contratos", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.BOLD, new iTextSharp.text.Color(0, 0, 0)));
            tdCell                     = new iTextSharp.text.Cell(oChunk);
            tdCell.Colspan             = 3;
            tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
            tdCell.Border              = iTextSharp.text.Rectangle.NO_BORDER;
            tbSolicitud.AddCell(tdCell);
            #endregion

            return(tbSolicitud);
        }
 private iTextSharp.text.Table Obtener_Cliente(FirmaElectronicaModel oFirmaElectronicaModel)
 {
     iTextSharp.text.Table tbCliente = null;
     iTextSharp.text.Cell  tdCell    = null;
     iTextSharp.text.Chunk oChunk    = null;
     // Tabla
     tbCliente        = new iTextSharp.text.Table(4, 4);
     tbCliente.Widths = new float[4] {
         20, 25, 20, 25
     };
     tbCliente.Width       = 90;
     tbCliente.Cellpadding = 1;
     tbCliente.Cellspacing = 0;
     tbCliente.Border      = iTextSharp.text.Rectangle.NO_BORDER;
     // Sub-Título
     oChunk                     = new iTextSharp.text.Chunk(" Datos del Cliente", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.HELVETICA, 12, iTextSharp.text.Font.BOLD, new iTextSharp.text.Color(255, 255, 255)));
     tdCell                     = new iTextSharp.text.Cell(oChunk);
     tdCell.Header              = true;
     tdCell.Colspan             = 4;
     tdCell.HorizontalAlignment = iTextSharp.text.Rectangle.ALIGN_LEFT;
     tdCell.BackgroundColor     = new iTextSharp.text.Color(66, 139, 202);
     tdCell.Border              = iTextSharp.text.Rectangle.NO_BORDER;
     tbCliente.AddCell(tdCell);
     tdCell                 = new iTextSharp.text.Cell(String.Empty);
     tdCell.Colspan         = 4;
     tdCell.BackgroundColor = new iTextSharp.text.Color(66, 139, 202);
     tdCell.Border          = iTextSharp.text.Rectangle.NO_BORDER;
     tbCliente.AddCell(tdCell);
     // Documento : Tipo y Nro.
     oChunk = new iTextSharp.text.Chunk("Tipo Documento:", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbCliente.AddCell(tdCell);
     oChunk = new iTextSharp.text.Chunk("DNI", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbCliente.AddCell(tdCell);
     oChunk = new iTextSharp.text.Chunk("Nro. Documento:", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbCliente.AddCell(tdCell);
     oChunk = new iTextSharp.text.Chunk(oFirmaElectronicaModel.oPersona.DNI, iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbCliente.AddCell(tdCell);
     // Nombres y Apellidos
     oChunk = new iTextSharp.text.Chunk("Nombres:", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbCliente.AddCell(tdCell);
     oChunk = new iTextSharp.text.Chunk(String.Format("{0} {1}", oFirmaElectronicaModel.oPersona.PRI_NOMBRE.ToUpper(), (String.IsNullOrEmpty(oFirmaElectronicaModel.oPersona.SEG_NOMBRE) ? String.Empty : oFirmaElectronicaModel.oPersona.SEG_NOMBRE).ToUpper()), iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbCliente.AddCell(tdCell);
     oChunk = new iTextSharp.text.Chunk("Apellidos:", iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbCliente.AddCell(tdCell);
     oChunk = new iTextSharp.text.Chunk(String.Format("{0} {1}", oFirmaElectronicaModel.oPersona.APE_PATERNO.ToUpper(), (String.IsNullOrEmpty(oFirmaElectronicaModel.oPersona.APE_MATERNO) ? String.Empty : oFirmaElectronicaModel.oPersona.APE_MATERNO).ToUpper()), iTextSharp.text.FontFactory.GetFont(iTextSharp.text.FontFactory.TIMES_ROMAN, 10, iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(0, 0, 0)));
     tdCell = new iTextSharp.text.Cell(oChunk);
     tdCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
     tdCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
     tbCliente.AddCell(tdCell);
     //
     return(tbCliente);
 }
Exemplo n.º 14
0
        protected void createPDF(Stream output)
        {
            //Construct tempConstruct = myConn.getConstructByID(Convert.ToInt16(Request.QueryString["id"]));
            Construct tempConstruct = myConn.getConstructByID(2);

            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", "attachment; filename=construct_" + tempConstruct.id + ".pdf");
            iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.LETTER, 72, 72, 72, 72);
            PdfWriter writer = PdfWriter.GetInstance(document, Response.OutputStream);

            document.Open();
            //Page title and spacing
            iTextSharp.text.Chunk pageTitle = new iTextSharp.text.Chunk("Construct Record", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 20));
            document.Add(pageTitle);
            iTextSharp.text.Paragraph spacing = new iTextSharp.text.Paragraph(" ");
            document.Add(spacing);

            //Name
            iTextSharp.text.Paragraph tempParagraph = new iTextSharp.text.Paragraph();
            iTextSharp.text.Chunk     tempLabel     = new iTextSharp.text.Chunk("Construct Name: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            iTextSharp.text.Chunk     tempValue     = new iTextSharp.text.Chunk(tempConstruct.name, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Insert
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Insert: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempConstruct.insert, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Vector
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Vector: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempConstruct.vector, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Species
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Species: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempConstruct.species, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Antibiotic Resistance
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Antibiotic Resistance: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempConstruct.antibioticResistance, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //5' Digest Site
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("5' Digest Site: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempConstruct.digestSite5, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //3' Digest Site
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Working Dilution: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempConstruct.digestSite3, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Notes
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel     = new iTextSharp.text.Chunk("Notes: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue     = new iTextSharp.text.Chunk(tempConstruct.notes, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            document.Close();
        }
        public Boolean Obtener_Pdf_CC(String pRutaArchivo, FirmaElectronicaModel oFirmaElectronicaModel, String pImg64)
        //Fin E.Z. 13/05/2016
        {
            Boolean b_Resultado = false;

            iTextSharp.text.Document           oDocument       = null;
            iTextSharp.text.pdf.PdfWriter      oPdfWriter      = null;
            iTextSharp.text.pdf.PdfContentByte oPdfContentByte = null;
            iTextSharp.text.Chunk        oChunk  = null;
            iTextSharp.text.HeaderFooter oFooter = null;
            try
            {
                using (FileStream fs = new FileStream(pRutaArchivo, FileMode.Create, FileAccess.Write))
                {
                    // Crear PDF
                    oDocument  = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 30, 30, 15, 25);
                    oPdfWriter = iTextSharp.text.pdf.PdfWriter.GetInstance(oDocument, fs);

                    oDocument.Open();
                    oPdfContentByte = oPdfWriter.DirectContent;
                    oPdfContentByte.Stroke();
                    oPdfContentByte.SetLineWidth(0.2f);

                    oDocument.Add(Obtener_Logos(null));
                    oDocument.Add(Obtener_Blanco());
                    oDocument.Add(Obtener_Titulo("098923"));
                    oDocument.Add(Obtener_Blanco());
                    oDocument.Add(Obtener_Cliente(oFirmaElectronicaModel));
                    oDocument.Add(Obtener_Blanco());
                    oDocument.Add(Obtener_Cuenta(oFirmaElectronicaModel));
                    oDocument.Add(Obtener_Blanco());
                    oDocument.Add(Obtener_Solicitud(oFirmaElectronicaModel, "ARamirez"));
                    oDocument.Add(Obtener_Blanco());
                    oDocument.Add(Obtener_Blanco());
                    oDocument.Add(Obtener_Pie(oFirmaElectronicaModel));
                    #region "Firma"
                    //Firma 1
                    //oPdfContentByte.Rectangle(59f, 40.5f, 300f, 72.5f);
                    oPdfContentByte.BeginText();
                    oPdfContentByte.SetFontAndSize(iTextSharp.text.pdf.BaseFont.CreateFont(iTextSharp.text.pdf.BaseFont.HELVETICA_BOLD, iTextSharp.text.pdf.BaseFont.WINANSI, iTextSharp.text.pdf.BaseFont.NOT_EMBEDDED), (float)8);
                    oPdfContentByte.ShowTextAligned(iTextSharp.text.Element.ALIGN_BASELINE, "Asesor de Servicio al Cliente Finantienda", 59f, 122.5f, 0);
                    oPdfContentByte.EndText();
                    oPdfContentByte.Stroke();
                    oPdfContentByte.BeginText();
                    oPdfContentByte.SetFontAndSize(iTextSharp.text.pdf.BaseFont.CreateFont(iTextSharp.text.pdf.BaseFont.HELVETICA, iTextSharp.text.pdf.BaseFont.WINANSI, iTextSharp.text.pdf.BaseFont.NOT_EMBEDDED), (float)8);
                    oPdfContentByte.ShowTextAligned(iTextSharp.text.Element.ALIGN_BASELINE, "Cesar Mariñoas Asmat", 59f, 102.5f, 0);
                    oPdfContentByte.EndText();
                    oPdfContentByte.Stroke();

                    oPdfContentByte.Rectangle(385.5f, 40.5f, 150f, 72.5f);
                    oPdfContentByte.BeginText();
                    oPdfContentByte.SetFontAndSize(iTextSharp.text.pdf.BaseFont.CreateFont(iTextSharp.text.pdf.BaseFont.HELVETICA_BOLD, iTextSharp.text.pdf.BaseFont.WINANSI, iTextSharp.text.pdf.BaseFont.NOT_EMBEDDED), (float)8);
                    oPdfContentByte.ShowTextAligned(iTextSharp.text.Element.ALIGN_BASELINE, "Firma del Cliente Titular", 430.5f, 122.5f, 0);
                    oPdfContentByte.EndText();
                    oPdfContentByte.Stroke();

                    if (!string.IsNullOrEmpty(pImg64))
                    {
                        iTextSharp.text.Image _imagen = iTextSharp.text.Image.GetInstance(ConvertStringBase64ToImage(oFirmaElectronicaModel.oFirmaElectronica.SIGSTRING_64));
                        _imagen.Border      = iTextSharp.text.Rectangle.NO_BORDER;
                        _imagen.BorderColor = iTextSharp.text.Color.WHITE;
                        _imagen.SetAbsolutePosition(385.5f, 55.8f);
                        _imagen.ScaleToFit(150f, 81.5f);

                        oDocument.Add(_imagen);
                    }
                    oDocument.Close();
                    b_Resultado = true;
                }
                #endregion
            }
            catch (Exception ex) { b_Resultado = false; }
            //
            return(b_Resultado);
        }
Exemplo n.º 16
0
        protected void createPDF(Stream output)
        {
            //PrimaryAntibody tempAntibody = myConn.getPrimaryAntibodyByID(Convert.ToInt16(Request.QueryString["id"]));
            PrimaryAntibody tempAntibody = myConn.getPrimaryAntibodyByID(int.Parse(txtid.Value));
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", "attachment; filename=primary_antibody_" + tempAntibody.id + ".pdf");
            iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.LETTER, 72, 72, 72, 72);
            PdfWriter writer = PdfWriter.GetInstance(document, Response.OutputStream);
            document.Open();
            //Page title and spacing
            iTextSharp.text.Chunk pageTitle = new iTextSharp.text.Chunk("Primary Antibody Record", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 20));
            document.Add(pageTitle);
            iTextSharp.text.Paragraph spacing = new iTextSharp.text.Paragraph(" ");
            document.Add(spacing);

            //Name
            iTextSharp.text.Paragraph tempParagraph = new iTextSharp.text.Paragraph();
            iTextSharp.text.Chunk tempLabel = new iTextSharp.text.Chunk("Name: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            iTextSharp.text.Chunk tempValue = new iTextSharp.text.Chunk(tempAntibody.name, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Type
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Type: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempAntibody.type, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Clone
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Clone: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempAntibody.clone, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Host Species
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Host Species: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempAntibody.hostSpecies, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Reactive Species
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Reactive Species: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempAntibody.reactiveSpecies, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Concentration
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Concentration: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempAntibody.concentration, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Working Dilution
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Working Dilution: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempAntibody.workingDilution, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Applications
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Applications: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempAntibody.applications, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Isotype
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Isotype: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempAntibody.isotype, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Antigen
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Antigen: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempAntibody.antigen, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            //Fluorophore
            tempParagraph = new iTextSharp.text.Paragraph();
            tempLabel = new iTextSharp.text.Chunk("Fluorophore: ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempValue = new iTextSharp.text.Chunk(tempAntibody.fluorophore, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 10));
            tempParagraph.Add(tempLabel);
            tempParagraph.Add(tempValue);
            document.Add(tempParagraph);

            document.Close();
        }
Exemplo n.º 17
0
        // Сохраняет выделенные файлы в PDF
        private void btnPDF_Click(object sender, EventArgs e)
        {
            if (0 == listView1.SelectedItems.Count)
            {
                return;
            }

            bool deleteFiles = chkDeleteFiles.Checked;             // Удалять jpeg'и после создания pdf

            savePDFDialog.Filter           = "Файлы PDF|*.pdf";
            savePDFDialog.InitialDirectory = PDFInitialDir;
            if (DialogResult.OK != savePDFDialog.ShowDialog())
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;

            int s = 0;

            if (radioImageMagick.Checked)
            {
                MagickImageCollection images = new MagickImageCollection();
                foreach (ListViewItem item in listView1.SelectedItems)
                {
                    images.Add(scanFileNames[item.Index]);
                    images[s++].Strip();                     // Иначе PDF может получиться кривой с ошибкой insufficient data for an image
                }
                try
                {
                    images.Write(savePDFDialog.FileName, MagickFormat.Pdf);
                }
                catch (MagickException me)
                {
                    toolStripStatus.Text = me.Message;
                    deleteFiles          = false;
                }
                images.Dispose();
            }

            if (radioiTextSharp.Checked)
            {
                iTextSharp.text.Document document = new iTextSharp.text.Document();
                FileStream fileStream             = new FileStream(savePDFDialog.FileName, FileMode.Create);
                iTextSharp.text.pdf.PdfWriter.GetInstance(document, fileStream);
                document.Open();
                foreach (ListViewItem item in listView1.SelectedItems)
                {
                    iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(scanFileNames[item.Index]);
                    image.SetAbsolutePosition(0.0f, 0.0f);
                    image.ScaleToFit(image.Width / image.DpiX * 72f, image.Height / image.DpiY * 72f);
                    iTextSharp.text.Chunk chunk = new iTextSharp.text.Chunk();
                    chunk.SetNewPage();
                    if (s > 0)
                    {
                        document.Add(chunk);
                    }
                    if (deleteFiles & !document.Add(image))
                    {
                        deleteFiles = false;
                    }
                    chunk = null;
                    image = null;
                    s++;
                }

                document.Close();
                document.Dispose();
                fileStream.Close();
                fileStream.Dispose();
            }

            if (deleteFiles)
            {
                btnDelete_Click(btnPDF, null);
            }

            Cursor.Current = Cursors.Default;
        }