AJWhite1970 Posted July 8, 2019 Posted July 8, 2019 So, I have eleventy-billion M$ Office files (.docx, .xlsx and .pptx) in a large directory structure and I need to convert the lot to pdf (just don't ask OK....) I've tried the bulk converter in Acrobat Pro but that just crashes and moans about missing plug-in installations (google says this is pretty much par for the course) and repair does nothing. Is there a clever way of doing this that I have missed? Anyone got a massively brilliant script I can blag? Anything to save my sanity appreciated Andrew
RichCowell Posted July 8, 2019 Posted July 8, 2019 I've recently discovered Doxillion - and there's a free version that suited my needs... https://www.nchsoftware.com/documentconvert/index.html - worth a try 2
chris_uk Posted July 8, 2019 Posted July 8, 2019 $documents_path = 'C:\temp\' $word_app = New-Object -ComObject Word.Application # This filter will find .doc as well as .docx documents Get-ChildItem -Path $documents_path -Filter *.xml? | ForEach-Object { $document = $word_app.Documents.Open($_.FullName) $pdf_filename = "$($_.DirectoryName)\$($_.BaseName).pdf" $document.SaveAs([ref] $pdf_filename, [ref] 17) $document.Close() } $word_app.Quit() remove-item c:\temp\*.xml I use this to batch convert our reports from SIMS to PDF. You could amend to use Excel etc for your means. 1
3s-gtech Posted July 8, 2019 Posted July 8, 2019 Powershell. # Acquire a list of DOCX files in a folder #$File= "C:\Foofolder\foofile.docx" - UNCOMMENT IF NEEDED $Files=GET-CHILDITEM "\\server\shares\foldername\*.DOCX" $Word=NEW-OBJECT –COMOBJECT WORD.APPLICATION Foreach ($File in $Files) { # open a Word document, filename from the directory $Doc=$Word.Documents.Open($File.fullname) # Swap out DOCX with PDF in the Filename $Name=($Doc.Fullname).replace("docx","pdf") # Save this File as a PDF in Word 2010/2013 $Doc.saveas([ref] $Name, [ref] 17) $Doc.close() } Rinse and repeat. I've used this for some big bulk runs and it's ace. 1
AJWhite1970 Posted July 8, 2019 Author Posted July 8, 2019 Thanks everyone - Doxillion got me out of a hole short term, I'll have a look at the two scripts when I get a sec 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now