当前位置:网站首页>visio文件批量转pdf
visio文件批量转pdf
2022-08-11 05:33:00 【hello_zard】
# Convert Visio (2013) documents to PDF
$drawings = Get-ChildItem -Filter "*.vsdx"
Write-Host "Converting Visio documents to PDF..." -ForegroundColor Cyan
try
{
$visio = New-Object -ComObject Visio.Application
$visio.Visible = $true
foreach ($drawing in $drawings)
{
$pdfname = [IO.Path]::ChangeExtension($drawing.FullName, '.pdf')
Write-Host "Converting:" $drawing.FullName "to" $pdfname
$document = $visio.Documents.Open($drawing.FullName)
# Export all pages to PDF, see constants here http://msdn.microsoft.com/en-us/library/office/ff766893.aspx
$document.ExportAsFixedFormat(1, $pdfname, 1, 0)
}
}
catch
{
Write-Error $_
}
finally
{
if ($visio)
{
$visio.Quit()
}
}代码保存未hello.ps1
右键hello.ps1,点击Powershell运行,然后就会读取本目录下全部vsdx后缀的文件,然后程序会自动调用电脑的visio程序打开文档然后转为pdf后就会自动关闭visio文档,转换后的pdf就在当前文件夹下面。
边栏推荐
猜你喜欢
随机推荐
胖鸟博客之勒索病毒紧急处理文件恢复及防范方案
中国移动通信集团有限公司:业务委托书
SSL证书为什么要选付费?
电脑录屏的简单方法
What should I do if I forget the user password in MySQL?
C# async/await异步操作实例
欧拉角、四元数与旋转
Es常用操作和经典case整理
【力扣】同构字符串
No threat of science and technology - TVD vulnerability information daily - 2022-8-4
Threatless Technology-TVD Daily Vulnerability Intelligence-2022-7-25
Content Size Fitter的使用
2022年全国职业技能大赛网络安全竞赛试题B模块自己解析思路(2)
ETCD集群故障应急恢复-本地数据可用
(2) Software Testing Theory (*Key Use Case Method Writing)
Threatless Technology-TVD Daily Vulnerability Intelligence-2022-7-27
slurm集群搭建
解决8080端口被占用问题
Threatless Technology-TVD Daily Vulnerability Intelligence-2022-7-26
Jedis连接问题!!









