Jump to content

Recommended Posts

Posted

Hi everyone,

 

I was wondering if anyone knew of a way of combining several word documents together to then generate one PDF file.

 

Ideally I'm thinking something where you select your files and pick an order and then click Go and it creates a PDF.

 

Does such a thing exist?

 

many thanks.

Posted
Set default printer to a pdf printer that can either a) autosave, or b) append. Select all files, named alphabetically, right click, print. If a) then use pdf split and merge or similar tool to merge them.
  • Thanks 1
Posted
Hi everyone,

 

I was wondering if anyone knew of a way of combining several word documents together to then generate one PDF file.

 

Ideally I'm thinking something where you select your files and pick an order and then click Go and it creates a PDF.

 

Does such a thing exist?

 

many thanks.

 

https://pdfsam.org/

  • Thanks 1
Posted
I was wondering if anyone knew of a way of combining several word documents together to then generate one PDF file.

 

As a one-off thing, or something that will be done reguarly? I'm doing something similar today for our printable school diary, combining a couple of DOCX files and an existing PDF into one PDF document. This is something that will be updated nightly (using up-to-date calendar data from an iCal file), so this is something I'll be running as a schedualed task of some kind from a command line. I plan to use Pandoc:

 

https://pandoc.org/

  • Thanks 1
Posted

Copy the following code into NotePad and then save it as a file with a .VBS extension (VBScript). As long as you have Word installed you can just drag and drop a folder onto this file and it should 1) Open Word, 2) Add each .DOC and .DOCX file from that folder into it - in alphabetical order - and then 3) Prompt you for the name of the PDF to save it as; in the same folder. It's pretty simplistic but does the job. The only issue I've noticed is it doesn't cope if the first page it adds is landscape, but if subsequent ones have landscape content then it sets the orientation fine for those.

 

Set Args = WScript.Arguments

strStartFolder = Args.Item(0)

 

Const wdFormatPDF = 17

Const wdDoNotSaveChanges = 0

Const wdPageBreak = 7

 

Set objWord = CreateObject("Word.Application")

objWord.Visible = True

Set objDoc = objWord.Documents.Add()

Set objSelection = objWord.Selection

 

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFolder = objFSO.GetFolder(strStartFolder)

Set colFiles = objFolder.Files

For Each objFile in colFiles

Set objFSOFile = objFSO.GetFile(objFile.Path)

strExtension = UCase( objFSO.GetExtensionName(objFSOFile) )

If strExtension = "DOCX" Or strExtension = "DOC" Then

objSelection.InsertFile(objFile.Path)

objSelection.InsertBreak(wdPageBreak)

End If

Next

strOutputFile = InputBox("What name do you want to save the PDF as?","PDF NAME",objFolder.Name & ".pdf")

If strOutputFile <> "" Then

strSaveAs = strStartFolder & "" & strOutputFile

If objFSO.FileExists( strSaveAs ) Then objFSO.DeleteFile strSaveAs,True

objDoc.SaveAs2 strSaveAs, wdFormatPDF , , , False , , False , True

End If

objWord.Application.Quit wdDoNotSaveChanges

  • Thanks 1
Posted
Copy the following code into NotePad and then save it as a file with a .VBS extension (VBScript). As long as you have Word installed you can just drag and drop a folder onto this file and it should 1) Open Word, 2) Add each .DOC and .DOCX file from that folder into it - in alphabetical order - and then 3) Prompt you for the name of the PDF to save it as; in the same folder. It's pretty simplistic but does the job. The only issue I've noticed is it doesn't cope if the first page it adds is landscape, but if subsequent ones have landscape content then it sets the orientation fine for those.

 

 

Hi Gary, This looks ideal for what I need to do.

 

Just tried it and getting this error. Any ideas?

 

Thanks again.

pic.jpg

Posted

Looks like your file has been saved incorrectly. I've uploaded it to here: http://www.filedropper.com/word2pdf just remember to turn on popup blocker as this site is quite annoying! Right click and choose Edit once you've downloaded it to check it's the same content as I posted above.

I would recommend looking at a decent text editor like NotePad Plus Plus as sometime NotePad can save text files as an incorrect type (annoyingly not all text is the same!).

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...