Giter Club home page Giter Club logo

pypdftk's Introduction

pypdftk

Python module to drive the awesome pdftk binary.

Proudly brought to you by the revolunet team

Features

fill_form

Fill a PDF with given data and returns the output PDF path

  • pdf_path : input PDF
  • datas : dictionnary of fielf names / values
  • out_file (default=auto) : output PDF path. will use tempfile if not provided
  • flatten (default=True) : flatten the final PDF

concat

Merge multiple PDFs into one single file and returns the output PDF path

  • files : list of PDF files to concatenate
  • out_file (default=auto) : output PDF path. will use tempfile if not provided

split

Split a single PDF in many pages and return a list of pages paths

  • pdf_path : input PDF
  • out_dir (default=auto) : output PDFs dir. will use tempfile if not provided

warning if you give a out_dir parameter, ensure its empty, or the split function may destroy your files and return incorrect results.

gen_xfdf

Generate a XFDF file suited for filling PDF forms and return the generated XFDF file path

  • datas : dictionnary of datas

get_num_pages

Return the number of pages for a given PDF

  • pdf_path : input PDF file

Example

Fill a PDF model and add a cover page :

import pypdftk

datas = {
    'firstname': 'Julien',
    'company': 'revolunet',
    'price': 42
}
generated_pdf = pypdftk.fill_form('/path/to/model.pdf', datas)
out_pdf = pypdftk.merge(['/path/to/cover.pdf', generated_pdf])

Licence

This module is released under the permissive MIT license. Your contributions are always welcome.

pypdftk's People

Contributors

revolunet avatar andebauchery avatar gfavre avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.