有proE或ad工程图设计大神吗!请教一下大家 |
支持多页WORD 转换成PDF的工具,
支持多页,生成后的PDF在格式,排版上与WORD无差异。欢迎咨询
@Bayern1120 主要是最后的效果,对于排班没有什么要求的可以用word的功能转
@stargazer 嗯有很多手段。需求不一样
@stargazer 可能是的
@VensonEEE 大佬好摩拜
Powershell脚本即可调用office的COM接口来批量转换为PDF,楼主干点正事吧
function ConvertWordTo-PDF {
<#
.SYNOPSIS
ConvertTo-PDF converts Microsoft Word documents to PDF files.
.DESCRIPTION
The cmdlet queries the given source folder including sub-folders to find *.docx and *.doc files,
converts all found files and saves them as pdf in the Destination folder. After completition, the Destination
folder with the newly created PDF files will be opened with Windows Explorer.
.PARAMETER SourceFolder
Mandatory. Enter the source folder of your Microsoft Word documents.
.PARAMETER DestinationFolder
Optional. Enter the Destination folder to save the created PDF documents. If you omit this parameter, pdf files will
be saved in the Source Folder.
.EXAMPLE
ConvertWordTo-PDF -SourceFolder C:\Temp -DestinationFolder C:\Temp1
ConvertWordTo-PDF -SourceFolder C:\temp
.NOTES
Author: Patrick Gruenauer | Microsoft PowerShell MVP [2018-2021]
Web: https://sid-500.com
[CmdletBinding()]
param
(
[Parameter (Mandatory=$true,Position=0)]
[String]
$SourceFolder,
[Parameter (Position=1)]
[String]
$DestinationFolder = $SourceFolder
)
$i = 0
$word = New-Object -ComObject word.application
$FormatPDF = 17
$word.visible = $false
$types = '*.docx','*.doc'
If ((Test-Path $SourceFolder) -eq $false) {
throw "Error. Source Folder $SourceFolder not found." }
If ((Test-Path $DestinationFolder) -eq $false) {
throw "Error. Destination Folder $DestinationFolder not found." }
$files = Get-ChildItem -Path $SourceFolder -Include $Types -Recurse -ErrorAction Stop
''
Write-Warning "Converting Files to PDF ..."
''
foreach ($f in $files) {
$path = $DestinationFolder + '\' + $f.Name.Substring(0,($f.Name.LastIndexOf('.')))
$doc = $word.documents.open($f.FullName)
$doc.saveas($path,$FormatPDF)
$doc.close()
Write-Output "$($f.Name)"
$i++
}
''
Write-Output "$i file(s) converted."
Start-Sleep -Seconds 2
Invoke-Item $DestinationFolder
$word.Quit()
}
@wangshifu 摩拜
过早客微信公众号:guozaoke • 过早客新浪微博:@过早客 • 广告投放合作微信:fullygroup50 鄂ICP备2021016276号-2 • 鄂公网安备42018502001446号