From: André W. <wo...@us...> - 2017-05-16 02:39:50
|
Hi René, change "brochure.append(page)" to "brochure.append(document.page(page))". A canvas is not a page, and cannot be inserted into a document without wrapping it in a page object. The "writePDFfile" and similar methods of a canvas are just convenience methods to directly save a canvas into a file for a rather common use case. When creating documents yourself (for example for multiple page documents), you need to properly (i.e. manually) create pages and insert those into a document. Its just the way it is ... Best, André Am 15.05.2017 um 14:26 schrieb rba...@mu...: > > 2017.05.15 > > Liebe Leut, > > I got an error message: > ------------------------ > 552 > Traceback (most recent call last): > File "constell0.py", line 222, in <module> > principal() > File "constell0.py", line 216, in principal > brochure.writePDFfile("TvD") > File "/home/rbm/Python/PyX-0.14.1/pyx/document.py", line 193, in writePDFfile > pdfwriter.PDFwriter(self, f, **kwargs) > File "/home/rbm/Python/PyX-0.14.1/pyx/pdfwriter.py", line 321, in __init__ > registry.write(file, self, catalog) > File "/home/rbm/Python/PyX-0.14.1/pyx/pdfwriter.py", line 78, in write > object.write(file, writer, self) > File "/home/rbm/Python/PyX-0.14.1/pyx/pdfwriter.py", line 244, in write > paperformat = self.page.paperformat > AttributeError: 'canvas' object has no attribute 'paperformat' > ---------------------- > > A code excerpt: > ---------------------- > def principal(): > " merci pour tout" > rprotos = suite_protos() > brochure = document.document() > for nproto, proto in enumerate(rprotos): > page = construirePage(proto, nproto) > #page.writePDFfile("page" + str(nproto).zfill(3)) # OK > brochure.append(page) > print(len(brochure.pages)) # 552 OK > brochure.writePDFfile("TvD") > ---------------------- > > Thanks for your help. > > René > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > PyX-user mailing list > PyX...@li... > https://lists.sourceforge.net/lists/listinfo/pyx-user -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) wo...@us..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ |