Skip to content

scheidan/PDFmerger.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDFmerger.jl

Build Status Coverage

A simple package to merge PDF (Portable Document Format) files on Linux, OS X and Windows. The following functions are exported:

  • merge_pdfs
  • append_pdf!
  • split_pdf

Usage

Merging multible PDF files

merge_pdfs(["file_1.pdf", "file_1.pdf", "file_2.pdf"], "merged.pdf")

Note, the same files can be merged multiple times.

Use the cleanup option to delete the single files after merging:

merge_pdfs(["file_1.pdf", "file_1.pdf", "file_2.pdf"], "merged.pdf", cleanup=true)

Appending a PDF to another PDF

Appending with append_pdf! is particularly useful to create a single PDF that contains multiple plots on separate pages:

using Plots

for i in 1:5
    p = plot(rand(33), title="$i");
    savefig(p, "temp.pdf")
    append_pdf!("allplots.pdf", "temp.pdf", cleanup=true)
end

All five plots are contained in allplots.pdf and the temporary file is deleted.

Splitting a PDF

A PDF containing multiple pages can be split in single pages:

split_pdf("book.pdf")

If the argument cleanup = true is given, the original document will be deleted.

Acknowledgments

All the heavy lifting is done by Poppler. Thanks to the maintainers of Poppler and Poppler_jll.jl!

Thanks to @zauster for implementing separate temp files for each worker.

About

A simple Julia library to merge PDF files

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages