wordpress 摄影博客/上海自动seo

wordpress 摄影博客,上海自动seo,app开发哪家好,股票做T网站HTML转PDF批量导出速度太慢且使用Spire.pdf.dll限制页签10后需要开通会员才能使用-做出优化 环境:U9 - UI插件 需求:选择需要导出的客户查询对应对账数据批量导出PDF并弹出下载框保存到默认位置 using System; using System.Collections.Generic; us…

HTML转PDF批量导出速度太慢且使用Spire.pdf.dll限制页签10后需要开通会员才能使用-做出优化

环境:U9 - UI插件 

需求:选择需要导出的客户查询对应对账数据批量导出PDF并弹出下载框保存到默认位置

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI;
using System.Web.UI.WebControls;
using UFIDA.U9.AP.Payment;
using UFIDA.U9.Cust.HuaRui.QueryCustomerUIModel;
using UFIDA.U9.FI.AP.Payment.PayBillUIModel;
using UFIDA.U9.UI.PDHelper;
using UFSoft.UBF.AopFrame.Lock;
using UFSoft.UBF.Business;
using UFSoft.UBF.UI;
using UFSoft.UBF.UI.ControlModel;
using UFSoft.UBF.UI.WebControlAdapter;
using UFSoft.UBF.Util.DataAccess;
using static UFIDA.U9.Cust.HuaRui.HuaRExtendUIPlug.TemplateClass;namespace UFIDA.U9.Cust.HuaRui.HuaRExtendUIPlug
{public partial class QueryCustomerUIFormWebPart : UFSoft.UBF.UI.Custom.ExtendedPartBase{private UFIDA.U9.Cust.HuaRui.QueryCustomerUIModel.QueryCustomerUIFormWebPart _part;IUFButton BtnFresh;public override void AfterInit(UFSoft.UBF.UI.IView.IPart Part, EventArgs args){_part = Part as UFIDA.U9.Cust.HuaRui.QueryCustomerUIModel.QueryCustomerUIFormWebPart;if (_part == null)return;#region 添加按钮IUFButton BtnTransfer = new UFWebButtonAdapter();BtnTransfer.Text = "批量导出";BtnTransfer.AutoPostBack = true;BtnTransfer.ID = "BtnTransfer";BtnTransfer.Width = 100;BtnTransfer.Height = 20;IUFCard card = (IUFCard)_part.GetUFControlByName(_part.TopLevelContainer, "Card0");card.Controls.Add(BtnTransfer);CommonFunction.Layout(card, BtnTransfer, 0, 0);BtnTransfer.Click += new EventHandler(BtnTransfer_Click);#endregionbase.AfterInit(Part, args);}private void BtnTransfer_Click(object sender, EventArgs e){try{_part.OnDataCollect(this);_part.IsDataBinding = true;_part.IsConsuming = true;_part.Model.ClearErrorMessage();if (_part.Model.QueryCustomerLine.SelectRecords.Count == 0){_part.Model.ErrorMessage.Message = "请选择数据!";return;}#region 生成HTML文件转PDF复制到指定文件夹string filePathUrl = "";//文件地址var basePath = AppDomain.CurrentDomain.BaseDirectory;string destinationPath = basePath + @"\FileZipTemp\";string destinationPathZip = basePath + @"\FileZip\";string FileName = "货款对账单-" + DateTime.Now.ToString("yyyyMMdd") + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();if (!Directory.Exists(destinationPath)){Directory.CreateDirectory(destinationPath);}if (!Directory.Exists(destinationPathZip)){Directory.CreateDirectory(destinationPathZip);}string CustomersName = string.Empty;string str = string.Empty;if (_part.Model.QueryCustomerLine.SelectRecords.Count > 1){foreach (QueryCustomerLineRecord rd in _part.Model.QueryCustomerLine.SelectRecords){str += ",N'" + rd.CustomerName + "'";}str = str.Substring(1);CustomersName = "(CustomersName in (" + str + "))";}else{foreach (QueryCustomerLineRecord rd in _part.Model.QueryCustomerLine.SelectRecords){CustomersName = "(CustomersName = N'" + rd.CustomerName + "')";}}DataSet ds = new DataSet();string procBomName = "Cust_HuaRui_ProvideAccountNew";DataParamList lstBom = new DataParamList();lstBom.Add(DataParamFactory.CreateInput("CustomersName", CustomersName));lstBom.Add(DataParamFactory.CreateInput("ContarctsState", null));lstBom.Add(DataParamFactory.CreateInput("UserID", PDContext.Current.UserCode));lstBom.Add(DataParamFactory.CreateInput("SOBAccountingPeriod", null));DataAccessor.RunSP(procBomName, lstBom, out ds);List<ProvideAccount> ProvideAccount = CommonHelper.DataTable2List<ProvideAccount>(ds.Tables[0]);if (ds.Tables[0].Rows.Count == 0){_part.Model.ErrorMessage.Message = "所选客户没有货款对账相关内容!";return;}var Customers = ProvideAccount.GroupBy(x => x.CustomersName).Select(x => x.Key).ToList();//调用模版提供的默认实现.--默认实现可能会调用相应的Action.foreach (var customer in Customers){var list = ProvideAccount.Where(x => x.CustomersName == customer).ToList();if (list.Count == 0){continue;}//StringBuilder htmlContent = HtmlTOPdf(list, customer);//string htmlFilePathUrl = destinationPathZip + "\\" + FileName;//if (!Directory.Exists(htmlFilePathUrl))//{//    Directory.CreateDirectory(htmlFilePathUrl);//}string pdfFilePathUrl = destinationPath + "\\" + FileName;if (!Directory.Exists(pdfFilePathUrl)){Directory.CreateDirectory(pdfFilePathUrl);}//指定输出文件路径//string htmlName = customer + DateTime.Now.ToString("yyyyMMdd") + ".html";string pdfName = customer + DateTime.Now.ToString("yyyyMMdd") + ".pdf";//string htmlPath = Path.Combine(htmlFilePathUrl, htmlName);string pdfPath = Path.Combine(pdfFilePathUrl, pdfName);将HTML内容写入文件//File.WriteAllText(htmlPath, htmlContent.ToString());从.html文件中获取HTML字符串//string htmlString = File.ReadAllText(htmlPath);指定插件路径//string pluginPath = "D:\\yonyou\\U9V60\\Portal\\plugins";设置插件//HtmlConverter.PluginPath = pluginPath;将HTML字符串转换为PDF//HtmlConverter.Convert(htmlString, pdfPath, true, 100000, new Size(803, 1188), new PdfMargins(0), Spire.Pdf.HtmlConverter.LoadHtmlType.SourceCode);PdfHelper.CreatePDF(pdfPath, list, customer);}#endregion 服务端生成ZIP文件并下载#region 服务端生成ZIP文件并下载string tempZipFilePath = Path.GetTempFileName();string tempZipFilePath1 = "";string tempZipFilePathZip = "";string script = "";try{if (!Directory.Exists(destinationPathZip)){Directory.CreateDirectory(destinationPathZip);}var safePath = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), destinationPath));if (!Directory.Exists(safePath)){Directory.CreateDirectory(safePath);}// 创建临时ZIP文件//string guid = Guid.NewGuid().ToString();tempZipFilePath1 = Path.Combine(Path.GetTempPath(), FileName + ".zip");System.IO.Compression.ZipFile.CreateFromDirectory(safePath, tempZipFilePath1);File.Copy(tempZipFilePath1, Path.Combine(destinationPathZip, FileName + ".zip"), true);//拼接链接script = @"../\FileZip/" + FileName + @"" + ".zip";//延迟删除文件名称tempZipFilePathZip = destinationPathZip + FileName + @"" + ".zip";script = string.Format("window.open('{0}'); ", script);AtlasHelper.RegisterAtlasStartupScript((Control)_part.TopLevelContainer, _part.GetType(), "downbload", script, true);}finally{// 清理临时文件File.Delete(tempZipFilePath);File.Delete(tempZipFilePath1);}#endregion 服务端生成ZIP文件并下载#region 删除服务端生成的临时文件夹string folderPath = destinationPath; // 替换为你想要删除的文件夹路径try{// 递归删除文件夹及其所有内容Directory.Delete(folderPath, true);var timer = new System.Timers.Timer();timer.Interval = 15000;timer.Elapsed += (sender1, e1) =>{if (!string.IsNullOrEmpty(destinationPathZip))DeleteDirectoryContents(destinationPathZip);timer.Stop();}; timer.Start();//Directory.Delete(destinationPathZip, true);}catch (Exception ex){// 处理任何可能的异常,例如权限问题、路径不存在等//Console.WriteLine("删除文件夹时发生错误: " + ex.Message);_part.Model.ErrorMessage.Message = "删除文件夹时发生错误!";return;}#endregion 删除服务端生成的临时文件夹}catch (Exception ex){_part.Model.ErrorMessage.Message = ex.Message;return;}}public static void DeleteDirectoryContents(string path){foreach (string item in Directory.GetFileSystemEntries(path)){if (File.GetAttributes(item).HasFlag(FileAttributes.Directory)){// 递归删除子目录DeleteDirectoryContents(item);}else{// 删除文件File.Delete(item);}}// 删除空文件夹//Directory.Delete(path);}}
}

需要的帮助类:

1、生成PDF
using iTextSharp.text.pdf.draw;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System;
using System.IO;
using System.Data;
using UFIDA.U9.Cust.HuaRui.HuaRExtendUI;
using System.Collections.Generic;
using System.Linq;namespace UFIDA.U9.Cust.HuaRui.HuaRExtendUIPlug
{public class PdfHelper{private static void SetImg(PdfWriter writer, string path, float fitWidth, float fitHeight, float absoluteX, float absoluteY){try{Image image = Image.GetInstance(path);image.Alignment = Element.ALIGN_MIDDLE;image.ScaleToFit(fitWidth, fitHeight);image.SetAbsolutePosition(absoluteX, absoluteY);writer.DirectContent.AddImage(image);}catch (Exception e){Console.WriteLine(e.Message);throw e;}}public static void CreatePDF(string fileName, List<ProvideAccount> list, string CustomerName){try{Document document = new Document(new Rectangle(803, 1188), 30F, 30F, 100F, 100F);//fileName = Path.GetFullPath("../..") + @"\PdfFiles\" + fileName + ".pdf";PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(fileName, FileMode.Create));// 定义页眉和页脚页码事件PDFBuilder builder = new PDFBuilder();builder.CustomerName = CustomerName;//设置页面监听事件writer.PageEvent = builder;document.Open();//换行Paragraph newLine = new Paragraph("\n");float tableWidthPercentage = 100f; //表格的整体宽度//表格背景色BaseColor green = new BaseColor(175, 215, 136);BaseColor blue = new BaseColor(148, 170, 214);//所需字体string fontPath = Path.GetFullPath("../..") + @"\fonts\";string timesPath = fontPath + "TIMES.TTF";string timesBdPath = fontPath + "TIMESBD.TTF";BaseFont bf = BaseFont.CreateFont(timesPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);BaseFont blodbf = BaseFont.CreateFont(timesBdPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);Font coverFont = new Font(blodbf, 30, Font.NORMAL);Font titleFont = new Font(blodbf, 16, Font.NORMAL);Font coverTiletFontMarked = new Font(blodbf, 16f, Font.NORMAL, new BaseColor(148, 170, 214));Font textFontBold = new Font(blodbf, 10.5f, Font.NORMAL);Font textFont = new Font(bf, 10.5f, Font.NORMAL);Font textFontGray = new Font(blodbf, 10.5f, Font.NORMAL, new BaseColor(215, 215, 215));Font chapterFont = new Font(blodbf, 14f, Font.NORMAL);//设置字体,支持中文BaseFont bfChinese = BaseFont.CreateFont("C:\\WINDOWS\\Fonts\\msyh.ttc,1", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);iTextSharp.text.Font fontChinese = new iTextSharp.text.Font(bfChinese, 7, iTextSharp.text.Font.NORMAL, new BaseColor(0, 0, 0));//获取datatable数据DataTable Data = GetDataTableList(list);PdfPTable dataTb = new PdfPTable(Data.Columns.Count);dataTb.SetWidths(new float[] { 0.04f, 0.06f, 0.06f, 0.06f, 0.08f, 0.06f, 0.06f, 0.06f, 0.06f, 0.06f, 0.06f, 0.08f, 0.06f, 0.06f, 0.06f, 0.06f, 0.06f, 0.06f, 0.06f });// 每个单元格占多宽dataTb.WidthPercentage = tableWidthPercentage;dataTb.DefaultCell.BorderColor = BaseColor.LIGHT_GRAY;dataTb.DefaultCell.Padding = 1;dataTb.DefaultCell.BorderWidth = 1;dataTb.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; // 设置单元格内容水平居中dataTb.DefaultCell.VerticalAlignment = Element.ALIGN_MIDDLE; // 设置单元格内容垂直居中//将datatable表头转换成PDFTable的表头foreach (DataColumn dc in Data.Columns){dataTb.AddCell(new Phrase(dc.ColumnName.ToString(), fontChinese));}//插入数据for (int i = 0; i < Data.Rows.Count; i++){for (int j = 0; j < Data.Columns.Count; j++){dataTb.AddCell(new Phrase(Data.Rows[i][j].ToString(), fontChinese));}}document.Add(dataTb);document.Add(newLine);document.Close();}catch (Exception ex){throw new Exception("PDF生成失败-错误信息:" + ex.Message);}}/// <summary>/// 创建默认dataTable数据/// </summary>/// <returns></returns>public static DataTable GetDataTableList(List<ProvideAccount> list){DataTable dt = new DataTable();dt.Columns.Add("序号", typeof(string));//添加列  dt.Columns.Add("合同日期", typeof(string));//添加列 dt.Columns.Add("合同编码", typeof(string));//添加列 dt.Columns.Add("客户PO号", typeof(string));//添加列 dt.Columns.Add("项目名称", typeof(string));//添加列 dt.Columns.Add("最终合同金额", typeof(string));//添加列 dt.Columns.Add("出库金额", typeof(string));//添加列 dt.Columns.Add("已开票金额", typeof(string));//添加列 dt.Columns.Add("已付款金额", typeof(string));//添加列 dt.Columns.Add("应收金额", typeof(string));//添加列 dt.Columns.Add("逾期金额", typeof(string));//添加列 dt.Columns.Add("付款方式", typeof(string));//添加列 dt.Columns.Add("到期时间", typeof(string));//添加列 dt.Columns.Add("发货完成", typeof(string));//添加列 dt.Columns.Add("合同状态", typeof(string));//添加列 dt.Columns.Add("业务员", typeof(string));//添加列 dt.Columns.Add("业务单元", typeof(string));//添加列 dt.Columns.Add("历史合同编号", typeof(string));//添加列 dt.Columns.Add("初始合同金额", typeof(string));//添加列 //循环添加行的数据int num = 1;foreach (var item in list){DataRow dtRow = dt.NewRow();dtRow["序号"] = num;dtRow["合同日期"] = item.CreatedOn;dtRow["合同编码"] = item.HisCRMDocNo;dtRow["客户PO号"] = item.CustomerPO;dtRow["项目名称"] = item.ProjectName;dtRow["最终合同金额"] = item.ContractAmount;dtRow["出库金额"] = item.ShipSumMoney;dtRow["已开票金额"] = item.InvoicedAmount;dtRow["已付款金额"] = item.BalanceAmount;dtRow["应收金额"] = item.BusinessReceivaBalance;dtRow["逾期金额"] = item.AnticipatoryRight;dtRow["付款方式"] = item.ConfirmTermName;dtRow["到期时间"] = item.EstimatedPayDate;dtRow["发货完成"] = item.IsCompletedShip;dtRow["合同状态"] = item.contarctsState;dtRow["业务员"] = item.OperatorsName;dtRow["业务单元"] = item.BusinessUnit;dtRow["历史合同编号"] = item.CRMDocNo;dtRow["初始合同金额"] = item.OriginalContractAmount;dt.Rows.Add(dtRow);num++;}//添加合计行DataRow dtRow2 = dt.NewRow();dtRow2["序号"] = "";dtRow2["合同日期"] = "";dtRow2["合同编码"] = "";dtRow2["客户PO号"] = "";dtRow2["项目名称"] = "合计";dtRow2["最终合同金额"] = list.Sum(x => x.ContractAmount);dtRow2["出库金额"] = list.Sum(x => x.ShipSumMoney);dtRow2["已开票金额"] = list.Sum(x => x.InvoicedAmount);dtRow2["已付款金额"] = list.Sum(x => x.BalanceAmount);dtRow2["应收金额"] = list.Sum(x => x.BusinessReceivaBalance);dtRow2["逾期金额"] = list.Sum(x => x.AnticipatoryRight);dtRow2["付款方式"] = "";dtRow2["到期时间"] = "";dtRow2["发货完成"] = "";dtRow2["合同状态"] = "";dtRow2["业务员"] = "";dtRow2["业务单元"] = "";dtRow2["历史合同编号"] = "";dtRow2["初始合同金额"] = list.Sum(x => x.OriginalContractAmount);dt.Rows.Add(dtRow2);return dt;}private static PdfPCell GetCell(Phrase phrase, BaseColor color, int colSpan, int rowSpan){PdfPCell cells = new PdfPCell(phrase);cells.UseAscender = true;cells.MinimumHeight = 20f;cells.HorizontalAlignment = Element.ALIGN_CENTER;cells.VerticalAlignment = 5;cells.Colspan = colSpan;cells.Rowspan = rowSpan;cells.NoWrap = false;if (color != null){cells.BackgroundColor = color;}return cells;}}
}
2、设置页眉和页脚
using System;
using System.IO;
using iTextSharp.text.pdf;
using iTextSharp.text;namespace UFIDA.U9.Cust.HuaRui.HuaRExtendUIPlug
{public class PDFBuilder : PdfPageEventHelper{public string CustomerName;// 模板public PdfTemplate total;// 基础字体对象public BaseFont bf = null;// 利用基础字体生成的字体对象,一般用于生成中文文字public Font fontDetail = null;/// <summary>/// 文档打开时创建模板/// </summary>/// <param name="writer"></param>/// <param name="document"></param>public override void OnOpenDocument(PdfWriter writer, Document document){total = writer.DirectContent.CreateTemplate(50, 50);// 共 页 的矩形的长宽高}/// <summary>/// 关闭每页的时候,写入页眉,页脚。/// </summary>/// <param name="writer"></param>/// <param name="document"></param>public override void OnEndPage(PdfWriter writer, Document document){this.AddPage(writer, document);}public static void SetImg(PdfWriter writer, string path, float fitWidth, float fitHeight, float absoluteX, float absoluteY){try{Image image = Image.GetInstance(path);image.Alignment = Element.ALIGN_MIDDLE;image.ScaleToFit(fitWidth, fitHeight);image.SetAbsolutePosition(absoluteX, absoluteY);writer.DirectContent.AddImage(image);}catch (Exception e){Console.WriteLine(e.Message);throw e;}}/// <summary>/// 加分页/// </summary>/// <param name="writer"></param>/// <param name="document"></param>public void AddPage(PdfWriter writer, Document document){if (document.PageNumber >=1){string fontPath = Path.GetFullPath("../..") + @"\fonts\";try{string timesPath = fontPath + "TIMES.TTF";bf = BaseFont.CreateFont(timesPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);}catch (Exception e){Console.WriteLine(e.Message);throw e;}BaseFont blodf = null;try{string timesBdPath = fontPath + "TIMESBD.TTF";blodf = BaseFont.CreateFont(timesBdPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);}catch (Exception e){Console.WriteLine(e.Message);throw e;}//设置字体,支持中文BaseFont bfChinese = BaseFont.CreateFont("C:\\WINDOWS\\Fonts\\msyh.ttc,1", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);iTextSharp.text.Font fontChinese = new iTextSharp.text.Font(bfChinese, 16, iTextSharp.text.Font.BOLD, new BaseColor(0, 0, 0));iTextSharp.text.Font fontChinese1 = new iTextSharp.text.Font(bfChinese, 7, iTextSharp.text.Font.NORMAL, new BaseColor(0, 0, 0));//Phrase pageNumberPh = new Phrase("page " + (document.PageNumber - 1), fontChinese);float center = document.PageSize.Right / 2;//页面的水平中点float headerleft = document.PageSize.GetLeft(50);//页面的z左边距float right = document.PageSize.GetRight(90);//页面的z左边距float top = document.PageSize.Top - 36;float bottom = document.PageSize.Bottom + 10;float x = document.PageSize.Width / 3;float y = document.PageSize.Top - 30;Phrase header = new Paragraph("浙江华睿科技股份有限公司货款对账表", fontChinese);Paragraph header1 = new Paragraph("致:" + CustomerName, fontChinese1);Paragraph header2 = new Paragraph("现将浙江华睿科技股份有限公司与贵单位的经济业务往来情况知会贵单位,请核对并按照协议约定时间支付货款,到期货款请尽快支付", fontChinese1);Paragraph header3 = new Paragraph("贵公司往来货款情况明细如下:(单位:元 对账截止:", fontChinese1);Paragraph header4 = new Paragraph(DateTime.Now.ToString("yyyy-MM-dd"), fontChinese1);ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, header, x, y, 0); //页眉标题ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, header1, headerleft, y - 20, 0); //页眉内容ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, header2, headerleft, y - 35, 0); //页眉ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, header3, headerleft, y - 50, 0); //页眉ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_RIGHT, header4, right + 20, y - 50, 0); //页眉//ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_CENTER, pageNumberPh, center, bottom - 20, 0); //页码Phrase pageNumberPh = new Phrase("说明:多页账单请盖骑缝章,谢谢配合", fontChinese1);Paragraph header11 = new Paragraph("浙江华睿科技股份有限公司(盖章)", fontChinese1);Paragraph header12 = new Paragraph("(盖章)", fontChinese1);Paragraph header13 = new Paragraph(CustomerName, fontChinese1);Paragraph header21 = new Paragraph("日期:", fontChinese1);Paragraph header22 = new Paragraph("日期:", fontChinese1);Paragraph header31 = new Paragraph("对账人(签字):", fontChinese1);Paragraph header32 = new Paragraph("对账人(签字):", fontChinese1);Paragraph header41 = new Paragraph("不符原因:", fontChinese1);ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_CENTER, pageNumberPh, center, bottom + 70, 0); //页脚ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, header11, headerleft, bottom + 45, 0); //页脚内容ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, header12, x + 120, bottom + 45, 0); //页脚内容ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, header13, right - 60, bottom + 45, 0); //页脚内容ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, header21, headerleft, bottom + 30, 0); //页脚内容ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, header22, x + 120, bottom + 30, 0); //页脚内容ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, header31, headerleft, bottom + 15, 0); //页脚内容ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, header32, x + 120, bottom + 15, 0); //页脚内容ColumnText.ShowTextAligned(writer.DirectContent, Element.ALIGN_LEFT, header41, x + 120, bottom, 0); //页脚内容}}/// <summary>/// 关闭文档时,替换模板,完成整个页眉页脚组件/// </summary>/// <param name="writer"></param>/// <param name="document"></param>public override void OnCloseDocument(PdfWriter writer, Document document){// 关闭文档的时候,将模板替换成实际的 Y 值,至此,page x of y 制作完毕,完美兼容各种文档size。total.BeginText();total.SetFontAndSize(bf, 9);// 生成的模版的字体、颜色string foot2 = " " + (writer.PageNumber) + " 页"; //页脚内容拼接  如  第1页/共2页total.ShowText(foot2);// 模版显示的内容total.EndText();total.ClosePath();}}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/72146.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【RabbitMQ】Spring Boot 结合 RabbitMQ 完成应用间的通信

&#x1f525;个人主页&#xff1a; 中草药 &#x1f525;专栏&#xff1a;【中间件】企业级中间件剖析 Spring 框架与 RabbitMQ 的整合主要通过 Spring AMQP&#xff08;Advanced Message Queuing Protocol&#xff09;模块实现&#xff0c;提供了便捷的消息队列开发能力。 引…

UVC摄像头命令推流,推到rv1126里面去

ffmpeg命令查询UVC设备 .\ffmpeg.exe -list_devices true -f dshow -i dummy 上图是查询UVC设备的效果图&#xff0c;画红框的部分是UVC设备的设备名称"USB2.0 PC CAMERA"和设备号 "device_pnp_\\?\usb#vid_1908&pid_2310&mi_00#8&39abfe5&0&a…

Linux中的基本指令(上)

目录 ls指令 判断linux中文件 pwd指令 认识路径 ​编辑 绝对路径/相对路径 cd指令 简要理解用户 理解家目录 echo指令和printf指令 touch指令 mkdir指令 cat指令 tree指令 rmdir指令和rm指令 man指令 cp指令 which指令 alias 指令 date指令 cal指令 理解…

Qt 数据库操作(Sqlite)

数据库简介 关于数据库的基础知识这里就不做介绍了&#xff0c;相关博客可以查看&#xff1a; SQL基础知识 数据库学霸笔记 上面博客都写的比较详细&#xff0c;本文主要介绍如何使用Qt进行数据库相关操作&#xff0c;数据库分为关系型数据库和非关系型数据&#xff0c;关系…

网络安全 api 网络安全 ast技术

随着应用或者API被攻击利用已经越来越多&#xff0c;虽然来自开源组件的漏洞加剧了这一现象的发生&#xff0c;但是&#xff0c;其实主要还是在于应用程序或者API本身没有做好防范&#xff0c;根源在于源代码本身的质量没有严格把控。AST是指Application Security Testing&…

Mac 配置 Maven JDK

不使用 Homebrew&#xff0c;创建指定版本 JDK 1、官网下载指定版本并安装……省略 2、vi &#xff5e;/.zshrc 同时要检查 bash_profile 是否存在。 if [ -f ~/.bash_profile ] ; thensource ~/.bash_profile fiJAVA_HOME_11/Library/Java/JavaVirtualMachines/jdk-11.0.1…

【病毒分析】熊猫烧香病毒分析及其查杀修复

目录 前言 一、样本概况 1.1 样本信息 1.2 测试环境及工具 1.3 分析目标 二、具体行为分析 2.1 主要行为 2.1.1 恶意程序对用户造成的危害 2.2 恶意代码分析 2.2.1 加固后的恶意代码树结构图(是否有加固) 2.2.2 恶意程序的代码分析片段 三、解决方案(或总结) 3.1 …

sqli-lab靶场学习(八)——Less26-28

前言 25关已经出现了初步的一些关键字过滤&#xff0c;通过双写可以绕过。后面的关卡&#xff0c;我们会遇到更多关键字过滤&#xff0c;需要各种技巧绕过。 Less26 第26关写了会过滤空格和注释符。有很多的答案&#xff0c;会用%a0替代空格&#xff0c;但据说这是sqli-labs部…

python:VOC格式数据集转换为YOLO数据集格式

作者&#xff1a;CSDN _养乐多_ 本文将介绍如何将目标检测中常用的VOC格式数据集转换为YOLO数据集&#xff0c;并进行数据集比例划分&#xff0c;从而方便的进行YOLO目标检测。 如果不想分两步&#xff0c;可以直接看第三节代码。 文章目录 一、将VOC格式数据集转换为YOLO格…

Docker容器安装软件(完整版)

文章目录 一、安装Docker1.1 docker 相关的命令1.2 配置镜像加速 二. 安装es2.1 创建网络2.2 拉取镜像2.3 创建挂载点目录2.4 部署单点es&#xff0c;创建es容器2.5 编写elasticsearch.yml2.6 重启es容器2.7 测试Elasticsearch是否安装成功 三. 基于Docker安装Kibana3.1 拉取镜…

NetAssist 5.0.14网络助手基础使用及自动应答使用方案

以下是NetAssist v5.0.14自动应答功能的详细使用步骤&#xff1a; 一、基础准备&#xff1a; 工具下载网址页面&#xff1a;https://www.cmsoft.cn/resource/102.html 下载安装好后&#xff0c;根据需要可以创建多个server&#xff0c;双击程序图标运行即可&#xff0c;下面…

node.js-node.js作为服务器,前端使用WebSocket(单个TCP连接上进行全双工通讯的协议)

1.WebSocket全双工通信协议 WebSocket是HTML5开始提供的一种单个TCP连接上进行全双工通讯的协议。让客户端和服务器间的数据交互变得简单&#xff0c;允许服务端向客户端主动推送数据。浏览器和服务器间只需要完成一次握手&#xff0c;两者间创建持久性的连接&#xff0c;并进行…

java后端开发day31--集合进阶(一)-----Collection集合List集合数据结构1

&#xff08;以下内容全部来自上述课程&#xff09; 1.集合体系结构 List系列集合&#xff1a;添加的元素是有序、可重复、有索引。 Set系列集合&#xff1a;添加的元素是无序、不重复、无索引。 2.Collection集合 Collection是单列集合的祖宗接口&#xff08;不可直接创建…

Qt配置OpenGL相机踩的坑

项目根据LearnOpenGL配置Qt的相机&#xff0c;更新view矩阵和project矩阵的位移向量变得很大&#xff0c;我设置的明明相机位置是(0,0,3)&#xff0c;理想的位移向量刚好是相反数(0,0,-3)&#xff0c;对应的view矩阵位置向量可以变成(0,0,1200)…离模型非常远矩阵模型也看不见&…

关于WPS的Excel点击单元格打开别的文档的两种方法的探究【为单元格添加超链接】

问题需求 目录和文件结构如下&#xff1a; E:\Dir_Level1 │ Level1.txt │ └─Dir_Level2│ Level2.txt│ master.xlsx│└─Dir_Level3Level3.txt现在要在master.xlsx点击单元格进而访问Level1.txt、Level2.txt、Level3.txt这些文件。 方法一&#xff1a;“单元格右键…

聚类中的相似矩阵和拉普拉斯矩阵

前言&#xff08;可以略过&#xff09; 最近在看的是关于聚类的论文&#xff0c;之前对聚类的步骤和相关内容不太了解&#xff0c;为了读懂论文就去学习了一下&#xff0c;这里将自己的理解记录下来。学习的不全面&#xff0c;主要是为了看懂论文&#xff0c;后续如果有涉及到聚…

前端笔记 --- vue框架

目录 基础知识 指令的修饰符 计算属性 watch侦听器的写法 Vue的生命周期 工程化开发&脚手架 VUE CLI 组件注册的方式 scoped样式冲突与原理 data 组件之间的关系和组件通信 v-model详解 sync修饰符 Dom介绍 操作HTML标签 总结 ref 和 $refs $nextTick 自…

智能双剑合璧:基于语音识别与大模型的技术沙龙笔记整理实战

智能双剑合璧&#xff1a;基于语音识别与大模型的技术沙龙笔记整理实战 ——记一次网络安全技术沙龙的高效知识沉淀 引言&#xff1a;当网络安全遇上AI生产力工具 在绿盟科技举办的"AI驱动的未来网络安全"内部技术沙龙中&#xff0c;笔者亲历了一场关于网络安全攻…

数据结构(蓝桥杯常考点)

数据结构 前言&#xff1a;这个是针对于蓝桥杯竞赛常考的数据结构内容&#xff0c;基础算法比如高精度这些会在下期给大家总结 数据结构 竞赛中&#xff0c;时间复杂度不能超过10的7次方&#xff08;1秒&#xff09;到10的8次方&#xff08;2秒&#xff09; 空间限制&#x…

第56天:Web攻防-SQL注入增删改查盲注延时布尔报错有无回显错误处理审计复盘

#知识点 1、Web攻防-SQL注入-操作方法&增删改查 2、Web攻防-SQL注入-布尔&延时&报错&盲注 一、增删改查 1、功能&#xff1a;数据查询 查询&#xff1a;SELECT * FROM news where id$id 2、功能&#xff1a;新增用户&#xff0c;添加新闻等 增加&#xff1a;IN…