Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

extract x y coordinates from image in pdf python

import sys
import pyPdf

def extract(in_file, coords, out_file):
    with open(in_file, 'rb') as infp:
        reader = pyPdf.PdfFileReader(infp)
        page = reader.getPage(0)
        writer = pyPdf.PdfFileWriter()
        page.mediaBox.lowerLeft = coords[:2]
        page.mediaBox.upperRight = coords[2:]
        # you could do the same for page.trimBox and page.cropBox
        writer.addPage(page)
        with open(out_file, 'wb') as outfp:
            writer.write(outfp)

if __name__ == '__main__':
    in_file = sys.argv[1]
    coords = [int(i) for i in sys.argv[2:6]]
    out_file = sys.argv[6]

    extract(in_file, coords, out_file)
Comment

PREVIOUS NEXT
Code Example
Python :: tranking de perosnas python 
Python :: change group box title font size 
Python :: emacs pipenv not working 
Python :: Young C so new(pro.cashmoneyap x nazz music) soundcloud 
Python :: is cobol obsolete 
Python :: fizz buzz python 
Python :: python converter to c 
Python :: Highlighting the shortest path in a Networkx graph 
Python :: python regex words with apostrophe in middle 
Shell :: bash watch cpu frequency, linux cpu frequency, linux live cpu frequency 
Shell :: add-apt-repository command not found 
Shell :: build-essential package equivalent for fedora 
Shell :: restart postgres ubuntu 
Shell :: dotnet ef scaffold sqlite 
Shell :: nginx restart 
Shell :: uninstall wps office 
Shell :: maven skip tests 
Shell :: create react app typescript 
Shell :: run disk usage analyzer as root ubuntu 20.04 
Shell :: sqlite3 install ubuntu 
Shell :: uninstalling eclipse from ubuntu 
Shell :: get ip mac terminal 
Shell :: install yarn global 
Shell :: get my ssh key 
Shell :: linux view services 
Shell :: free port in linux 
Shell :: test apache config 
Shell :: install iptables centos 7 
Shell :: no upgrade brew 
Shell :: how to uninstall oh my zsh 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =