I know how to do that, but doing them all would take… ok, probably a little over and hour. So not THAT long, but I’d much prefer to leave a script running
Press Start and type in powershell, and open powershell.
Copy the code below into notepad and replace C:\PubFiles with the path to your folder, then copy the script and paste it into the powershell window by right clicking on the window (it pastes when you right click).
I know how to do that, but doing them all would take… ok, probably a little over and hour. So not THAT long, but I’d much prefer to leave a script running
I haven’t seen an official script, but found one on the MS learn site that should work.
https://learn.microsoft.com/en-us/answers/questions/5399481/i-have-some-old-pub-files-which-i-want-to-convert
You need to have publisher installed.
Copy all your PUB files into a folder.
Press Start and type in powershell, and open powershell.
Copy the code below into notepad and replace
C:\PubFiles
with the path to your folder, then copy the script and paste it into the powershell window by right clicking on the window (it pastes when you right click).(You might need to press enter after pasting it)
$PubFilePath = "C:\PubFiles" $publisher = New-Object -ComObject Publisher.Application $files = Get-ChildItem $PubFilePath -Recurse -Filter \*.pub foreach ($file in $files) { try{ $doc = $publisher.Open($file.FullName) $pdfPath = \[System.IO.Path]::ChangeExtension($file.FullName, ".pdf") $doc.ExportAsFixedFormat(\[Microsoft.Office.Interop.Publisher.PbFixedFormatType]::pbFixedFormatTypePDF, $pdfPath) $doc.Close() } catch { Write-Error "Failed to convert $($file.FullName)" } } $publisher.Quit()
Handling a running application like it’s just some object in the memory feels so deeply cursed for some reason.
I kinda like it