//线程组
Task.Factory.StartNew(() =>
{
#region 计时
Stopwatch pdfTime = new Stopwatch();
// 开始计时
pdfTime.Start();
// Word转PDF
EB.Common.Tools.AsposeWordUtil.WordToPdf(FiveMworld);
//停止计时
pdfTime.Stop();
//时间毫秒为单位
var pdfTimems = pdfTime.ElapsedMilliseconds;
// 委托
// 防止委托时关闭页面中断报错
if (this.IsHandleCreated)
{
this.Invoke(new Action(() =>
{
this.lbl_worldtopdf.Text = "约为" + Convert.ToString(pdfTimems * 4 / 1000) + "秒";
this.lbl_worldtopdf.Visible = true;
this.loadingCircle14.Visible = false;
}));
}
#endregion
});
本文介绍了一种使用AsposeWordUtil库将Word文档转换为PDF的方法,并通过计时器记录了转换过程所花费的时间,最后在界面上显示了转换所需的大约秒数。

被折叠的 条评论
为什么被折叠?



