Trying to convert Publisher files to PDF

Ted Hurt 0 Reputation points
2026-09-21T18:55:42.08+00:00

I am trying to convert my publisher files to a pdf file. I have already downloaded the sample script and have gone through all the steps I am supposed to but when I get to the part .\Convert-PubFileToPDF.ps1 -Filter "C:\PublisherFiles*.pub" -Recurse it gives me this error: Write-Error: Cannot find path 'C:\PubConvert\Office.dll' because it does not exist.

How do I get the Convert-PubFileToPDF.ps1. I clicked on the link to download the sample script and it download Convert-PubFileToPDF without the .ps1 extension.

I would appreciate any help I can get.

Thank you.

Microsoft 365 and Office | Publisher | For business
0 comments No comments

1 answer

Sort by: Most helpful
  1. Hendrix 1,670 Reputation points Independent Advisor
    2026-09-21T19:48:29.69+00:00

    Hi Ted,

    Based on your sharing, there are two separate issues in your case: the downloaded script may need its .ps1 extension restored, while the Office.dll message means the required Microsoft Office/Publisher interop component is unavailable or the script is being run in the wrong PowerShell environment.

    I suggest trying these steps:

    • Open File Explorer and select View > Show > File name extensions.
    • If the file is named only Convert-PubFileToPDF, rename it to Convert-PubFileToPDF.ps1 and save it in C:\PubConvert
    • Confirm that the desktop version of Microsoft Publisher is installed and can open a .pub file.
    • Open Windows PowerShell and run these commands one at a time (please note the backslash between PublisherFiles and *.pub):
    cd C:\PubConvert
    Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
    Unblock-File .\Convert-PubFileToPDF.ps1
    .\Convert-PubFileToPDF.ps1 -Filter "C:\PublisherFiles\*.pub" -Recurse
    

    For reference: Microsoft Publisher will no longer be supported after October 2026 | Microsoft Support

    If the error still says that C:\PubConvert\Office.dll cannot be found, repair the installed Office applications following the steps here: Repair an Office application | Microsoft Support. After the repair, restart the computer, verify that Publisher opens normally, and run the script again.

    If you have any questions or need further support, please don’t hesitate to reach out again in the comments of this post. I'm happy to assist you further.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.