Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Automaticly merge pdf files in a folder


  • Please log in to reply
3 replies to this topic
yusufsarikaya
  • Members
  • 1 posts
  • Last active: Oct 23 2015 01:34 PM
  • Joined: 23 Oct 2015

i want to merge pdf files in a folder...

for example i have 10 pdf files at my folder (C:\myfolder)

i want to merge 10 files to 1 files 

but have to make this automaticly 

 



Azevedo
  • Members
  • 179 posts
  • Last active: Nov 04 2015 04:37 PM
  • Joined: 07 Mar 2012

You will find some free pdf merging tools on the web. search for it.



tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: May 02 2019 09:16 PM
  • Joined: 21 Dec 2007

https://github.com/itext/itextsharp

http://sourceforge.n...cts/itextsharp/


Never lose.
WIN or LEARN.

RickC
  • Members
  • 123 posts
  • Last active: Nov 08 2016 05:19 AM
  • Joined: 13 Nov 2005

I wrote a wrapper for PDFtk Free years ago when it was at v1.41 to create a GUI front-end for bulk-merging PDFs. Now PDFtk Free is at v2.02 I see it now includes a GUI... so this may be all you need.

 

If you want an AHK front-end, try this:

Gui, Add, Text, x25 y10 w170 h20 , Select INPUT folder
Gui, Add, Button, x12 y30 w120 h30 , INPUT
Gui, Add, Button, x22 y65 w100 h30 , Cancel
Gui -SysMenu
Gui, Show, w140 h110, PDFMerge
return

ButtonINPUT:
FileSelectFolder, InputVar, , 4 ;Select a source folder

;Count and display the number of files in the source folder for info
count=0
Loop,%InputVar%\*.pdf,0,1
   files:=(files ? "`n" : "") . A_LoopFileFullPath,count:=count+1
MsgBox % "Found " count " PDF files`nNow select the OUTPUT folder."     
    
FileSelectFolder, OutputVar, , 4 ;Select a destination folder

Gui, submit ;Save the selected folders to their associated variables
;MsgBox pdftk %InputVar%\*.pdf cat output %OutputVar%\combined.pdf ;Use MsgBox to test output to commandline
Run %comspec% /c pdftk %InputVar%\*.pdf cat output %OutputVar%\combined.pdf, , hide ;Pass the parameters to pdftk and hide the commandline window on completion

Gui, Destroy ;Close the first GUI so it doesn't muck up the progress bar

;~ ;Create a second GUI showing looping progress bar
;~ ;('cos merging 800 to 2000 PDF's can take several minutes)
;~ ;Credit to polyethene for the progress bar routine
;~ ;http://www.autohotkey.com/community/viewtopic.php?t=13469)
Gui, Add, Progress, vlvl -Smooth 0x8 w350 h18 ; PBS_MARQUEE = 0x8
Gui, Show, , Merging PDF's...    Please wait...
SetTimer, Merging, 45
Return

Merging:
GuiControl, , lvl, 1
Process, Exist, pdftk.exe, ;Check for pdftk
If Errorlevel 
   Return   
SetTimer, Merging, Off ;turn off process timer
Gui, Destroy ;close the second GUI
MsgBox, 64, PDFMerge, Finished! Your merged file is in %OutputVar% ;Inform user that merge process has finished
Run, %OutputVar% ;Open the destination folder to show file
ExitApp

ButtonCancel:
ExitApp

Esc::ExitApp ;Use the Esc key to exit app

Hope this helps...