Re: Writing to stdout

Tim Roberts <[email protected]> Sun, 28 Feb 2021 11:51:55 -0800
Newsgroups gmane.comp.python.reportlab.user
Message-ID <[email protected]>
On Feb 28, 2021, at 9:55 AM, Rob Allen <[email protected]> wrote:
> 
> This is my test application, based on page 11 of the manual where I changed the filename to sys.stdout:
> 
> $ cat test.py
> import sys
> from reportlab.pdfgen import canvas
> 
> def hello(c):
>   c.drawString(100, 100, "Hello World")
> 
> c = canvas.Canvas(sys.stdout)
> hello(c)
> c.showPage()
> c.save()

sys.stdout.buffer has a “write” member,  You should be able to say

    c = canvas.Canvas(sys.stdout.buffer)
— 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

_______________________________________________
reportlab-users mailing list
[email protected]
https://pairlist2.pair.net/mailman/listinfo/reportlab-users