## Re: [PyX-user] scores

 Re: [PyX-user] scores From: André Wobst - 2008-06-10 06:35:47 ```Hi, you probably want something like: import math from pyx import * def poster(c, paperformat): bbox = c.bbox() paperwidth_pt = unit.topt(paperformat.width) paperheight_pt = unit.topt(paperformat.height) d = document.document() for ix in range(int(math.ceil(bbox.width_pt()/paperwidth_pt))): for iy in range(int(math.ceil(bbox.height_pt()/ paperheight_pt))): c2 = canvas.canvas() c2.insert(c, [trafo.translate_pt(-bbox.llx_pt- ix*paperwidth_pt, -bbox.lly_pt-iy*paperheight_pt)]) p = document.page(c2, paperformat=paperformat, centered=0) d.append(p) d.writePDFfile() c = canvas.canvas() c.text(0, 0, "Poster", [trafo.scale(200)]) poster(c, document.paperformat.A4) Best, André -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ ```

 [PyX-user] scores From: R. Bastian - 2008-06-07 10:19:28 ```Hello the pyx-list, I am in trouble with pyx.document.page(...). The idea is to cut a long canvas 'c' to obtain 'n' (sub-)canvas 'c2' (which will be the 'n' pages of the final score). But in the line page = pyx.document.page(c2, centered=0, margin=1.0, ...etc.) 'margin=1.0' seems to have no effect, 'fittosize=1' puts the score upon one page 'centered=1' issues a warning "content exceeds the papersize". What is wrong ? thanks in advance, -- R. Bastian http://www.musiques-rb.org ```
 Re: [PyX-user] scores From: Michael J Gruber - 2008-06-09 16:13:13 ```R. Bastian venit, vidit, dixit 07.06.2008 12:19: > Hello the pyx-list, > > I am in trouble with pyx.document.page(...). > The idea is to cut a long canvas 'c' to obtain 'n' (sub-)canvas 'c2' > (which will be the 'n' pages of the final score). > > But in the line > page = pyx.document.page(c2, centered=0, margin=1.0, ...etc.) > > 'margin=1.0' seems to have no effect, > 'fittosize=1' puts the score upon one page > 'centered=1' issues a warning "content exceeds the papersize". > > What is wrong ? The doc. Those options make sense only if you specify a paperformat. The doc says it defaults to document.paperformat.A4, but in fact it defaults to None. Cheers Michael ```
 Re: [PyX-user] scores From: Axel Freyn - 2008-06-09 16:31:36 Attachments: Message as HTML ```Hello, I don't understand exactly your problem, but: A) margin has only an effect, if the page does already a transformation. I think, that only happens, if you a) specify a paperformat and b) set rotated, centered or fittosize to 1. In all other cases, the margin is simply ignored. B), page does not do the splitting upon different pages - that is something you have to provide: I think, there are to possibilities: 1) create the sub-canvas'es "c2" of appropriate size 2) use the long canvas "c", and add to the page-constructor the "Bounding Box", which you want to use for this page. C) The warning "content exceeds the papersize". is only emitted, when the page does some transformation - without centered=1. HTH, Axel On Sat, Jun 7, 2008 at 12:19 PM, R. Bastian wrote: > Hello the pyx-list, > > I am in trouble with pyx.document.page(...). > The idea is to cut a long canvas 'c' to obtain 'n' (sub-)canvas 'c2' > (which will be the 'n' pages of the final score). > > But in the line > page = pyx.document.page(c2, centered=0, margin=1.0, ...etc.) > > 'margin=1.0' seems to have no effect, > 'fittosize=1' puts the score upon one page > 'centered=1' issues a warning "content exceeds the papersize". > > What is wrong ? > > thanks in advance, > > -- > R. Bastian > http://www.musiques-rb.org > > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > PyX-user mailing list > PyX-user@... > https://lists.sourceforge.net/lists/listinfo/pyx-user > ```
 Re: [PyX-user] scores From: André Wobst - 2008-06-10 05:53:05 ```Hi, let me quickly explain how the parameters are ment to work. (And I guess it does work as we intended.) If you don't have a paperformat, neither centered, fittosize and margin have any impact. Once you set paperformat to a paperformat, the output will contain this paper format information. Additionally the other parameters come into play. If fittosize is false (e.g. zero -- PyX is written and still allows for pre-boolean-type python versions), centered indicates whether the output should be centered on the page. PyX uses a translation only so no rescaling occurs. If fittosize is true, the centered option will not be taken into account anymore. Instead the content is always translated and scaled to fit the papersize leaving a margin as indicated by margin. The warning about "exceeds papersize" just happens as needed if the content does not fit onto the paper. Margin is not taken into account here. Best, André Am 09.06.2008 um 18:31 schrieb Axel Freyn: > Hello, > > I don't understand exactly your problem, but: > A) margin has only an effect, if the page does already a > transformation. I think, that only happens, if you > a) specify a paperformat and b) set rotated, centered or fittosize > to 1. In all other cases, the margin is simply ignored. > > B), page does not do the splitting upon different pages - that is > something you have to provide: I think, there are to possibilities: > 1) create the sub-canvas'es "c2" of appropriate size > 2) use the long canvas "c", and add to the page-constructor the > "Bounding Box", which you want to use for this page. > > C) The warning "content exceeds the papersize". is only emitted, > when the page does some transformation - without centered=1. > > HTH, > > Axel > > > On Sat, Jun 7, 2008 at 12:19 PM, R. Bastian wrote: > Hello the pyx-list, > > I am in trouble with pyx.document.page(...). > The idea is to cut a long canvas 'c' to obtain 'n' (sub-)canvas 'c2' > (which will be the 'n' pages of the final score). > > But in the line > page = pyx.document.page(c2, centered=0, margin=1.0, ...etc.) > > 'margin=1.0' seems to have no effect, > 'fittosize=1' puts the score upon one page > 'centered=1' issues a warning "content exceeds the papersize". > > What is wrong ? > > thanks in advance, > > -- > R. Bastian > http://www.musiques-rb.org > > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > PyX-user mailing list > PyX-user@... > https://lists.sourceforge.net/lists/listinfo/pyx-user > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php_______________________________________________ > PyX-user mailing list > PyX-user@... > https://lists.sourceforge.net/lists/listinfo/pyx-user -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ ```
 Re: [PyX-user] scores From: André Wobst - 2008-06-10 06:35:47 ```Hi, you probably want something like: import math from pyx import * def poster(c, paperformat): bbox = c.bbox() paperwidth_pt = unit.topt(paperformat.width) paperheight_pt = unit.topt(paperformat.height) d = document.document() for ix in range(int(math.ceil(bbox.width_pt()/paperwidth_pt))): for iy in range(int(math.ceil(bbox.height_pt()/ paperheight_pt))): c2 = canvas.canvas() c2.insert(c, [trafo.translate_pt(-bbox.llx_pt- ix*paperwidth_pt, -bbox.lly_pt-iy*paperheight_pt)]) p = document.page(c2, paperformat=paperformat, centered=0) d.append(p) d.writePDFfile() c = canvas.canvas() c.text(0, 0, "Poster", [trafo.scale(200)]) poster(c, document.paperformat.A4) Best, André -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ ```
 Re: [PyX-user] scores From: R. Bastian - 2008-06-11 09:46:41 ```On Tue, 10 Jun 2008 08:35:20 +0200 André Wobst wrote: > Hi, > > you probably want something like: > > import math > from pyx import * > > def poster(c, paperformat): > bbox = c.bbox() > paperwidth_pt = unit.topt(paperformat.width) > paperheight_pt = unit.topt(paperformat.height) > d = document.document() > for ix in range(int(math.ceil(bbox.width_pt()/paperwidth_pt))): > for iy in range(int(math.ceil(bbox.height_pt()/ > paperheight_pt))): > c2 = canvas.canvas() > c2.insert(c, [trafo.translate_pt(-bbox.llx_pt- > ix*paperwidth_pt, -bbox.lly_pt-iy*paperheight_pt)]) > p = document.page(c2, paperformat=paperformat, centered=0) > d.append(p) > d.writePDFfile() > > c = canvas.canvas() > c.text(0, 0, "Poster", [trafo.scale(200)]) > poster(c, document.paperformat.A4) > > > Best, > > > André > > -- > by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim > / \ \ / ) wobsta@..., http://www.wobsta.de/ > / _ \ \/\/ / PyX - High quality PostScript and PDF figures > (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ > > Yes, it's grosso modo the same than my script; one must add 'rotated=1': to obtain the »querformat« (== 'à l'italienne'). The result is perfect on a display, but when printing it, I get losses (?) [Verluste, pertes] due to the printer (0.5 cm on the margins). I tried to change the margins (== reduce the 'Satzspiegel') but it did not work. I will try to reduce the content and adapt it to the printable area, if there is no other way. Thanks for your infos, also Axel and Michael -- R. Bastian http://www.musiques-rb.org ```
 Re: [PyX-user] scores From: André Wobst - 2008-06-11 11:19:17 ```Hi, Am 11.06.2008 um 11:46 schrieb R. Bastian: > Yes, it's grosso modo the same than my script; one must add > 'rotated=1': > to obtain the »querformat« (== 'à l'italienne'). The result is perfect > on a display, but when printing it, I get losses (?) [Verluste, > pertes] due > to the printer (0.5 cm on the margins). > > I tried to change the margins (== reduce the 'Satzspiegel') but it > did not work. > I will try to reduce the content and adapt it to the printable area, > if there is > no other way. using rotated=1 is probably ok, but I would do the margin manually. Note that a simple fittosize will not work, as we do not clip the contents. Furthermore most of the time it's preferable to not rescale the content at all. I would try along the following modifications (untested): def poster(c, paperformat, margin=0): bbox = c.bbox() margin_pt = unit.topt(margin) paperwidth_pt = unit.topt(paperformat.width) paperheight_pt = unit.topt(paperformat.height) d = document.document() for ix in range(int(math.ceil(bbox.width_pt()/ (paperwidth_pt-2*margin_pt)))): for iy in range(int(math.ceil(bbox.height_pt()/ (paperheight_pt-2*margin_pt)))): c2 = canvas.canvas() c2.insert(c, [trafo.translate_pt(-bbox.llx_pt- ix*(paperwidth_pt-2*margin_pt)+margin_pt, -bbox.lly_pt- iy*(paperheight_pt-2*margin_pt)+margin_pt)]) # you can also add some cut-marks c2.stroke(path.rect(margin_pt, margin_pt, paperwidth_pt-2*margin_pt, paperheight_pt-2*margin_pt)) p = document.page(c2, paperformat=paperformat, centered=0) d.append(p) d.writePDFfile() HTH, André -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) wobsta@..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ ```