File: alter.py

package info (click to toggle)
pdfrw 0%2Bsvn136-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 208 kB
  • sloc: python: 1,761; makefile: 2
file content (25 lines) | stat: -rwxr-xr-x 433 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python

'''
usage:   alter.py my.pdf

Creates alter.my.pdf

Demonstrates making a slight alteration to a preexisting PDF file.

'''

import sys
import os

import find_pdfrw
from pdfrw import PdfReader, PdfWriter

inpfn, = sys.argv[1:]
outfn = 'alter.' + os.path.basename(inpfn)

trailer = PdfReader(inpfn)
trailer.Info.Title = 'My New Title Goes Here'
writer = PdfWriter()
writer.trailer = trailer
writer.write(outfn)