Skip to main content

Pdf-file generator

Project description

#Pdf_gen guide

Installing

pip3 install pdf_gen

How to use

from pdf_gen.pdf_gen import pdf

my_file = pdf(path, name) # path - path to your file, name - name of file
my_file.random_drawing(count) # count - count of drawings
my_file.set_font(size) # size - size of font
data = {
            'title': 'Table title',
            'columns': [
                {'name': 'X_name', 'value': 'x'},
                {'name': 'Y_name', 'value': 'y'}
            ],
            'rows': [
                {'x': 10, 'y': 20},
                {'x': 5, 'y': 10}
            ]
}
my_file.draw_table(data) # data - dict with data
my_file.write_text() # text - string of text to writing, position - left/mid/right position of string of text, 
#x and y - coordinates of string
my_file.save(author, title) # author - author of file, title - title of file

##Example

from pdf_gen.pdf_gen import pdf

file = pdf('c:/projects/pdf_generator/tests', 'compare')
file.write_text('Testing file', 'right', 350, 800)
data = {
            'title': 'Table title',
            'columns': [
                {'name': 'Name', 'value': 'name'},
                {'name': 'Age', 'value': 'age'}
            ],
            'rows': [
                {'name': 'string1', 'age': 23},
                {'name': 'string2', 'age': 43}
            ]
        }
file.draw_table(data)
file.random_drawing(10)
file.save() 

##You can create some pdf and merge it into one

from pdf_gen.pdf_gen import pdf, merge_pdf

file_names = ['first', 'second', 'third', 'fourth']
paths = []
for file_name in file_names:
    page = pdf('/files/', f'{file_name}.pdf')
    paths.append(f'/files/{file_name}.pdf')
    page.write_text(file_name)
    page.random_drawing(10)
    page.save()
merge_pdf(paths, '/files/res.pdf', True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf_gen-0.0.6.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf_gen-0.0.6-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file pdf_gen-0.0.6.tar.gz.

File metadata

  • Download URL: pdf_gen-0.0.6.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for pdf_gen-0.0.6.tar.gz
Algorithm Hash digest
SHA256 34faeb085e91d2a4c82f78a3914e8aed307eb33c8114963950120c87530d5c71
MD5 07cea36b030b1101c9bbb40f033e32fb
BLAKE2b-256 226a861f6476b5bd73edc4c36610ed1898aede90958b01355c66adb76cc618fe

See more details on using hashes here.

File details

Details for the file pdf_gen-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pdf_gen-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for pdf_gen-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1098ca82ad490c05d315ca1ab17d5253a3dd2a8997e618e3a13f43ee72326911
MD5 405dd2fce97d76ee1062e5f3ec392df2
BLAKE2b-256 f36c95834c9ae6c1864342e11b230c9ca0bb30dbbd8b1f47a63955147a6d9ee1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page