[reportlab-users] ReporLab Printing

Robin Becker robin at reportlab.com
Tue Jan 12 11:18:39 EST 2016

I don't think the toolkit does anything to the pdf that would alter its 
transmission to a printer. Each page has to set up the resources it needs for 
correct display and that should be common to any producer. When you say "it 
sends the data in chunks" what is "it"? Are you some how streaming the output to 
the printer from a script? You said previously that the PDF is being produced on 
disk and then fed to the printer. So far as I recall rltk kees everything in 
memory until it can write the whole file the code looks like this

> 	def SaveToFile(self, filename, canvas):
> 		if hasattr(getattr(filename, "write",None),'__call__'):
> 			myfile = 0
> 			f = filename
> 			filename = makeFileName(getattr(filename,'name',''))
> 		else :
> 			myfile = 1
> 			filename = makeFileName(filename)
> 			f = open(filename, "wb")
> 		data = self.GetPDFData(canvas)
> 		if isUnicode(data):
> 			data = data.encode('latin1')
> 		f.write(data)
> 		if myfile:
> 			f.close()
> 			import os
> 			if os.name=='mac':
> 				from reportlab.lib.utils import markfilename
> 				markfilename(filename) # do platform specific file junk
> 		if getattr(canvas,'_verbosity',None): print('saved %s' % (filename,))

so we get all the data, possibly convert to bytes and then write all out; if the 
filw is owned by the document it is then closed.
Robin Becker

On 12/01/2016 15:40, Nazir, Modassar wrote:
> They are approximately 1MB each and are printing to 11x17. I changed the image output to jpeg and it still pauses in between pages. Pulling up the "What's Printing" window I noticed that it sends the data in chunks almost. There seems to a pause in the data. Could there be something there?
> Modassar

More information about the reportlab-users mailing list