Merge And Split PDF In PHP Using PDFtk

Merge And Split PDF In PHP Using PDFtk

Merge a group of PDF files to a single PDF file without disturbing the contents using PDFtk.

  • PDFtk runs on a variety of platforms, including Windows, Linux, Mac OSX, FreeBSD, and Solaris.
  • It does not require Acrobat and allows you to manipulate PDF easily and freely.

What All You Can Do in PHP Using PDFtk

  • Merge PDF documents to one.
  • Rotate PDF Pages or documents.
  • Split the pages of the PDF into a new document.
  • Encrypt the output as desired.
  • Decrypt the Input as necessary but requires a password
  • Background watermark or a foreground stamp can be applied
  • Report on PDF metrics can be generated such as metadata, bookmarks, and page labels.
  • Update PDF metadata.
  • Attach numerous files to the PDF document.
  • Compress a PDF document into a single page.

Under the GPL, PDFtk is licensed for the public.

Download Link: https://github.com/bensquire/php-pdtfk-toolkit

Examples:

You can provide two or more PDF files as arguments to create a single PDF file as output.
Merge two or more PDFs into a new PDF file with all the original contents

  • pdftk example1.pdf example2.pdf example3.pdf cat output result.pdf

Rotate the first page of a PDF to 90 degrees clockwise

  • pdftk in.pdf cat 1E 2-end output out.pdf

Rotate all the pages of the PDF document by 180 degrees

  • pdftk in.pdf cat 1-endS output out.pdf

Report on PDF document metadata, bookmarks and page labels

  • pdftk mydoc.pdf dump_data output report.txt