E
E
EEElice2019-07-31 10:46:59
Python
EEElice, 2019-07-31 10:46:59

How to create a new PDF file and a sheet in it?

You need to create a PDF document and add two images to it.
Using the pdfrw library, I cannot do this, because to create a page, the writer.addpage() method requires the page of an already existing document as an argument.
Here's what he wants to see:

from pdfrw import PdfWriter,PdfReader

def pdf():
    writer = PdfWriter()
    reader = PdfReader('file.pdf')
    writer.addpage(reader.pages[0]) #этот самый метод, создающий страницу в документе pdf
    writer.write('file.pdf')

And you just need to create a document from scratch without opening any other document using PdfReader'a.
Is it possible to create a document from scratch by adding the desired images to it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question