From 80d24a1d49ca823ebfdb5bd764aabe4e8d50869b Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Fri, 7 May 2021 11:20:47 +0200 Subject: [PATCH] README.md: add more examples (closes: #98) --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index f93317c..10aeedc 100644 --- a/README.md +++ b/README.md @@ -199,6 +199,16 @@ The package can also be used as a library: with open("name.pdf","wb") as f: f.write(img2pdf.convert('test.jpg', layout_fun=layout_fun)) + # use a fixed dpi of 300 instead of reading it from the image + dpix = dpiy = 300 + layout_fun = img2pdf.get_fixed_dpi_layout_fun((dpix, dpiy)) + with open("name.pdf","wb") as f: + f.write(img2pdf.convert('test.jpg', layout_fun=layout_fun)) + + # create a PDF/A-1b compliant document by passing an ICC profile + with open("name.pdf","wb") as f: + f.write(img2pdf.convert('test.jpg', pdfa="/usr/share/color/icc/sRGB.icc")) + Comparison to ImageMagick -------------------------