Last active
April 4, 2021 22:22
-
-
Save allefgomes/b78da8ca10744955be23d8116af3189d to your computer and use it in GitHub Desktop.
Merge all pdfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'combine_pdf' | |
pdf = CombinePDF.new | |
# Verify all files | |
p '##################### Search files #####################' | |
Dir.entries(Dir.pwd).each do |file| | |
# Merge files | |
pdf << CombinePDF.load(file) unless File.extname(file) != ".pdf" | |
end | |
# Save file | |
pdf.save "name_of_my_pdf.pdf" | |
p '############################## Saved File in Dir.pwd ##############################' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great code. Congratulations!!!