protected static pdfTable SubCabRelatorio(pdfDocument myDoc, pdfPage myPage, int top) { String strFont = "Helvetica"; int leftMargin = 30; pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 7, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 6, pdfColor.Black, pdfColor.White)); myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); int cl = 0; myTable.tableHeader.rowHeight = 10; myTable.tableHeader.addColumn(40, predefinedAlignment.csCenter); myTable.tableHeader[cl++].addText("Nº O.S"); myTable.tableHeader.addColumn(80, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("Solicitante"); myTable.tableHeader.addColumn(250, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("Detalhamento Serviço"); myTable.tableHeader.addColumn(100, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("Local"); myTable.tableHeader.addColumn(40, predefinedAlignment.csCenter); myTable.tableHeader[cl++].addText("Abertura"); myTable.tableHeader.addColumn(40, predefinedAlignment.csCenter); myTable.tableHeader[cl++].addText("Conclusão"); return(myTable); }
protected static pdfTable SubCabRelatorio(pdfDocument myDoc, pdfPage myPage, int top) { String strFont = "Helvetica"; int leftMargin = 30; pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 7, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 6, pdfColor.Black, pdfColor.White)); myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); int cl = 0; myTable.tableHeader.rowHeight = 10; myTable.tableHeader.addColumn(80, predefinedAlignment.csCenter); myTable.tableHeader[cl++].addText("Atividade"); myTable.tableHeader.addColumn(140, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("Grupo Atividade"); myTable.tableHeader.addColumn(50, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("Periodicidade"); myTable.tableHeader.addColumn(300, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("Itens de Atividade"); return(myTable); }
protected static void CabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string DadosObra) { String strFont = "Helvetica"; int leftMargin = 30; myPage.addText("PLANO MANUTENÇÃO PREVENTIVA", leftMargin, getTop(myPage, 30), myDoc.getFontReference(strFont), 12, pdfColor.Black); pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 9, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White)); top += 5; myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); int cl = 0; myTable.tableHeader.rowHeight = 20; myTable.tableHeader.addColumn(550, predefinedAlignment.csLeft); myTable.tableHeader[cl].addText("Obra: " + DadosObra.ToString()); myPage.addTable(myTable); }
protected static void CabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string DadosObra, string DataInicial, string DataFinal) { String strFont = "Helvetica"; int leftMargin = 30; myPage.addText("Fechamento do Mês - Atendimentos Realizados no Período de : " + DataInicial + " a " + DataFinal, leftMargin, getTop(myPage, 30), myDoc.getFontReference(strFont), 12, pdfColor.Black); pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 9, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White)); top += 5; myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); int cl = 0; myTable.tableHeader.rowHeight = 20; myTable.tableHeader.addColumn(550, predefinedAlignment.csLeft); myTable.tableHeader[cl].addText("Obra: " + DadosObra.ToString()); myPage.addTable(myTable); }
protected static void SubCabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string CoObra, string cmpCoPreventiva) { String strFont = "Helvetica"; int leftMargin = 30; pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 7, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 6, pdfColor.Black, pdfColor.White)); myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); int cl = 0; myTable.tableHeader.addColumn(200, predefinedAlignment.csCenter); myTable.tableHeader.rowHeight = 20; myTable.tableHeader[cl++].addText("Atividades da Manutenção Preventiva"); myPage.addTable(myTable); myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 7, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 5, pdfColor.Black, pdfColor.White)); top = 70; myTable.coordX = 220; myTable.coordY = getTop(myPage, top); cl = 0; myTable.tableHeader.addColumn(352, predefinedAlignment.csCenter); myTable.tableHeader.rowHeight = 10; myTable.tableHeader[cl++].addText("Pavimentos"); myPage.addTable(myTable); myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 5, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 3, pdfColor.Black, pdfColor.White)); top += 10; myTable.coordX = 220; myTable.coordY = getTop(myPage, top); cl = 0; myTable.tableHeader.rowHeight = 10; DataTable table = tblPreventivaAtividade.RetornaFormPreventivaPivot(Global.GetConnection(), cmpCoPreventiva, CoObra); for (int i = 2; i <= 23; ++i) { myTable.tableHeader.addColumn(16, predefinedAlignment.csCenter); if (i <= table.Columns.Count - 1) { myTable.tableHeader[cl++].addText(table.Columns[i].ColumnName.ToString()); } else { myTable.tableHeader[cl++].addText(""); } } myPage.addTable(myTable); }
protected static pdfTable SubCabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string Atividade, string GrupoAtv, string Periodicidade) { String strFont = "Helvetica"; int leftMargin = 30; pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White)); myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); // Create Table Row pdfTableRow myRow; int cl = 0; //// Create table's header myTable.tableHeader.rowHeight = 20; myTable.tableHeader.addColumn(100, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("Atividade"); myTable.tableHeader.addColumn(450, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText(Atividade.TrimEnd()); myRow = myTable.createRow(); myRow.rowStyle = myTable.rowStyle; top += 20; cl = 0; myRow = myTable.createRow(); myRow.rowStyle = myTable.rowStyle; myRow[cl].columnAlign = predefinedAlignment.csLeft; myRow[cl++].addText("Grupo Atividade"); myRow[cl++].addText(TiraCaractEspecial(GrupoAtv.TrimEnd())); myTable.addRow(myRow); top += 20; cl = 0; myRow = myTable.createRow(); myRow.rowStyle = myTable.rowStyle; myRow[cl].columnAlign = predefinedAlignment.csLeft; myRow[cl++].addText("Periodicidade"); myRow[cl++].addText(Periodicidade.TrimEnd()); myTable.addRow(myRow); top += 10; myPage.addTable(myTable); myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White)); myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); cl = 0; myTable.tableHeader.rowHeight = 20; myTable.tableHeader.addColumn(550, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("ITENS DE ATIVIDADE"); return(myTable); }
private byte[] returnPdfInBytes() { System.IO.MemoryStream stream = new MemoryStream(); document.createPDF(stream); document = null; page = null; return(stream.ToArray()); }
private void button1_Click(object sender, EventArgs e) { pdfDocument myDoc = new pdfDocument("RemiseImpot", "ME"); pdfPage myFirstPage = myDoc.addPage(); myDoc.createPDF(@"C:\Users\William\Documents\Remises_Impots.pdf"); myFirstPage = null; myDoc = null; }
/// <summary> ///titlepage with info such as scene name and current date /// </summary> /// <param name="doc"> the document to which to add the page</param> private void Titlepage(pdfDocument doc) { //create and add page to document pdfPage TitlePage = doc.addPage(); int titlelengt = sceneName.Length; int fontSize = 60; //add text to middlle document TitlePage.addText(sceneName, TitlePage.width / 2 - titlelengt * fontSize / 3, TitlePage.height - fontSize * 2, predefinedFont.csHelveticaBold, fontSize); TitlePage.addText(date, TitlePage.width / 2 - date.Length * 12 / 3, TitlePage.height - fontSize * 2 - 40, predefinedFont.csHelvetica, 12); }
private void Button_Click(object sender, RoutedEventArgs e) { pdfDocument myDoc = new pdfDocument("TUTORIAL", "ME"); pdfPage myPage = myDoc.addPage(); myPage.addText("Hello,World!", 200, 450, myDoc.getFontReference(predefinedFont.csHelvetica), 20); myDoc.addTrueTypeFont(@"verdana.ttf", "verdana"); myPage.addText("Привет, мир!", 200, 250, myDoc.getFontReference("verdana"), 20); myDoc.createPDF(@"test.pdf"); myPage = null; myDoc = null; }
protected void CabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string nNuOs, string nNuDemanda) { String strFont = "Helvetica"; int leftMargin = 30; //myDoc.addImageReference(EnderecoLogoOrion, "logo1"); //myPage.addImage(myDoc.getImageReference("logo1"), leftMargin, getTop(myPage, top)); //if (EnderecoLogoObra != "") //{ // myDoc.addImageReference(EnderecoLogoObra, "logo2"); // myPage.addImage(myDoc.getImageReference("logo2"), 530, getTop(myPage, top)); //} //top += 10; myPage.addText("ORDEM DE SERVIÇO", 235, getTop(myPage, 30), myDoc.getFontReference(strFont), 12, pdfColor.Black); pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 9, pdfColor.Black, pdfColor.White)); top += 20; myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); int cl = 0; myTable.tableHeader.rowHeight = 20; myTable.tableHeader.addColumn(570, predefinedAlignment.csLeft); myTable.tableHeader[cl].addText("Obra: " + DadosObra); myPage.addTable(myTable); myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 9, pdfColor.Black, pdfColor.White)); top += 20; myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); cl = 0; myTable.tableHeader.rowHeight = 20; myTable.tableHeader.addColumn(285, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("Nº ORDEM DE SERVIÇO: " + nNuOs.ToString()); top += 20; myTable.tableHeader.rowHeight = 20; myTable.tableHeader.addColumn(285, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("Nº DEMANDA CLIENTE: " + nNuDemanda.ToString()); myPage.addTable(myTable); }
private IEnumerator createPdf() { pdfDocument myDoc = new pdfDocument("Palm Measure Application", "", false); pdfPage myFirstPage = myDoc.addPage(); //yield return StartCoroutine(myFirstPage.newAddImage(Application.persistentDataPath + "/" + "screenshot.png", 0, 800)); myFirstPage.addText("Name: " + NameInputField.text, 0, 700, sharpPDF.Enumerators.predefinedFont.csCourier, 36); myFirstPage.addText("Id: " + IdInputField.text, 0, 650, sharpPDF.Enumerators.predefinedFont.csCourier, 36); myFirstPage.addText("Scale: " + PreviewZoomIndication.text, 0, 600, sharpPDF.Enumerators.predefinedFont.csCourier, 36); myFirstPage.addText("Comments: " + CommentsInputField.text, 0, 550, sharpPDF.Enumerators.predefinedFont.csCourier, 36); myDoc.createPDF(Application.persistentDataPath + "/Data.pdf"); yield return(null); }
protected static void SubCabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, DataRow row) { String strFont = "Helvetica"; int leftMargin = 30; pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 9, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White)); myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); int cl = 0; myTable.tableHeader.rowHeight = 20; myTable.tableHeader.addColumn(110, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("ATIVIDADE"); myTable.tableHeader.addColumn(60, predefinedAlignment.csCenter); myTable.tableHeader[cl++].addText("DATA"); myTable.tableHeader.addColumn(80, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("Nº PREVENTIVA"); myTable.tableHeader.addColumn(90, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("PERIODICIDADE"); myTable.tableHeader.addColumn(100, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("SITUAÇÃO"); myTable.tableHeader.addColumn(110, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("TIPO PREVENTIVA"); top += 20; cl = 0; pdfTableRow myRow = myTable.createRow(); myRow.rowStyle = myTable.rowStyle; myRow[cl++].addText(row["cmpDcTipoAtividade"].ToString().TrimEnd()); myRow[cl++].addText(row["cmpDtReprogramacaoPreventivaAgenda"].ToString().Substring(0, 10)); myRow[cl++].addText(row["cmpNuPreventivaAgenda"].ToString().TrimEnd()); myRow[cl++].addText(row["cmpDcPeriodicidade"].ToString().TrimEnd()); myRow[cl++].addText(row["EstadoManutencaoPreventiva"].ToString().TrimEnd()); myRow[cl++].addText(row["TPPREVENTIVA"].ToString().TrimEnd()); myTable.addRow(myRow); myPage.addTable(myTable); }
protected static void CabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string NomeObra, string Atividade, string Periodicidade) { String strFont = "Helvetica"; int leftMargin = 30; myPage.addText("Formulário de Manutenção Preventiva", 200, getTop(myPage, top), myDoc.getFontReference(strFont), 12, pdfColor.Black); top += 15; myPage.addText("OBRA: " + NomeObra.TrimEnd(), leftMargin, getTop(myPage, top), myDoc.getFontReference(strFont), 10, pdfColor.Black); top += 15; myPage.addText("TIPO ATIVIDADE: " + Atividade.TrimEnd() + " " + "PERIODICIDADE : " + Periodicidade.TrimEnd(), leftMargin, getTop(myPage, top), myDoc.getFontReference(strFont), 10, pdfColor.Black); }
/// <summary> /// add create page and add image to page /// </summary> /// <param name="imagePath"> path to where the image is located </param> /// <param name="doc"> the document to add a page to </param> private void InsertImage(string imagePath, pdfDocument doc) { //create page with size of 1080 by 1920 and add to document pdfPage page = doc.addPage(1080, 1920); //read image file as byte array byte[] vs = File.ReadAllBytes(imagePath); //calc image height using page size and 16:9 aspect ratio int IWidht = page.width; int IHeight = IWidht * 9 / 16; //add image to page anchor point 0,0 with height and with page.addImage(vs, 0, 0, IHeight, IWidht); }
/// <summary> /// add create page with special height and width and add image to page /// </summary> /// <param name="imagePath"> path to where the image is located </param> /// <param name="doc"> the document to add a page to </param> /// <param name="pageWidth"> the widht of the created page </param> /// <param name="pageHeight"> the height of the created page </param> private void InsertImage(string imagePath, pdfDocument doc, int pageWidth, int pageHeight) { //create and add page to document pdfPage page = doc.addPage(pageHeight, pageWidth); //read image file as byte array byte[] vs = File.ReadAllBytes(imagePath); //calc image height using page size and 16:9 aspect ratio int IWidht = page.width; int IHeight = IWidht * 9 / 16; //add image to page. position 0,0 with height and with page.addImage(vs, 0, 0, IHeight, IWidht); }
// Constructor public ReportWriter(string releaseVersion) { strFont = "Helvetica"; leftMargin = 60; rightMargin = 60; topMargin = 60; bottomMargin = 60; lineHeight = 20; myDoc = new pdfDocument("Stormwater Calculator Report", "swc"); int strWidth = myDoc.getFontReference(strFont).getWordWidth("Page x Of x", 10); int left = 612 - rightMargin - strWidth; myDoc.pageMarker = new pdfPageMarker(left, bottomMargin - lineHeight, predefinedMarkerStyle.csArabic, myDoc.getFontReference(strFont), 10); footer = footer + releaseVersion; }
/// <summary> /// Exports the chart to the specified output stream as binary. When /// exporting to a web response the WriteToHttpResponse() method is likely /// preferred. /// </summary> /// <param name="outputStream">An output stream.</param> internal void WriteToStream(Stream outputStream) { switch (this.ContentType) { case "image/jpeg": CreateSvgDocument().Draw().Save( outputStream, ImageFormat.Jpeg); break; case "image/png": // PNG output requires a seekable stream. using (MemoryStream seekableStream = new MemoryStream()) { CreateSvgDocument().Draw().Save( seekableStream, ImageFormat.Png); seekableStream.WriteTo(outputStream); } break; case "application/pdf": SvgDocument svgDoc = CreateSvgDocument(); Bitmap bmp = svgDoc.Draw(); pdfDocument doc = new pdfDocument(this.Name, null); pdfPage page = doc.addPage(bmp.Height, bmp.Width); page.addImage(bmp, 0, 0); doc.createPDF(outputStream); break; case "image/svg+xml": using (StreamWriter writer = new StreamWriter(outputStream)) { writer.Write(this.Svg); writer.Flush(); } break; default: throw new InvalidOperationException(string.Format( "ContentType '{0}' is invalid.", this.ContentType)); } outputStream.Flush(); }
/// <summary> /// Load data with a file path /// </summary> /// <param name="filePath">the file path need to read</param> public bool ReadFilePdf(string filePath, int location) //Load data here { //WithoutPassword bool hasPassword = false; this.document = new pdfDocument(); this.DataContext = this.document; this.document.PropertyChanged += DocumentOnPropertyChanged; this.filePath = filePath; recentLocation = location; file = new FileStream(filePath, FileMode.Open, FileAccess.Read); try { Document document = new Document(file); (this.document).Document = document; pdfFileBookmark = new PdfLoadedDocument(filePath); } catch (Apitron.PDF.Rasterizer.ErrorHandling.DocumentLoadException) { file.Close(); hasPassword = true; } catch (Exception) { MessageBox.Show("Sorry something went wrong in Reader+ can't open this file", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return(false); } if (hasPassword) { //A file has password var passwordScreen = new PasswordScreen(); passwordScreen.EnterPasswordEvent += checkPassword; passwordScreen.Owner = App.Current.MainWindow as WindowScreen; passwordScreen.ShowDialog(); } if (document.Document == null) { return(false); } ClassifyBookmarks(); bookmarkListView.ItemsSource = bookmarkList; TOCTree.ItemsSource = toc; return(true); }
/// <summary> /// imprimir O.S /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnImprimirOS_Click(object sender, EventArgs e) { if (ViewState["cmpIdOS"].ToString() == "0") { this.GravarOS(); } ImprimirOs Imprimir = new ImprimirOs(); pdfDocument myDoc = new pdfDocument("Horizon", "Orion"); Imprimir.myDoc = myDoc; Imprimir.myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat); Imprimir.cmpCoObra = loadObra(); Imprimir.cmpIdOS = ViewState["cmpIdOS"].ToString(); Imprimir.NomeObra = "Serviços de TI"; Imprimir.EnderecoLogoOrion = Server.MapPath("~/Imagens/logo_Orion.jpg"); if (ViewState["cmpInLogoObra"].ToString() == "1") { Imprimir.EnderecoLogoObra = Server.MapPath("~/Imagens/logo_IPEN.bmp"); } else { Imprimir.EnderecoLogoObra = ""; } Imprimir.ImprimeOrdemServico(); string filename = "pdf" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf"; string nomepdf = Server.MapPath("~/Relatorios/" + filename); myDoc.createPDF(nomepdf); Response.Write("<script>window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');</script>"); // Impressão ambiente desenvolvimento local //Response.Write("<script language='javascript'>" // + "window.open('" + @"http://*****:*****@"http://172.10.10.2/HzWebManutencao_Desenv/Relatorios/" + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105')" // + "</script>"); }
protected static void ImprimeGrupo(pdfDocument myDoc, pdfPage myPage, int top, string GrupoAtividade) { String strFont = "Helvetica"; int leftMargin = 30; pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 9, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White)); myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); int cl = 0; myTable.tableHeader.addColumn(550, predefinedAlignment.csLeft); myTable.tableHeader.rowHeight = 20; myTable.tableHeader[cl++].addText("GRUPO DE ATIVIDADE: " + GrupoAtividade); myPage.addTable(myTable); }
public virtual int CabRelatorio(pdfDocument myDoc, pdfPage myPage, int top) { String strFont = "Helvetica"; int leftMargin = 30; myPage.addText("Formulário de Manutenção Preventiva de Equipamento", 200, getTop(myPage, top), myDoc.getFontReference(strFont), 12, pdfColor.Black); top += 15; myPage.addText("OBRA: " + cmpNoObra, leftMargin, getTop(myPage, top), myDoc.getFontReference(strFont), 10, pdfColor.Black); top += 15; myPage.addText("TIPO ATIVIDADE: " + cmpDcTipoAtividade + " " + "PERIODICIDADE : " + cmpDcPeriodicidade, leftMargin, getTop(myPage, top), myDoc.getFontReference(strFont), 10, pdfColor.Black); top += 20; myPage.addText("Dados do Equipamento", 230, getTop(myPage, top), myDoc.getFontReference(strFont), 12, pdfColor.Black); return(top += 15); }
/// <summary> /// Código da Ordem de Serviço /// </summary> //public string cmpIdOS { get; set; } /// <summary> /// Código da Obra /// </summary> //public string cmpCoObra { get; set; } /// <summary> /// Documento PDF /// </summary> //public pdfDocument myDoc { get; set; } #endregion #region Base Functions protected static pdfTable CabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string DadosObra, string DataInicial, string DataFinal) { String strFont = "Helvetica"; int leftMargin = 30; // Cabeçalho Relatório myPage.addText("Atendimentos Realizados - Período : " + DataInicial + " a " + DataFinal, leftMargin, getTop(myPage, 30), myDoc.getFontReference(strFont), 15, pdfColor.Black); pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 11, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 11, pdfColor.Black, pdfColor.White)); top += 20; myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); int cl = 0; myTable.tableHeader.rowHeight = 30; myTable.tableHeader.addColumn(550, predefinedAlignment.csLeft); myTable.tableHeader[cl].addText("Obra: " + DadosObra.ToString()); myPage.addTable(myTable); top += 30; myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White)); myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); cl = 0; myTable.tableHeader.rowHeight = 10; myTable.tableHeader.addColumn(450, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("Descrição da Solicitação"); myTable.tableHeader.addColumn(100, predefinedAlignment.csCenter); myTable.tableHeader[cl++].addText("Data da Conclusão"); top = +15; return(myTable); }
private void ImprimirFechamentoMes() { DataTable table = pesquisaOs(); if (table != null && table.Rows.Count > 0) { //filename = "FechaMes" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf"; string nomepdf = Server.MapPath("~/Relatorios/" + filename); pdfDocument myDoc = HzWebManutencao.ImprimirFechamentoMes.ImprimeFechamento(table, txtDataInicial.Text.ToString(), txtDataFinal.Text.ToString()); myDoc.createPDF(nomepdf); Response.Write("<script>window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');</script>"); // Impressão ambiente produção ambiente interno orion //Response.Write("<script language='javascript'>" // + "window.open('" + @"http://172.10.10.2/HzWebManutencao_Desenv/Relatorios/" + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105')" // + "</script>"); } }
private void ImprimirTodasOS() { DataTable table = pesquisaOs(); if (table != null && table.Rows.Count > 0) { ImprimirOs Imprimir = new ImprimirOs(); pdfDocument myDoc = new pdfDocument("Horizon", "Orion"); Imprimir.myDoc = myDoc; Imprimir.cmpCoObra = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpCoObraGrupoLista; Imprimir.NomeObra = cmbObra.SelectedItem.ToString(); Imprimir.EnderecoLogoOrion = Server.MapPath("~/Imagens/logo_Orion.jpg"); if (ViewState["cmpInLogoObra"].ToString() == "True") { Imprimir.EnderecoLogoObra = Server.MapPath("~/Imagens/logo_IPEN.bmp"); } else { Imprimir.EnderecoLogoObra = ""; } foreach (DataRow lin in table.Rows) { Imprimir.cmpIdOS = lin["cmpIdOs"].ToString(); Imprimir.myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat); Imprimir.ImprimeOrdemServico(); } //filename = "pdf" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf"; string nomepdf = Server.MapPath("~/Relatorios/" + filename); myDoc.createPDF(nomepdf); Response.Write("<script>window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');</script>"); // Impressão ambiente produção ambiente interno orion //Response.Write("<script language='javascript'>" // + "window.open('" + @"http://172.10.10.2/HzWebManutencao_Desenv/Relatorios/" + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105')" // + "</script>"); } }
protected void CabRelatorio(pdfDocument myDoc, pdfPage myPage, int top, string DadosObra, string DtInicial, string DtFinal) { String strFont = "Helvetica"; int leftMargin = 30; //myDoc.addImageReference(EnderecoLogoOrion, "logo1"); //myPage.addImage(myDoc.getImageReference("logo1"), leftMargin, getTop(myPage, top)); //if (EnderecoLogoObra != "") //{ // myDoc.addImageReference(EnderecoLogoObra, "logo2"); // myPage.addImage(myDoc.getImageReference("logo2"), 530, getTop(myPage, top)); //} //top += 20; myPage.addText("AGENDA MANUTENÇÃO PREVENTIVA", 235, getTop(myPage, top), myDoc.getFontReference(strFont), 12, pdfColor.Black); pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 8, pdfColor.Black, pdfColor.White)); top += 10; myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); int cl = 0; myTable.tableHeader.rowHeight = 20; myTable.tableHeader.addColumn(350, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("Obra: " + DadosObra.ToString().TrimEnd()); myTable.tableHeader.addColumn(200, predefinedAlignment.csLeft); myTable.tableHeader[cl++].addText("Período: " + DtInicial + " a " + DtFinal); myPage.addTable(myTable); }
protected static pdfTable ItemAtividade(pdfDocument myDoc, pdfPage myPage, int top, DataRow r) { String strFont = "Helvetica"; int leftMargin = 30; pdfTable myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 12, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 12, pdfColor.Black, pdfColor.White)); myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); int cl = 0; myTable.tableHeader.addColumn(550, predefinedAlignment.csCenter); myTable.tableHeader.rowHeight = 20; myTable.tableHeader[cl++].addText("Itens da Manutenção"); myPage.addTable(myTable); top += 20; myTable = new pdfTable(myDoc, 1, new pdfColor("000000"), 2, new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, new pdfColor("FFFFFF")), new pdfTableStyle(myDoc.getFontReference(strFont), 10, pdfColor.Black, pdfColor.White)); myTable.coordX = leftMargin; myTable.coordY = getTop(myPage, top); cl = 0; myTable.tableHeader.addColumn(20, predefinedAlignment.csLeft); myTable.tableHeader.rowHeight = 10; myTable.tableHeader[cl++].addText(""); myTable.tableHeader.addColumn(530, predefinedAlignment.csLeft); myTable.tableHeader.rowHeight = 10; myTable.tableHeader[cl++].addText(TiraCaractEspecial(r["cmpDcItemAtividadePreventiva"].ToString().TrimEnd())); return(myTable); }
/// <summary> /// creates a pdf using: /// #the given results /// #name of active scene /// #images from Screenshot folder /// </summary> /// <param name="results"> the results to be displayed in the pdf </param> public void createPdf(List <Results> results) { //get name of scene and current date sceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name; date = System.DateTime.Now.ToString("dd-MM-yyyy_hh.mm"); docname = sceneName + "-" + date; //create document pdfDocument pdfDocument = new pdfDocument(docname, "TI-2020"); //make the first page Titlepage(pdfDocument); //add the results from the results, 1 page per result addResults(results, pdfDocument); //add foto's to the document, 1 foto per page //get the image files DirectoryInfo d = new DirectoryInfo(ScreenshotPath); FileInfo[] files = d.GetFiles(); //sort image files by date System.Array.Sort(files, (f1, f2) => f1.CreationTime.CompareTo(f2.CreationTime)); foreach (var file in files) { //create new page and add image InsertImage(ScreenshotPath + "/" + file.Name, pdfDocument); } //save the pdf in folder if (!Directory.Exists("pdf")) { Directory.CreateDirectory("pdf"); } pdfDocument.createPDF(@"pdf/" + docname + ".pdf"); }
//Onglet Recapitulatif private void btnCreeReca_Click(object sender, EventArgs e) { try { //Initialisation des variables connec.Open(); string mois = dtpReca.Value.Month.ToString(); string annee = dtpReca.Value.Year.ToString(); string text = "____________________________________________________"; string typeNull = "Type NULL"; float montant = 0; int recette = 0; int percu = 0; int indentation = 20; int hauteurDesLignes = 720; List <string> un = new List <string>(); List <string> de = new List <string>(); List <string> tr = new List <string>(); List <string> qu = new List <string>(); List <string> ci = new List <string>(); List <string> si = new List <string>(); List <Boolean> nbTransaction = new List <Boolean>(); pdfDocument myDoc = new pdfDocument("Recapitulatif_" + mois + "_" + annee, "Pique_Sous"); pdfPage myPage = myDoc.addPage(); //SQL OleDbCommand cd1 = new OleDbCommand("SELECT [Transaction].* FROM [Transaction] WHERE MONTH([dateTransaction]) = " + dtpReca.Value.Month.ToString(), connec); OleDbDataReader dr1 = cd1.ExecuteReader(); //Lecture de la base while (dr1.Read()) { nbTransaction.Add(dr1.GetBoolean(4)); if (dr1.GetBoolean(4) == true) { recette++; } if (dr1.GetBoolean(5) == true) { percu++; } montant = montant + dr1.GetFloat(3); un.Add(dr1[1].ToString().Substring(0, 11)); de.Add(dr1[2].ToString()); tr.Add(dr1[3].ToString()); qu.Add(dr1[4].ToString()); ci.Add(dr1[5].ToString()); if (dr1[6].ToString() != "") { si.Add(dr1[6].ToString()); } else { si.Add(typeNull); } } for (int i = 0; i < si.Count; i++) { if (si[i] != typeNull) { //Pour eviter de faire une requette avec une jointure OleDbCommand cd2 = new OleDbCommand("SELECT [TypeTransaction].* FROM [TypeTransaction] where [codeType] = " + si[i], connec); OleDbDataReader dr2 = cd2.ExecuteReader(); while (dr2.Read()) { si[i] = dr2[1].ToString(); } } } //Creation du text dans le PDF myPage.addText("Recapitulatif du : " + mois + "_" + annee, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); hauteurDesLignes = hauteurDesLignes - 30; myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); hauteurDesLignes = hauteurDesLignes - 30; myPage.addText("Dépenses", indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); hauteurDesLignes = hauteurDesLignes - (30 + 25 * un.Count); myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); hauteurDesLignes = hauteurDesLignes - 30; myPage.addText("Recette : " + recette.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); hauteurDesLignes = hauteurDesLignes - 30; myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); hauteurDesLignes = hauteurDesLignes - 30; myPage.addText(" Depenses : " + montant.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); hauteurDesLignes = hauteurDesLignes - 30; myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); hauteurDesLignes = hauteurDesLignes - 30; myPage.addText("Reste a persevoir : " + percu.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); hauteurDesLignes = hauteurDesLignes - 30; myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); hauteurDesLignes = hauteurDesLignes - 30; myPage.addText("Somme total dépensée : -" + montant.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); hauteurDesLignes = hauteurDesLignes - 30; myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); hauteurDesLignes = hauteurDesLignes - 30; myPage.addText("nombres de transactions : " + nbTransaction.Count.ToString(), indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); hauteurDesLignes = hauteurDesLignes - 30; myPage.addText(text, indentation, hauteurDesLignes, myDoc.getFontReference(predefinedFont.csHelvetica), 20); //Initiallisation tableau PDF pdfTable myTable = new pdfTable(myDoc); myTable.borderSize = 1; myTable.borderColor = sharpPDF.pdfColor.Black; myTable.tableHeader.addColumn(90); myTable.tableHeader.addColumn(120); myTable.tableHeader.addColumn(70); myTable.tableHeader.addColumn(70); myTable.tableHeader.addColumn(70); myTable.tableHeader.addColumn(110); pdfTableRow myRow = myTable.createRow(); //Remplissage de la première ligne du tableau myRow[0].addText("Date Transaction"); myRow[1].addText("Description"); myRow[2].addText("Montant"); myRow[3].addText("Recette ?"); myRow[4].addText("Perçu ?"); myRow[5].addText("Type de dépence ?"); myTable.addRow(myRow); //Remplissage des ligne du tableau for (int i = 0; i < un.Count; i++) { myRow = myTable.createRow(); myRow[0].addText(un[i]); myRow[1].addText(de[i]); myRow[2].addText(tr[i]); myRow[3].addText(qu[i]); myRow[4].addText(ci[i]); myRow[5].addText(si[i]); myTable.addRow(myRow); } //Place le tableau myTable.coordY = 650; myTable.coordX = 20; myPage.addTable(myTable); //creer le PDF FolderBrowserDialog fbd = new FolderBrowserDialog(); if (fbd.ShowDialog() == DialogResult.OK) { myDoc.createPDF(fbd.SelectedPath + @"\Recapitulatif_" + mois + "_" + annee + ".pdf"); } myPage = null; myDoc = null; connec.Close(); MessageBox.Show("PDF créé"); } catch (InvalidOperationException erreur) { MessageBox.Show("Erreur de chaine de connexion ! pdf"); MessageBox.Show(erreur.Message); } catch (OleDbException erreur) { MessageBox.Show("Erreur de requete SQL ! pdf"); MessageBox.Show(erreur.Message); } }
protected void grdOS_RowCommand(object sender, GridViewCommandEventArgs e) { string[] ParImpressao = e.CommandArgument.ToString().Split(new char[] { '$' }); try { string p; switch (e.CommandName.ToLower().Trim()) { case "lnk": if (cmbObra.SelectedItem.ToString().TrimEnd() == "SERVIÇOS DE TI" || chkServicosTI.Checked == true) { p = "webATE_ServicosTI.aspx?id=" + e.CommandArgument.ToString(); } else { p = "webATE_OS.aspx?id=" + e.CommandArgument.ToString(); } Response.Redirect(p, false); break; case "btn": ImprimirOs Imprimir = new ImprimirOs(); pdfDocument myDoc = new pdfDocument("Horizon", "Orion"); Imprimir.myDoc = myDoc; Imprimir.myPage = myDoc.addPage(predefinedPageSize.csSharpPDFFormat); Imprimir.cmpCoObra = ParImpressao[0].ToString(); Imprimir.cmpIdOS = ParImpressao[1].ToString(); Imprimir.NomeObra = cmbObra.SelectedItem.ToString(); Imprimir.EnderecoLogoOrion = Server.MapPath("~/Imagens/logo_Orion.jpg"); if (ViewState["cmpInLogoObra"].ToString() == "1") { Imprimir.EnderecoLogoObra = Server.MapPath("~/Imagens/logo_IPEN.bmp"); } else { Imprimir.EnderecoLogoObra = ""; } Imprimir.ImprimeOrdemServico(); //filename = "pdf" + DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Millisecond.ToString() + ".pdf"; //string nomepdf = Server.MapPath("~/Relatorios/" + filename); myDoc.createPDF(Server.MapPath("~/Relatorios/" + filename)); Response.Write("<script>window.open('" + Global.UrlRelatorio + filename + "', '_blank', 'width=850, height=600, menubar=no, resizable=yes, scrollbars=yes, top=35, left=105');</script>"); break; case "log": DataTable dtLog = tblLogOS.LogOS(Global.GetConnection(), e.CommandArgument.ToString().Trim()); grdLogs.DataSource = dtLog; grdLogs.DataBind(); ModalPopupExtender2.Show(); break; } } catch (Exception ex) { Global.ShowError(Global.Title, ex); } }