poster-20050907/0000755000023600242400000000000010307706345012305 5ustar hermanntkmposter-20050907/ChangeLog0000644000023600242400000000102110307706316014047 0ustar hermanntkm2005-09-07 Cristian Tibirna * option: don't crash when specifying -s option (scaling) 2002-08-26 Michael Goffioul * gets: avoid the use of gets, replaced by fgets * input: allow input from STDIN * pages: allow poster printing of more than one page 2002-08-28 Michael Goffioul * pages: allow selection of tile pages to print 2002-08-30 Michael Goffioul * option: added a "fake" option to pre-calculate the tile pages (used within KDEPrint). poster-20050907/manual.ps0000644000023600242400000005752406017051342014134 0ustar hermanntkm%!PS-Adobe-3.0 %%Creator: groff version 1.09 %%CreationDate: Thu Aug 24 12:22:26 1995 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic %%DocumentFonts: Times-Roman %%+ Times-Bold %%+ Times-Italic %%DocumentSuppliedResources: procset grops 1.09 0 %%Pages: 4 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog %%BeginResource: procset grops 1.09 0 /setpacking where{ pop currentpacking true setpacking }if /grops 120 dict dup begin /SC 32 def /A/show load def /B{0 SC 3 -1 roll widthshow}bind def /C{0 exch ashow}bind def /D{0 exch 0 SC 5 2 roll awidthshow}bind def /E{0 rmoveto show}bind def /F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def /G{0 rmoveto 0 exch ashow}bind def /H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /I{0 exch rmoveto show}bind def /J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def /K{0 exch rmoveto 0 exch ashow}bind def /L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /M{rmoveto show}bind def /N{rmoveto 0 SC 3 -1 roll widthshow}bind def /O{rmoveto 0 exch ashow}bind def /P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def /Q{moveto show}bind def /R{moveto 0 SC 3 -1 roll widthshow}bind def /S{moveto 0 exch ashow}bind def /T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def /SF{ findfont exch [exch dup 0 exch 0 exch neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /MF{ findfont [5 2 roll 0 3 1 roll neg 0 0]makefont dup setfont [exch/setfont cvx]cvx bind def }bind def /level0 0 def /RES 0 def /PL 0 def /LS 0 def /A5 0 def /leftpage true def /settumble true def /PLG{ gsave newpath clippath pathbbox grestore exch pop add exch pop }bind def /BP{ /level0 save def 1 setlinecap 1 setlinejoin 72 RES div dup scale LS{ 90 rotate A5{ 2 sqrt 2 div dup scale leftpage{ clippath pathbbox pop exch pop add 2 div 0 translate 0 0 moveto newpath }if }if }{ 0 PL translate }ifelse 1 -1 scale }bind def /EP{ level0 restore A5{ leftpage{ showpage /leftpage false def }{ /leftpage true def }ifelse }{ showpage }ifelse }bind def /DA{ newpath arcn stroke }bind def /SN{ transform .25 sub exch .25 sub exch round .25 add exch round .25 add exch itransform }bind def /DL{ SN moveto SN lineto stroke }bind def /DC{ newpath 0 360 arc closepath }bind def /TM matrix def /DE{ TM currentmatrix pop translate scale newpath 0 0 .5 0 360 arc closepath TM setmatrix }bind def /RC/rcurveto load def /RL/rlineto load def /ST/stroke load def /MT/moveto load def /CL/closepath load def /FL{ currentgray exch setgray fill setgray }bind def /BL/fill load def /LW/setlinewidth load def /RE{ findfont dup maxlength 1 index/FontName known not{1 add}if dict begin { 1 index/FID ne{def}{pop pop}ifelse }forall /Encoding exch def dup/FontName exch def currentdict end definefont pop }bind def /DEFS 0 def /EBEGIN{ moveto DEFS begin }bind def /EEND/end load def /CNT 0 def /level1 0 def /PBEGIN{ /level1 save def translate div 3 1 roll div exch scale neg exch neg exch translate 0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit []0 setdash /setstrokeadjust where{ pop false setstrokeadjust }if /setoverprint where{ pop false setoverprint }if newpath /CNT countdictstack def userdict begin /showpage{}def }bind def /PEND{ clear countdictstack CNT sub{end}repeat level1 restore }bind def end def /setpacking where{ pop setpacking }if %%EndResource %%IncludeResource: font Times-Roman %%IncludeResource: font Times-Bold %%IncludeResource: font Times-Italic grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL 841.89 def/LS false def/A5 false def/katern false def/ENC0[ /asciicircum/asciitilde/Scaron/Zcaron/scaron/zcaron/Ydieresis/trademark /quotesingle/ellipsis/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/space/exclam /quotedbl/numbersign/dollar/percent/ampersand/quoteright/parenleft /parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three /four/five/six/seven/eight/nine/colon/semicolon/less/equal/greater /question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z /bracketleft/backslash/bracketright/circumflex/underscore/quoteleft/a/b /c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar /braceright/tilde/.notdef/quotesinglbase/guillemotleft/guillemotright /bullet/florin/fraction/perthousand/dagger/daggerdbl/endash/emdash/ff/fi /fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut/dotaccent/breve/caron /ring/ogonek/quotedblleft/quotedblright/oe/lslash/quotedblbase/OE/Lslash /.notdef/exclamdown/cent/sterling/currency/yen/brokenbar/section /dieresis/copyright/ordfeminine/guilsinglleft/logicalnot/minus /registered/macron/degree/plusminus/twosuperior/threesuperior/acute/mu /paragraph/periodcentered/cedilla/onesuperior/ordmasculine /guilsinglright/onequarter/onehalf/threequarters/questiondown/Agrave /Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute /Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis/Eth/Ntilde /Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply/Oslash/Ugrave /Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls/agrave/aacute /acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute /ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde /ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute /ucircumflex/udieresis/yacute/thorn/ydieresis]def/Times-Italic@0 ENC0 /Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0 /Times-Roman RE %%EndProlog %%Page: 1 1 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 367.72(POSTER\(1\) POSTER\(1\))72 48 R/F1 9 /Times-Bold@0 SF -.18(NA)72 84 S(ME).18 E F0(poster \255 Scale and tile\ a postscript image to print on multiple pages)108 96 Q F1(SYNOPSIS)72 112.8 Q F0(poster in\214le)108 124.8 Q F1(DESCRIPTION)72 141.6 Q/F2 10/Times-Italic@0 SF -.8(Po)108 153.6 S(ster).8 E F0 1.072 (can be used to create a lar)3.572 F 1.072(ge poster by b)-.18 F 1.071 (uilding it from multiple pages and/or printing it on lar)-.2 F(ge)-.18 E 2.864(media. It)108 165.6 R -.15(ex)2.864 G .364(pects as input a gen\ eric \(encapsulated\) postscript \214le, normally printing on a single \ page.).15 F(The)5.365 E .596(output is ag)108 177.6 R .595 (ain a postscript \214le, maybe containing multiple pages together b) -.05 F .595(uilding the poster)-.2 F 5.595(.T)-.55 G .595(he output) -5.595 F .348(pages bear cutmarks and ha)108 189.6 R .648 -.15(ve s)-.2 H .348(lightly o).15 F -.15(ve)-.15 G .348 (rlapping images for easier assembling.).15 F .348 (The input picture will be)5.348 F(scaled to obtain the desired size.) 108 201.6 Q .069(The program uses a brute-force method: it copies the e\ ntire input \214le for each output page, hence the output)108 218.4 R 1.352(\214le can be v)108 230.4 R 1.352(ery lar)-.15 F 3.852(ge. Since) -.18 F 1.352(the program does not really bother about the input \214le \ contents, it clearly)3.852 F -.1(wo)108 242.4 S (rks for both black-and-white and color postscript.).1 E 2.542 -.8(To c) 108 259.2 T .942(ontrol its operation, you need to specify either the s\ ize of the desired poster or a scale f).8 F .941(actor for the)-.1 F (image:)108 271.2 Q 6.67(-G)108 288 S -2.15 -.25(iv e)-6.67 H 2.826(nt) .25 G .326(he poster size, it calculates the required number of sheets \ to print on, and from that a scale f)-2.826 F(actor)-.1 E (to \214ll these sheets optimally with the input image.)118 300 Q 6.67 (-G)108 316.8 S -2.15 -.25(iv e)-6.67 H 2.75(nas).25 G .25(cale f)-2.75 F(actor)-.1 E 2.75(,i)-.4 G 2.75(td)-2.75 G(eri)-2.75 E -.15(ve)-.25 G 2.75(st).15 G .249(he required number of pages from the input image siz\ e, and positions the)-2.75 F(scaled image centered on this area.)118 328.8 Q .848(Its input \214le should best be a real `Encapsulated Posts\ cript' \214le \(often denoted with the e)108 345.6 R .849 (xtension .eps or)-.15 F 3.722(.epsf\). Such)108 357.6 R 1.221 (\214les can be generated from about all current dra)3.722 F 1.221 (wing applications, and te)-.15 F 1.221(xt processors lik)-.15 F(e)-.1 E -.8(Wo)108 369.6 S(rd, Interleaf and Framemak).8 E(er)-.1 E(.)-.55 E(Ho) 108 381.6 Q(we)-.25 E -.15(ve)-.25 G(r).15 E F2(poster)3.344 E F0 .844 (tries to beha)3.344 F 1.144 -.15(ve p)-.2 H .845 (roperly also on more relax).15 F .845 (ed, general postscript \214les containing a single)-.15 F (page de\214nition.)108 393.6 Q(Proper operation is obtained for instan\ ce on pages generated by \(La\)T)5 E(eX and \(g\)trof)-.7 E(f.)-.25 E .021(The media to print on can be selected independently from the input\ image size and/or the poster size.)108 410.4 R F2 -.8(Po)2.52 G(ster).8 E F0(will determine by itself whether it is bene\214cial to rotate the \ output image on the media.)108 422.4 Q 3.612 -.8(To p)108 439.2 T(re).8 E(vie)-.25 E 4.512(wt)-.25 G 2.012(he output results of)-4.512 F F2 (poster)4.512 E F0 2.013(and/or to \(re-\)print indi)4.512 F 2.013 (vidual output pages, you should use a)-.25 F(postscript pre)108 451.2 Q (vie)-.25 E(wer lik)-.25 E 2.5(eg)-.1 G(hostvie)-2.5 E(w\(1\).)-.25 E F1 (OPTIONS)72 480 Q F0 4.17(-v Be)108 492 R -.15(ve)2.5 G(rbose. T).15 E (ell about scaling, rotation and number of pages.)-.7 E(Def)123 504 Q (ault is silent operation.)-.1 E 5.84(-f Ask)108 520.8 R (manual media feed on the plotting/printing de)2.5 E (vice, instead of using its standard paper tray)-.25 E(.)-.65 E(Def)123 532.8 Q(ault is adhering to the de)-.1 E(vice settings.)-.25 E(-i ) 108 549.6 Q(Specify the size of the input image.)123 561.6 Q(Def)123 573.6 Q(ault is reading the image size from the `%%BoundingBox' speci\ \214cation in the input \214le header)-.1 E(.)-.55 E(-m )108 590.4 Q(Specify the desired media size to print on. See belo)123 602.4 Q 2.5 (wf)-.25 G(or .)-2.5 E(The def)123 614.4 Q (ault is set at compile time, being A4 in the standard package.)-.1 E (-p )108 631.2 Q 1.62(Specify the poster size. See belo)123 643.2 R 4.12(wf)-.25 G 1.62(or .)-4.12 F(Since)6.62 E F2(poster)4.12 E F0 1.62(will autonomously choose for rotation,)4.12 F(al)123 655.2 Q -.1 (wa)-.1 G (ys specify a `portrait' poster size \(i.e. higher then wide\).).1 E (If you don')123 667.2 Q 2.5(tg)-.18 G -2.15 -.25(iv e)-2.5 H (the -s option, the def)2.75 E (ault poster size is identical to the media size.)-.1 E(-s )108 684 Q .845(Specify a linear scaling f)123 696 R .845 (actor to produce the poster)-.1 F 5.845(.T)-.55 G .845 (ogether with the input image size and optional)-6.645 F(mar)123 708 Q (gins, this induces an output poster size. So don')-.18 E 2.5(ts)-.18 G (pecify both -s and -p.)-2.5 E(Def)123 720 Q(ault is deri)-.1 E (ving the scale f)-.25 E(actor to \214t a gi)-.1 E -.15(ve)-.25 G 2.5 (np).15 G(oster size.)-2.5 E(1)535 768 Q EP %%Page: 2 2 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 367.72(POSTER\(1\) POSTER\(1\))72 48 R(-c ) 108 84 Q/F1 10/Times-Italic@0 SF(or)2.5 E F0(-c %)2.5 E .743 (Specify the cut mar)123 96 R .742(gin. This is the distance between th\ e cutmarks and the paper edge. If the output is)-.18 F .301(really tile\ d on multiple sheets, the cut marks indicate where to cut the paper for\ assembly)123 108 R 5.301(.T)-.65 G .301(his mar)-5.301 F(gin)-.18 E 1.03(must be big enough to co)123 120 R -.15(ve)-.15 G 3.53(rt).15 G 1.029(he non-printable mar)-3.53 F 1.029 (gin which almost all printers ha)-.18 F -.15(ve)-.2 G 3.529(.F).15 G 1.029(or see)-3.679 F(belo)123 132 Q -.65(w.)-.25 G(Def)123 144 Q .257(ault is 5%. Only when you specify identical poster and media sizes\ , the def)-.1 F .258(ault cut mar)-.1 F .258(gin becomes)-.18 F(0, ef) 123 156 Q(fecti)-.25 E -.15(ve)-.25 G(ly remo).15 E(ving the cutmarks.) -.15 E(-w )108 172.8 Q F1(or)2.5 E F0(-w %)2.5 E (Specify a white mar)123 184.8 Q(gin around the output image.)-.18 E .391 (In the `ideal' situation \(when an input `eps' \214le speci\214es an e) 123 196.8 R .391(xact BoundingBox in its header\), the out-)-.15 F .36 (put image will be scaled e)123 208.8 R .36 (xactly to the edges of the resulting poster \(minus cut mar)-.15 F .36 (gin\). If you desire a)-.18 F(certain mar)123 220.8 Q (gin to remain around the picture after poster assembly)-.18 E 2.5(,y) -.65 G(ou can specify this with `-w'.)-2.5 E .862(\(This option is actu\ ally redundant, since you can obtain the same result using -s or -i. Ho) 123 232.8 R(we)-.25 E -.15(ve)-.25 G 3.361(rs).15 G(ome)-3.361 E (might \214nd this more con)123 244.8 Q -.15(ve)-.4 G(nient.\)).15 E (Def)123 256.8 Q(ault is 0.)-.1 E(-o )108 273.6 Q (Specify the name of the \214le to write the output into.)123 285.6 Q .416(\(Only added for those poor people who cannot specify output redir\ ection from their command line due)123 297.6 R(to a silly OS.\))123 309.6 Q(Def)123 321.6 Q(ault is writing to standard output.)-.1 E .077 (The mentioned abo)108 338.4 R .377 -.15(ve i)-.15 H 2.576(sas).15 G .076(peci\214cation of horizontal and v)-2.576 F .076(ertical size.) -.15 F .076(Only in combination with the)5.076 F (`-i' option, the program also understands the of)108 350.4 Q (fset speci\214cation in the .)-.25 E(In general:)108 362.4 Q ( = [][])-.25 E (with multipier and of)108 386.4 Q(fset being speci\214ed optionally) -.25 E(.)-.65 E( = *)120.5 398.4 Q( = +,)-.25 E ( = or )120.5 422.4 Q(Man)108 439.2 Q 2.696(yi)-.15 G .196(nternational media names are recognised by the pro\ gram, in upper and lo)-2.696 F .197(wer case, and can be short-)-.25 F (ened to their \214rst fe)108 451.2 Q 2.5(wc)-.25 G (haracters, as long as unique.)-2.5 E -.15(Fo)5 G 2.5(ri).15 G (nstance `)-2.5 E(A0', `Let'.)-.8 E(Distance names are lik)108 463.2 Q 2.5(e`)-.1 G(cm', `i', `ft'.)-2.5 E/F2 9/Times-Bold@0 SF(EXAMPLES)72 492 Q F0(The follo)108 504 Q(wing command prints an A4 input \214le on 8 A3\ pages, forming an A0 poster:)-.25 E (poster -v -iA4 -mA3 -pA0 in\214le >out\214le)130.5 516 Q(The ne)108 540 Q(xt command prints an eps input image on a poster of 3x3 Letter pages:) -.15 E(poster -v -mLet -p3x3Let)130.5 552 Q(image.eps > out\214le)5 E .233(The ne)108 576 R .233(xt command enlar)-.15 F .232 (ges an eps input image to print on a lar)-.18 F .232 (ge-media A0 capable de)-.18 F .232(vice, maintaining 2)-.25 F(inch mar) 108 588 Q(gins:)-.18 E(poster -v -mA0 -w2x2i image.eps > out\214le)130.5 600 Q(Enlar)108 624 Q 1.371(ge a postscript image e)-.18 F 1.372 (xactly 4 times, print on the def)-.15 F 1.372(ault A4 media, and let) -.1 F F1(poster)3.872 E F0 1.372(determine the)3.872 F (number of pages required:)108 636 Q (poster -v -s4 image.eps > out\214le)130.5 648 Q(2)535 768 Q EP %%Page: 3 3 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 367.72(POSTER\(1\) POSTER\(1\))72 48 R .334 (Scale a postscript image to a poster of about 1 square meter)108 84 R 2.833(,p)-.4 G .333(rinting on `Le)-2.833 F -.05(ga)-.15 G .333 (l' media, maintaining a 10%).05 F(of `Le)108 96 Q -.05(ga)-.15 G (l' size as white mar).05 E(gin around the poster)-.18 E(.)-.55 E (poster -v -mLe)130.5 108 Q -.05(ga)-.15 G 2.5(l-).05 G (p1x1m -w10% in\214le.ps >out\214le)-2.5 E/F1 9/Times-Bold@0 SF(PR)72 136.8 Q(OBLEMS & Q)-.27 E(UESTIONS)-.09 E/F2 10/Times-Bold@0 SF 2.5(Ig) 87 148.8 S(et a blurry image and/or interfer)-2.5 E(ence patter)-.18 E (ns)-.15 E F0 .562(If your input \214le contains -or consists of- pix) 108 160.8 R .562(el images \(as opposed to just v)-.15 F .563 (ector data which is essentially)-.15 F .523 (resolution independent\), you might ha)108 172.8 R .823 -.15(ve t)-.2 H .523(his problem.).15 F .523(Such pix)5.523 F .522 (el images are normally made to \214t well to)-.15 F .167 (standard 300 \(or 600\) dpi de)108 184.8 R 2.667(vices. Scaling)-.25 F .168(such a picture with an uncarefully chosen f)2.668 F(actor)-.1 E 2.668(,c)-.4 G .168(an easily lead)-2.668 F .348 (to hazy edges and interference patterns on the output.)108 196.8 R .348 (The solution is to pro)5.348 F(vide)-.15 E/F3 10/Times-Italic@0 SF (poster)2.848 E F0 .347(with an e)2.847 F .347(xact scal-)-.15 F 1.681 (ing f)108 208.8 R 1.682 (actor \(with the -s option\), chosen as an inte)-.1 F(ger)-.15 E 4.182 (.I)-.55 G 4.182(fi)-4.182 G(nte)-4.182 E 1.682 (ger scaling is unpractical for your purpose,)-.15 F (choose a fractional number made from a small inte)108 220.8 Q (ger denominator \(2, 3, 4\).)-.15 E F2 (Can I select only a small part of a gi)87 237.6 Q -.1(ve)-.1 G 2.5(ni) .1 G(nput pictur)-2.5 E(e?)-.18 E F0 -1(Ye)108 249.6 S .375(s, for this\ purpose you can de\214ne both the size \(width and height\) and of)1 F .374(fset \(from left and bottom\) of a)-.25 F(windo)108 261.6 Q 2.5(wo) -.25 G 2.5(nt)-2.5 G(he input image.)-2.5 E(Specify these numbers as ar) 5 E(gument to a `-i' command line option.)-.18 E .425(One w)108 273.6 R .425(ay to obtain such numbers is pre)-.1 F(vie)-.25 E .426 (wing the original image with ghostvie)-.25 F 1.726 -.65(w, a)-.25 H .426(nd observing the coor).65 F(-)-.2 E 1.316 (dinate numbers which it continually displays.)108 285.6 R 1.316 (These numbers are in postscript units \(points\), named by)6.316 F F3 (poster)108 297.6 Q F0(as just `p'.)2.5 E F2 -.2(Po)87 314.4 S (ster doesn't seem to w).2 E(ork pr)-.1 E(operly)-.18 E 2.5(,o)-.55 G (utput pages ar)-2.5 E 2.5(ee)-.18 G(mpty)-2.5 E F0 .287 (The major cause for poster not to w)108 326.4 R .288(ork correctly)-.1 F 2.788(,i)-.65 G 2.788(sg)-2.788 G -.25(iv)-2.788 G .288 (ing it postscript \214les which don').25 F 2.788(tc)-.18 G .288 (onform to proper)-2.788 F 2.756('eps' beha)108 338.4 R(viour)-.2 E 7.756(.T)-.55 G 2.756(ry whether your application \(or printer dri) -8.106 F -.15(ve)-.25 G 2.756(r\) cannot generate real 'encapsulated).15 F(postscript'.)108 350.4 Q F2(If I ask f)87 367.2 Q(or a 50x50cm poster) -.25 E 2.5(,i)-.92 G 2.5(ta)-2.5 G(lways generates something bigger)-2.5 E F0 -1(Ye)108 379.2 S .631(s, probably)1 F 3.131(.W)-.65 G .632 (hen specifying a desired output size with the `-p' option,)-3.131 F F3 (poster)3.132 E F0 .632(\214rst determines an array)3.132 F .958 (of sheets to co)108 391.2 R -.15(ve)-.15 G 3.458(rs).15 G .958 (uch an area.)-3.458 F .958(Then it determines a scale f)5.958 F .958 (actor for the picture to \214ll these sheets upto)-.1 F 1.223 (their edge. As result your requested size is used as rough guess only) 108 403.2 R 6.224(.I)-.65 G 3.724(fy)-6.224 G 1.224(ou w)-3.724 F 1.224 (ant an e)-.1 F 1.224(xact output size,)-.15 F(specify the scaling f)108 415.2 Q(actor yourself with the `-s' option \(and omit the `-p'\).)-.1 E F2 2.5(Iw)87 432 S(ant to k)-2.5 E(eep the white space ar)-.1 E (ound the poster as in my original)-.18 E F3 -.8(Po)108 444 S(ster).8 E F0 .133(will as def)2.633 F .133(ault use the input image bounding box,\ and scale/translate that to the edges of your poster)-.1 F(.)-.55 E 1.554(If the program which generated your input \214le speci\214es an e) 108 456 R 1.554(xact and tight %%BoundingBox, you will)-.15 F 1.023 (indeed loose your white mar)108 468 R 3.523(gin. T)-.18 F 3.523(ok)-.8 G 1.023(eep the original mar)-3.623 F 1.023 (gin, specify a `-i' option with as ar)-.18 F 1.022(gument the)-.18 F .661(papersize on which the original document w)108 480 R .661 (as formatted \(such as `-iA4'\).)-.1 F(Alternati)5.662 E -.15(ve)-.25 G .662(ly specify a smaller).15 F(scale f)108 492 Q (actor \(with -s\) or an e)-.1 E(xplicit ne)-.15 E 2.5(wm)-.25 G(ar)-2.5 E(gin \(with -w\).)-.18 E F1(POSTER ASSEMBL)72 520.8 Q(Y)-.828 E F0(Our\ preferred method for the assembly of a poster from multiple sheets is \ as follo)108 532.8 Q(ws:)-.25 E 6.67(-A)108 549.6 S (rrange the sheets in the proper order on a lar)-6.67 E (ge table or on the \215oor)-.18 E(.)-.55 E 6.67(-R)108 566.4 S(emo) -6.67 E 1.039 -.15(ve f)-.15 H .739(rom all sheets, e).15 F .738 (xcept from those in the leftmost column or bottom ro)-.15 F 2.038 -.65 (w, t)-.25 H .738(heir left and bottom).65 F(cutmar)118 578.4 Q(gin.) -.18 E 6.67(-I)108 595.2 S 2.682(nl)-6.67 G .182 (eft-to-right and bottom-to-top order)-2.682 F 2.682(,g)-.4 G .182 (lue the right \(and top\) cutmar)-2.682 F .183 (gin and stick the right \(and upper\))-.18 F (neighbouring page on top of that.)118 607.2 Q 6.67(-T)108 624 S .31 (urn the glued-together poster f)-7.12 F .31(ace bottom, and put adhesi) -.1 F .609 -.15(ve t)-.25 H .309 (ape on the sheet edges \(on the backside of).15 F (the poster\) for more strength.)118 636 Q 6.67(-R)108 652.8 S(emo)-6.67 E .3 -.15(ve t)-.15 H(he remaining cutmar).15 E(gin around the poster) -.18 E(.)-.55 E F1(DEVICE SETTINGS)72 681.6 Q F0 -.15(Fo)108 693.6 S 3.388(rp).15 G .888(ostscript le)-3.388 F -.15(ve)-.25 G .888 (l-2 capable printers/plotters, which is about all modern postscript de) .15 F .889(vices today)-.25 F(,)-.65 E F3(poster)3.389 E F0 (will send de)108 705.6 Q(vice settings in its output \214le.)-.25 E (This consists of a `setpagede)5 E(vice' call, setting:)-.25 E(3)535 768 Q EP %%Page: 4 4 %%BeginPageSetup BP %%EndPageSetup /F0 10/Times-Roman@0 SF 367.72(POSTER\(1\) POSTER\(1\))72 48 R 6.67(-t) 108 84 S(he media size.)-6.67 E(This is required for all printers I kno) 118 96 Q 2.5(wt)-.25 G 2.5(og)-2.5 G(et correct beha)-2.5 E (viour on dif)-.2 E(ferent media/picture sizes.)-.25 E 6.67(-d)108 112.8 S(uple)-6.67 E(xing of)-.15 E(f.)-.25 E .39 (Some printers will otherwise perform double-side printing by def)118 124.8 R 2.89(ault. Clearly)-.1 F .39(that is not what you w)2.89 F(ant) -.1 E(to print a poster)118 136.8 Q(.)-.55 E 6.67(-m)108 153.6 S (anual media feed.)-6.67 E .295(This is gi)118 165.6 R -.15(ve)-.25 G 2.795(no).15 G .295(nly when)-2.795 F/F1 10/Times-Italic@0 SF(poster) 2.796 E F0 .296(is gi)2.796 F -.15(ve)-.25 G 2.796(nt).15 G .296(he `-f) -2.796 F 2.796('c).55 G .296(ommand line option. This is a con)-2.796 F -.15(ve)-.4 G .296(nient feature if you).15 F -.1(wa)118 177.6 S .679 (nt to print your job on dif).1 F .679 (ferent media than normally installed in the paper tray)-.25 F 3.179(,a) -.65 G .678(nd you are submit-)-3.179 F (ting your job through a multi-user netw)118 189.6 Q (orking and spooling en)-.1 E(vironment.)-.4 E 1.084 (These settings cause proper de)108 206.4 R 1.084(vice beha)-.25 F (viour)-.2 E 3.584(,w)-.4 G 1.084 (ithout the need to manually interact with the printer set-)-3.584 F (tings, and has been here locally tested to w)108 218.4 Q(ork on de)-.1 E(vices lik)-.25 E 2.5(et)-.1 G(he HP300XL and HP650C.)-2.5 E (The settings thus passed in the postscript \214le, will af)108 235.2 Q (fect the de)-.25 E(vice for this job only)-.25 E(.)-.65 E/F2 9 /Times-Bold@0 SF(DSC CONFORMANCE)72 264 Q F1 -.8(Po)108 276 S(ster).8 E F0 .673(will generate its o)3.173 F .672(wn DSC header and other DSC li\ nes in the output \214le, according the `Document)-.25 F .115 (Structuring Con)108 288 R -.15(ve)-.4 G .115(ntions - v).15 F .116 (ersion 3.0', as written do)-.15 F .116 (wn in the `Postscript Language Reference Manual, 2nd)-.25 F(ed.)108 300 Q 2.5('f)-.7 G(rom Adobe Systems Inc, Addison W)-2.5 E(esle)-.8 E 2.5 (yP)-.15 G(ubl comp., 1990.)-2.5 E 1.137(It will cop)108 316.8 R 3.637 (ya)-.1 G 1.437 -.15(ny `)-3.637 H(%%Document...).15 E 3.637('l)-.7 G 1.137(ine from the input \214le DSC header to its o)-3.637 F 1.136 (wn header output. This is)-.25 F (used here in particular for required nonresident fonts.)108 328.8 Q(Ho) 108 345.6 Q(we)-.25 E -.15(ve)-.25 G 2.896(rt).15 G .396(he cop)-2.896 F .396(y\(s\) of the input \214le included in the output, are stripped fr\ om all lines starting with a `%',)-.1 F(since the)108 357.6 Q 2.5(yt) -.15 G(end to disturb our `ghostvie)-2.5 E(w' pre)-.25 E(vie)-.25 E (wer and tak)-.25 E 2.5(eu)-.1 G(seless space an)-2.5 E(yho)-.15 E -.65 (w.)-.25 G F2(SEE ALSO)72 386.4 Q F0(ghostvie)108 398.4 Q(w\(1\))-.25 E F2(CONTRIB)72 427.2 Q(UTED BY)-.09 E F0(Jos v)108 439.2 Q(an Eijndho) -.25 E -.15(ve)-.15 G 2.5(n\().15 G(email: J.T)-2.5 E(.J.v)-.74 E (.Eijndho)-.65 E -.15(ve)-.15 G(n@ele.tue.nl\)).15 E (Design Automation Section \(http://www)108 451.2 Q(.es.ele.tue.nl\)) -.65 E(Dept. of Elec. Eng.)108 463.2 Q(Eindho)108 475.2 Q -.15(ve)-.15 G 2.5(nU).15 G(ni)-2.5 E 2.5(vo)-.25 G 2.5(fT)-2.5 G(echnology)-3.2 E (The Netherlands)108 487.2 Q(24 August, 1995)108 499.2 Q(4)535 768 Q EP %%Trailer end %%EOF poster-20050907/poster.c0000644000023600242400000007245410307706065014000 0ustar hermanntkm/* # poster.c - a generic PS scaling program # This program scales a PostScript page to a given size (a poster). # The output can be tiled on multiple sheets, and output # media size can be chosen independently. # Each tile (sheet) of a will bear cropmarks and slightly overlapping # image for easier poster assembly. # # Compile this program with: # cc -O -o poster poster.c -lm # or something alike. # # Maybe you want to change the `DefaultMedia' and `DefaultImage' # settings in the few lines below, to reflect your local situation. # Names can to be chosen from the `mediatable' further down. # # The `Gv_gs_orientbug 1' disables a feature of this program to # ask for landscape previewing of rotated images. # Our currently installed combination of ghostview 1.5 with ghostscript 3.33 # cannot properly do a landscape viewing of the `poster' output. # The problem does not exist in combination with an older ghostscript 2.x, # and has the attention of the ghostview authors. # (The problem is in the evaluation of the `setpagedevice' call.) # If you have a different previewing environment, # you might want to set `Gv_gs_orientbug 0' # # Jos van Eijndhoven, Eindhoven University of Technology # email: J.T.J.v.Eijndhoven@ele.tue.nl # September 7, 1995 # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public # License version 2 as published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with this library; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # */ #define Gv_gs_orientbug 1 #define DefaultMedia "A4" #define DefaultImage "A4" #define DefaultCutMargin "5%" #define DefaultWhiteMargin "0" #define BUFSIZE 1024 #include #include #include #include #include #include extern char *optarg; /* silently set by getopt() */ extern int optind, opterr; /* silently set by getopt() */ static void usage(); static void dsc_head1(); static int dsc_infile( double ps_bb[4]); static void dsc_head2( void); static void printposter( void); static void printprolog(); static void tile ( int row, int col, int pagetoprint); static void printfile( int pagetoprint); static void postersize( char *scalespec, char *posterspec); static void box_convert( char *boxspec, double psbox[4]); static void boxerr( char *spec); static void margin_convert( char *spec, double margin[2]); static int mystrncasecmp( const char *s1, const char *s2, int n); static char* tmpinfile( void ); static int parsepagespec( int **page_array, int *len, int *size, char *pagespec ); static void do_fake_mode( void ); int verbose; char *myname; char *infile; int rotate, nrows, ncols; int manualfeed = 0; int tail_cntl_D = 0; #define Xl 0 #define Yb 1 #define Xr 2 #define Yt 3 #define X 0 #define Y 1 double posterbb[4]; /* final image in ps units */ double imagebb[4]; /* original image in ps units */ double mediasize[4]; /* [34] = size of media to print on, [01] not used! */ double cutmargin[2]; double whitemargin[2]; double scale; /* linear scaling factor */ int number_pages = 1; int *pages = NULL; int pages_size = 0; int pages_length = 0; int fake_mode = 0; /* defaults: */ char *imagespec = NULL; char *posterspec = NULL; char *mediaspec = NULL; char *cutmarginspec = NULL; char *whitemarginspec = NULL; char *scalespec = NULL; char *filespec = NULL; char *pagespec = NULL; /* media sizes in ps units (1/72 inch) */ static char *mediatable[][2] = { { "Letter", "612,792"}, { "Legal", "612,1008"}, { "Tabloid", "792,1224"}, { "Ledger", "792,1224"}, { "Executive","540,720"}, { "Monarch", "279,540"}, { "Statement","396,612"}, { "Folio", "612,936"}, { "Quarto", "610,780"}, { "C5", "459,649"}, { "C5E", "459,649"}, { "EnvC5", "459,649"}, { "B0", "2916,4128"}, { "B1", "2064,2916"}, { "B2", "1458,2064"}, { "B3", "1032,1458"}, { "B4", "729,1032"}, { "B5", "516,729"}, { "B6", "365,516"}, { "B7", "258,365"}, { "B8", "183,258"}, { "B9", "129,183"}, { "B10", "92,129"}, { "Dl", "312,624"}, { "A0", "2380,3368"}, { "A1", "1684,2380"}, { "A2", "1190,1684"}, { "A3", "842,1190"}, { "A4", "595,842"}, { "A5", "421,595"}, { "A6", "297,421"}, { "A7", "210,297"}, { "A8", "148,210"}, { "A9", "105,148"}, { "Comm10", "298,684"}, { "COM10", "298,684"}, { "Env10", "298,684"}, { "DL", "312,624"}, { "DLE", "312,624"}, { "EnvDL", "312,624"}, /* as fall-back: linear units of measurement: */ { "p", "1,1"}, { "i", "72,72"}, { "ft", "864,864"}, { "mm", "2.83465,2.83465"}, { "cm", "28.3465,28.3465"}, { "m", "2834.65,2834.65"}, { NULL, NULL} }; int main( int argc, char *argv[]) { int opt; double ps_bb[4]; int got_bb; int need_remove = 0; myname = argv[0]; while ((opt = getopt( argc, argv, "vfi:c:w:m:p:s:o:P:F")) != EOF) { switch( opt) { case 'v': verbose++; break; case 'f': manualfeed = 1; break; case 'i': imagespec = optarg; break; case 'c': cutmarginspec = optarg; break; case 'w': whitemarginspec = optarg; break; case 'm': mediaspec = optarg; break; case 'p': posterspec = optarg; break; case 's': scalespec = optarg; break; case 'o': filespec = optarg; break; case 'P': pagespec = optarg; break; case 'F': fake_mode = 1; break; default: usage(); break; } } /*** check command line arguments ***/ if (scalespec && posterspec) { fprintf( stderr, "Please don't specify both -s and -p, ignoring -s!\n"); scalespec = NULL; } if (optind < argc) infile = argv[ optind]; else if ( !fake_mode ) { infile = tmpinfile(); need_remove = 1; } /* { fprintf( stderr, "Filename argument missing!\n"); usage(); } */ /*** decide on media size ***/ if (!mediaspec) { mediaspec = DefaultMedia; if (verbose) fprintf( stderr, "Using default media of %s\n", mediaspec); } box_convert( mediaspec, mediasize); if (mediasize[3] < mediasize[2]) { fprintf( stderr, "Media should always be specified in portrait format!\n"); exit(1); } if (mediasize[2]-mediasize[0] <= 10.0 || mediasize[3]-mediasize[1] <= 10.0) { fprintf( stderr, "Media size is ridiculous!\n"); exit(1); } /*** defaulting poster size ? **/ if (!scalespec && !posterspec) { /* inherit postersize from given media size */ posterspec = mediaspec; if (verbose) fprintf( stderr, "Defaulting poster size to media size of %s\n", mediaspec); } /*** decide the cutmargin size, after knowing media size ***/ if (!cutmarginspec) { if (posterspec && (!strcmp( posterspec, mediaspec))) /* zero cutmargin if printing to 1 sheet */ cutmarginspec = "0%"; else cutmarginspec = DefaultCutMargin; if (verbose) fprintf( stderr, "Using default cutmargin of %s\n", cutmarginspec); } margin_convert( cutmarginspec, cutmargin); /*** decide the whitemargin size, after knowing media size ***/ if (!whitemarginspec) { whitemarginspec = DefaultWhiteMargin; if (verbose) fprintf( stderr, "Using default whitemargin of %s\n", whitemarginspec); } margin_convert( whitemarginspec, whitemargin); /*** parse page specification ***/ if ( pagespec && parsepagespec( &pages, &pages_length, &pages_size, pagespec ) == 0 ) { fprintf( stderr, "Wrong page set specification: %s\n", pagespec ); exit( 1 ); } if ( fake_mode ) { do_fake_mode(); exit( 0 ); } /******************* now start doing things **************************/ /* open output file */ if (filespec) { if (!freopen( filespec, "w", stdout)) { fprintf( stderr, "Cannot open '%s' for writing!\n", filespec); exit(1); } else if (verbose) fprintf( stderr, "Opened '%s' for writing\n", filespec); } /******* I might need to read some input to find picture size ********/ /* start DSC header on output */ dsc_head1(); /* pass input DSC lines to output, get BoundingBox spec if there */ got_bb = dsc_infile( ps_bb); /**** decide the input image bounding box ****/ if (!got_bb && !imagespec) { imagespec = DefaultImage; if (verbose) fprintf( stderr, "Using default input image of %s\n", imagespec); } if (imagespec) box_convert( imagespec, imagebb); else { int i; for (i=0; i<4; i++) imagebb[i] = ps_bb[i]; } if (verbose > 1) fprintf( stderr, " Input image is: [%g,%g,%g,%g]\n", imagebb[0], imagebb[1], imagebb[2], imagebb[3]); if (imagebb[2]-imagebb[0] <= 0.0 || imagebb[3]-imagebb[1] <= 0.0) { fprintf( stderr, "Input image should have positive size!\n"); exit(1); } /*** decide on the scale factor and poster size ***/ postersize( scalespec, posterspec); if (verbose > 1) fprintf( stderr, " Output image is: [%g,%g,%g,%g]\n", posterbb[0], posterbb[1], posterbb[2], posterbb[3]); dsc_head2(); printposter(); if ( need_remove ) remove( infile ); exit (0); } static void addpages( int **page_array, int p1, int p2, int n, int *size ) { int i; while ( p2-p1+1+n > *size ) { *size += 100; *page_array = ( int* )realloc( *page_array, sizeof( int ) * ( *size ) ); } for ( i=n+p2-p1; i>=n; i-- ) ( *page_array )[ i ] = i+p1-n; } static void do_fake_mode( void ) { if ( !imagespec ) imagespec = posterspec; box_convert( imagespec, imagebb ); postersize( scalespec, posterspec ); fprintf( stderr, "%d %d %d %g %g %g %g %g %g %g %g %g\n", nrows, ncols, rotate, mediasize[ 2 ], mediasize[ 3 ], cutmargin[ 0 ], cutmargin[ 1 ], posterbb[ 0 ], posterbb[ 1 ], posterbb[ 2 ], posterbb[ 3 ], scale ); exit( 0 ); } static int parsepagespec( int **page_array, int *len, int *size, char *pagespec ) { char *c = pagespec, *r = NULL; int p1, p2; if ( *page_array != NULL ) return 1; *size = 100; *len = 0; *page_array = ( int* )malloc( sizeof( int ) * ( *size ) ); while ( *c != '\0' ) { p1 = p2 = 0; p1 = ( int )strtol( c, &r, 10 ); if ( *r == '\0' || *r == ',' ) p2 = p1; else if ( *r == '-' ) { c = r+1; p2 = ( int )strtol( c, &r, 10 ); if ( *r != '\0' && *r != ',' ) goto error; } else goto error; if ( p1 > 0 && p2 > 0 && p2 >= p1 ) { addpages( page_array, p1, p2, *len, size ); *len += ( p2-p1+1 ); } else goto error; if ( *r == '\0' ) break; c = r+1; } return 1; error: free( *page_array ); *size = 0; return 0; } static char* tmpinfile() { char filename[ 256 ] = {0}; int fd = -1; if ( getenv( "TEMP" ) == NULL ) strcat( filename, "/tmp" ); else strcat( filename, getenv( "TEMP" ) ); strcat( filename, "/poster.XXXXXX" ); fd = mkstemp( filename ); if ( fd == -1 ) { fprintf( stderr, "Cannot create temporary file.\n" ); exit( 1 ); } else { char buffer[ 4096 ]; int n; do { n = fread( buffer, sizeof( char ), 4096, stdin ); if ( n > 0 ) write( fd, buffer, n ); } while ( n == 4096 ); close( fd ); return strdup( filename ); } } static void usage() { fprintf( stderr, "Usage: %s infile\n\n", myname); fprintf( stderr, "options are:\n"); fprintf( stderr, " -v: be verbose\n"); fprintf( stderr, " -f: ask manual feed on plotting/printing device\n"); fprintf( stderr, " -i: specify input image size\n"); fprintf( stderr, " -c: horizontal and vertical cutmargin\n"); fprintf( stderr, " -w: horizontal and vertical additional white margin\n"); fprintf( stderr, " -m: media paper size\n"); fprintf( stderr, " -p: output poster size\n"); fprintf( stderr, " -s: linear scale factor for poster\n"); fprintf( stderr, " -P: comma-separated list of tile pages to print\n" ); fprintf( stderr, " -o: output redirection to named file\n\n"); fprintf( stderr, " At least one of -s -p -m is mandatory, and don't give both -s and -p\n"); fprintf( stderr, " is like 'A4', '3x3letter', '10x25cm', '200x200+10,10p'\n"); fprintf( stderr, " is either a simple or %%. Page lists are comma-\n" ); fprintf( stderr, " separated, each element being a single page or a page range.\n" ); fprintf( stderr, " (ex: 1,2-5,8,10-34)\n\n"); fprintf( stderr, " Defaults are: '-m%s', '-c%s', '-i' read from input file.\n", DefaultMedia, DefaultCutMargin); fprintf( stderr, " and output written to stdout.\n"); exit(1); } #define exch( x, y) {double h; h=x; x=y; y=h;} static void postersize( char *scalespec, char *posterspec) { /* exactly one the arguments is NULL ! */ /* media and image sizes are fixed already */ int nx0, ny0, nx1, ny1; double sizex, sizey; /* size of the scaled image in ps units */ double drawablex, drawabley; /* effective drawable size of media */ double mediax, mediay; double tmpposter[4]; /* available drawing area per sheet: */ drawablex = mediasize[2] - 2.0*cutmargin[0]; drawabley = mediasize[3] - 2.0*cutmargin[1]; /*** decide on number of pages ***/ if (scalespec) { /* user specified scale factor */ scale = atof( scalespec); if (scale < 0.01 || scale > 1.0e6) { fprintf( stderr, "Illegal scale value %s!\n", scalespec); exit(1); } sizex = (imagebb[2] - imagebb[0]) * scale + 2*whitemargin[0]; sizey = (imagebb[3] - imagebb[1]) * scale + 2*whitemargin[1]; /* without rotation */ nx0 = ceil( sizex / drawablex); ny0 = ceil( sizey / drawabley); /* with rotation */ nx1 = ceil( sizex / drawabley); ny1 = ceil( sizey / drawablex); } else { /* user specified output size */ box_convert( posterspec, tmpposter); if (tmpposter[0]!=0.0 || tmpposter[1]!=0.0) { fprintf( stderr, "Poster lower-left coordinates are assumed 0!\n"); tmpposter[0] = tmpposter[1] = 0.0; } if (tmpposter[2]-tmpposter[0] <= 0.0 || tmpposter[3]-tmpposter[1] <= 0.0) { fprintf( stderr, "Poster should have positive size!\n"); exit(1); } if ((tmpposter[3]-tmpposter[1]) < (tmpposter[2]-tmpposter[0])) { /* hmmm... landscape spec, change to portrait for now */ exch( tmpposter[0], tmpposter[1]); exch( tmpposter[2], tmpposter[3]); } /* Should we tilt the poster to landscape style? */ if ((imagebb[3] - imagebb[1]) < (imagebb[2] - imagebb[0])) { /* image has landscape format ==> make landscape poster */ exch( tmpposter[0], tmpposter[1]); exch( tmpposter[2], tmpposter[3]); } /* without rotation */ /* assuming tmpposter[0],[1] = 0,0 */ nx0 = ceil( 0.95 * tmpposter[2] / mediasize[2]); ny0 = ceil( 0.95 * tmpposter[3] / mediasize[3]); /* with rotation */ nx1 = ceil( 0.95 * tmpposter[2] / mediasize[3]); ny1 = ceil( 0.95 * tmpposter[3] / mediasize[2]); /* (rotation is considered as media versus image, which is totally */ /* independent of the portrait or landscape style of the final poster) */ } /* decide for rotation to get the minimum page count */ rotate = nx0*ny0 > nx1*ny1; ncols = rotate ? nx1 : nx0; nrows = rotate ? ny1 : ny0; if (verbose) fprintf( stderr, "Deciding for %d column%s and %d row%s of %s pages.\n", ncols, (ncols==1)?"":"s", nrows, (nrows==1)?"":"s", rotate?"landscape":"portrait"); if (nrows * ncols > 400) { fprintf( stderr, "However %dx%d pages seems ridiculous to me!\n", ncols, nrows); exit(1); } mediax = ncols * (rotate ? drawabley : drawablex); mediay = nrows * (rotate ? drawablex : drawabley); if (!scalespec) /* no scaling number given by user */ { double scalex, scaley; scalex = (mediax - 2*whitemargin[0]) / (imagebb[2] - imagebb[0]); scaley = (mediay - 2*whitemargin[1]) / (imagebb[3] - imagebb[1]); //scalex = (tmpposter[ 2 ]-tmpposter[ 0 ]) / (imagebb[2] - imagebb[0]); //scaley = (tmpposter[ 3 ]-tmpposter[ 1 ]) / (imagebb[3] - imagebb[1]); scale = (scalex < scaley) ? scalex : scaley; if (verbose) fprintf( stderr, "Deciding for a scale factor of %g\n", scale); sizex = scale * (imagebb[2] - imagebb[0]); sizey = scale * (imagebb[3] - imagebb[1]); } /* set poster size as if it were a continuous surface without margins */ posterbb[0] = (mediax - sizex) / 2.0; /* center picture on paper */ posterbb[1] = (mediay - sizey) / 2.0; /* center picture on paper */ posterbb[2] = posterbb[0] + sizex; posterbb[3] = posterbb[1] + sizey; } static void margin_convert( char *spec, double margin[2]) { double x; int i, n; if (1==sscanf( spec, "%lf%n", &x, &n) && x==0.0 && n==strlen(spec)) { /* margin spec of 0, dont bother about a otherwise mandatory unit */ margin[0] = margin[1] = 0.0; } else if (spec[ strlen( spec) - 1] == '%') { /* margin relative to media size */ if (1 != sscanf( spec, "%lf%%", &x)) { fprintf( stderr, "Illegal margin specification!\n"); exit( 1); } margin[0] = 0.01 * x * mediasize[2]; margin[1] = 0.01 * x * mediasize[3]; } else { /* absolute margin value */ double marg[4]; box_convert( spec, marg); margin[0] = marg[2]; margin[1] = marg[3]; } for (i=0; i<2; i++) { if (margin[i] < 0 || 2.0*margin[i] >= mediasize[i+2]) { fprintf( stderr, "Margin value '%s' out of range!\n", spec); exit(1); } } } static void box_convert( char *boxspec, double psbox[4]) { /* convert user textual box spec into numbers in ps units */ /* box = [fixed x fixed][+ fixed , fixed] unit */ /* fixed = digits [ . digits] */ /* unit = medianame | i | cm | mm | m | p */ double mx, my, ox, oy, ux, uy; int n, r, i, l, inx; char *spec; mx = my = 1.0; ox = oy = 0.0; spec = boxspec; /* read 'fixed x fixed' */ if (isdigit( spec[0])) { r = sscanf( spec, "%lfx%lf%n", &mx, &my, &n); if (r != 2) { r = sscanf( spec, "%lf*%lf%n", &mx, &my, &n); if (r != 2) boxerr( boxspec); } spec += n; } /* read '+ fixed , fixed' */ if (1 < (r = sscanf( spec, "+%lf,%lf%n", &ox, &oy, &n))) { if (r != 2) boxerr( boxspec); spec += n; } /* read unit */ l = strlen( spec); for (n=i=0; mediatable[i][0]; i++) { if (!mystrncasecmp( mediatable[i][0], spec, l)) { /* found */ n++; inx = i; if (l == strlen( mediatable[i][0])) { /* match is exact */ n = 1; break; } } } if (!n) boxerr( boxspec); if (n>1) { fprintf( stderr, "Your box spec '%s' is not unique! (give more chars)\n", spec); exit(1); } sscanf( mediatable[inx][1], "%lf,%lf", &ux, &uy); psbox[0] = ox * ux; psbox[1] = oy * uy; psbox[2] = mx * ux; psbox[3] = my * uy; if (verbose > 1) fprintf( stderr, " Box_convert: '%s' into [%g,%g,%g,%g]\n", boxspec, psbox[0], psbox[1], psbox[2], psbox[3]); for (i=0; i<2; i++) { if (psbox[i] < 0.0 || psbox[i+2] < psbox[i]) { fprintf( stderr, "Your specification `%s' leads to " "negative values!\n", boxspec); exit(1); } } } static void boxerr( char *spec) { int i; fprintf( stderr, "I don't understand your box specification `%s'!\n", spec); fprintf( stderr, "The proper format is: ([text] meaning optional text)\n"); fprintf( stderr, " [multiplier][offset]unit\n"); fprintf( stderr, " with multiplier: numberxnumber\n"); fprintf( stderr, " with offset: +number,number\n"); fprintf( stderr, " with unit one of:"); for (i=0; mediatable[i][0]; i++) fprintf( stderr, "%c%-10s", (i%7)?' ':'\n', mediatable[i][0]); fprintf( stderr, "\nYou can use a shorthand for these unit names,\n" "provided it resolves unique.\n"); exit( 1); } /*********************************************/ /* output first part of DSC header */ /*********************************************/ static void dsc_head1() { printf ("%%!PS-Adobe-3.0\n"); printf ("%%%%Creator: %s\n", myname); } /*********************************************/ /* pass some DSC info from the infile in the new DSC header */ /* such as document fonts and */ /* extract BoundingBox info from the PS file */ /*********************************************/ static int dsc_infile( double ps_bb[4]) { char *c, buf[BUFSIZE]; int gotall, atend, level, dsc_cont, inbody, got_bb, n; if (freopen (infile, "r", stdin) == NULL) { fprintf (stderr, "%s: fail to open file '%s'!\n", myname, infile); exit (1); } got_bb = 0; dsc_cont = inbody = gotall = level = atend = 0; while (!gotall && (fgets(buf, BUFSIZE, stdin) != NULL)) /*while (!gotall && (gets(buf) != NULL))*/ { n = strlen( buf ); if ( buf[ n-1 ] == '\n' ) buf[ n-1 ] = 0; if (buf[0] != '%') { dsc_cont = 0; if (!inbody) inbody = 1; if (!atend) gotall = 1; continue; } if (!strncmp( buf, "%%+",3) && dsc_cont) { puts( buf); continue; } dsc_cont = 0; if (!strncmp( buf, "%%EndComments", 13)) { inbody = 1; if (!atend) gotall = 1; } else if (!strncmp( buf, "%%BeginDocument", 15) || !strncmp( buf, "%%BeginData", 11)) level++; else if (!strncmp( buf, "%%EndDocument", 13) || !strncmp( buf, "%%EndData", 9)) level--; else if (!strncmp( buf, "%%Trailer", 9) && level == 0) inbody = 2; else if (!strncmp( buf, "%%BoundingBox:", 14) && inbody!=1 && !level) { for (c=buf+14; *c==' ' || *c=='\t'; c++); if (!strncmp( c, "(atend)", 7)) atend = 1; else { sscanf( c, "%lf %lf %lf %lf", ps_bb, ps_bb+1, ps_bb+2, ps_bb+3); got_bb = 1; } } else if (!strncmp( buf, "%%Document", 10) && inbody!=1 && !level) /* several kinds of doc props */ { for (c=buf+10; *c && *c!=' ' && *c!='\t'; c++); for (; *c==' ' || *c=='\t'; c++); if (!strncmp( c, "(atend)", 7)) atend = 1; else { /* pass this DSC to output */ puts( buf); dsc_cont = 1; } } else if ( !strncmp( buf, "%%Pages:", 8 ) ) { int n; if ( sscanf( buf+8, "%d", &n ) == 1 ) number_pages = n; } } return got_bb; } /*********************************************/ /* output last part of DSC header */ /*********************************************/ static void dsc_head2() { if ( pages == NULL ) printf ("%%%%Pages: %d\n", nrows*ncols*number_pages); else printf ("%%%%Pages: %d\n", pages_length*number_pages); #ifndef Gv_gs_orientbug printf ("%%%%Orientation: %s\n", rotate?"Landscape":"Portrait"); #endif printf ("%%%%DocumentMedia: %s %d %d 0 white ()\n", mediaspec, (int)(mediasize[2]), (int)(mediasize[3])); printf ("%%%%BoundingBox: 0 0 %d %d\n", (int)(mediasize[2]), (int)(mediasize[3])); printf ("%%%%EndComments\n\n"); printf ("%% Print poster %s in %dx%d tiles with %.3g magnification\n", infile, nrows, ncols, scale); } /*********************************************/ /* output the poster, create tiles if needed */ /*********************************************/ static void printposter() { int row, col, page; printprolog(); if ( pages == NULL ) for ( page = 0; page < number_pages; page++ ) for (row = 1; row <= nrows; row++) for (col = 1; col <= ncols; col++) tile( row, col, page); else for ( page = 0; page < number_pages; page++ ) for ( row = 0; row < pages_length; row++ ) { int p = pages[ row ]-1; if ( p+1 > nrows*ncols ) fprintf( stderr, "Warning: page index out of range: %d\n", p+1 ); tile( p/ncols+1, p%ncols+1, page ); } printf ("%%%%EOF\n"); if (tail_cntl_D) { printf("%c", 0x4); } } /*******************************************************/ /* output PS prolog of the scaling and tiling routines */ /*******************************************************/ static void printprolog() { printf( "%%%%BeginProlog\n"); printf( "/cutmark %% - cutmark -\n" "{ %% draw cutline\n" " 0.23 setlinewidth 0 setgray\n" " clipmargin\n" " dup 0 moveto\n" " dup neg leftmargin add 0 rlineto stroke\n" " %% draw sheet alignment mark\n" " dup dup neg moveto\n" " dup 0 rlineto\n" " dup dup lineto\n" " 0 rlineto\n" " closepath fill\n" "} bind def\n\n"); printf( "%% usage: row col tileprolog ps-code tilepilog\n" "%% these procedures output the tile specified by row & col\n" "/tileprolog\n" "{ %%def\n" " gsave\n" " leftmargin botmargin translate\n" " do_turn {exch} if\n" " /colcount exch def\n" " /rowcount exch def\n" " %% clip page contents\n" " clipmargin neg dup moveto\n" " pagewidth clipmargin 2 mul add 0 rlineto\n" " 0 pageheight clipmargin 2 mul add rlineto\n" " pagewidth clipmargin 2 mul add neg 0 rlineto\n" " closepath clip\n" " %% set page contents transformation\n" " do_turn\n" " { pagewidth 0 translate\n" " 90 rotate\n" " } if\n" " pagewidth colcount 1 sub mul neg\n" " pageheight rowcount 1 sub mul neg\n" " do_turn {exch} if\n" " translate\n" " posterxl posteryb translate\n" " sfactor dup scale\n" " imagexl neg imageyb neg translate\n" " tiledict begin\n" " 0 setgray 0 setlinecap 1 setlinewidth\n" " 0 setlinejoin 10 setmiterlimit [] 0 setdash newpath\n" "} bind def\n\n"); printf( "/tileepilog\n" "{ end %% of tiledict\n" " grestore\n" " %% print the cutmarks\n" " gsave\n" " leftmargin botmargin translate\n" " pagewidth pageheight translate cutmark 90 rotate cutmark\n" " 0 pagewidth translate cutmark 90 rotate cutmark\n" " 0 pageheight translate cutmark 90 rotate cutmark\n" " 0 pagewidth translate cutmark 90 rotate cutmark\n" " grestore\n" " %% print the page label\n" " 0 setgray\n" " leftmargin clipmargin 3 mul add clipmargin labelsize add neg botmargin add moveto\n" " (Grid \\( ) show\n" " rowcount strg cvs show\n" " ( , ) show\n" " colcount strg cvs show\n" " ( \\)) show\n" " showpage\n" "} bind def\n\n"); printf( "%%%%EndProlog\n\n"); printf( "%%%%BeginSetup\n"); printf( "%% Try to inform the printer about the desired media size:\n" "/setpagedevice where %% level-2 page commands available...\n" "{ pop %% ignore where found\n" " 3 dict dup /PageSize [ %d %d ] put\n" " dup /Duplex false put\n%s" " setpagedevice\n" "} if\n", (int)(mediasize[2]), (int)(mediasize[3]), manualfeed?" dup /ManualFeed true put\n":""); printf( "/sfactor %.10f def\n" "/leftmargin %d def\n" "/botmargin %d def\n" "/pagewidth %d def\n" "/pageheight %d def\n" "/imagexl %d def\n" "/imageyb %d def\n" "/posterxl %d def\n" "/posteryb %d def\n" "/do_turn %s def\n" "/strg 10 string def\n" "/clipmargin 6 def\n" "/labelsize 9 def\n" "/tiledict 250 dict def\n" "tiledict begin\n" "%% delay users showpage until cropmark is printed.\n" "/showpage {} def\n" "end\n", scale, (int)(cutmargin[0]), (int)(cutmargin[1]), (int)(mediasize[2]-2.0*cutmargin[0]), (int)(mediasize[3]-2.0*cutmargin[1]), (int)imagebb[0], (int)imagebb[1], (int)posterbb[0], (int)posterbb[1], rotate?"true":"false"); printf( "/Helvetica findfont labelsize scalefont setfont\n"); printf( "%%%%EndSetup\n"); } /*****************************/ /* output one tile at a time */ /*****************************/ static void tile ( int row, int col, int pagetoprint) { static int page=1; if (verbose) fprintf( stderr, "print page %d\n", page); printf ("\n%%%%Page: (%d,%d) %d\n", pagetoprint+1, ((row-1)*ncols+col), page); printf ("%d %d tileprolog\n", row, col); printf ("%%%%BeginDocument: %s\n", infile); printfile (pagetoprint); printf ("\n%%%%EndDocument\n"); printf ("tileepilog\n"); page++; } /******************************/ /* copy the PS file to output */ /******************************/ static void printfile (int pagetoprint) { /* use a double line buffer, so that when I print */ /* a line, I know whether it is the last or not */ /* I surely dont want to print a 'cntl_D' on the last line */ /* The double buffer removes the need to scan each line for each page*/ /* Furthermore allows cntl_D within binary transmissions */ char buf[2][BUFSIZE]; int bp; char *c; int currentpage = -1; if (freopen (infile, "r", stdin) == NULL) { fprintf (stderr, "%s: fail to open file '%s'!\n", myname, infile); printf ("/systemdict /showpage get exec\n"); printf ("%%%%EOF\n"); exit (1); } /* fill first buffer for the first time */ fgets( buf[bp=0], BUFSIZE, stdin); /* read subsequent lines by rotating the buffers */ while (fgets(buf[1-bp], BUFSIZE, stdin)) { if ( !strncmp( buf[ bp ], "%%Page:", 7 ) ) currentpage++; /* print line from the previous fgets */ /* do not print postscript comment lines: those (DSC) lines */ /* sometimes disturb proper previewing of the result with ghostview */ if (buf[bp][0] != '%' && ( currentpage == -1 || currentpage == pagetoprint )) fputs( buf[bp], stdout); bp = 1-bp; } /* print buf from last successfull fgets, after removing cntlD */ for (c=buf[bp]; *c && *c != '\04'; c++); if (*c == '\04') { tail_cntl_D = 1; *c = '\0'; } if (buf[bp][0] != '%' && strlen( buf[bp])) fputs( buf[bp], stdout); } static int mystrncasecmp( const char *s1, const char *s2, int n) { /* compare case-insensitive s1 and s2 for at most n chars */ /* return 0 if equal. */ /* Although standard available on some machines, */ /* this function seems not everywhere around... */ char c1, c2; int i; if (!s1) s1 = ""; if (!s2) s2 = ""; for (i=0; i #include /* ** Error macro. Maybe we want stdio, maybe we don't. ** The (undocumented?) variable opterr tells us whether or not ** to print errors. */ #ifdef NO_STDIO #define tell(s) \ if (opterr) \ { \ char ebuf[2]; \ (void)write(2, nargv, (unsigned int)strlen(nargv)); \ (void)write(2, s, (unsigned int)strlen(s)); \ ebuf[0] = optopt; \ ebuf[1] = '\n'; \ (void)write(2, ebuf, 2); \ } #else #define tell(s) \ if (opterr) \ (void)fputs(*nargv, stderr), \ (void)fputs(s,stderr), \ (void)fputc(optopt, stderr), \ (void)fputc('\n', stderr) #endif /* Global variables. */ static char EMSG[] = ""; int opterr = 1; /* undocumented error-suppressor*/ int optind = 1; /* index into argv vector */ int optopt; /* char checked for validity */ char *optarg; /* arg associated with option */ getopt(nargc, nargv, ostr) int nargc; char **nargv; char *ostr; { static char *place = EMSG; /* option letter processing */ register char *oli; /* option letter list index */ if (!*place) /* update scanning pointer */ { if (optind >= nargc || *(place = nargv[optind]) != '-' || !*++place) return(EOF); if (*place == '-') /* found "--" */ { optind++; return(EOF); } } /* option letter okay? */ if ((optopt = *place++) == ':' || (oli = strchr(ostr, optopt)) == NULL) { if (!*place) optind++; tell(": illegal option -- "); goto Bad; } if (*++oli != ':') /* don't need argument */ { optarg = NULL; if (!*place) optind++; } else /* need an argument */ { if (*place) optarg = place; /* no white space */ else if (nargc <= ++optind) { place = EMSG; tell(": option requires an argument -- "); goto Bad; } else optarg = nargv[optind]; /* white space */ place = EMSG; optind++; } return(optopt); /* dump back option letter */ Bad: return('?'); } poster-20050907/COPYING0000644000023600242400000004311107541565370013347 0ustar hermanntkm GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. poster-20050907/Makefile0000644000023600242400000000123307533444251013746 0ustar hermanntkmCFLAGS = -g -Wall #CFLAGS = -O2 -Wall poster: poster.c gcc $(CFLAGS) -o poster poster.c -lm # HPUX: cc -O -Aa -D_POSIX_SOURCE -o poster poster.c -lm # Note that this program might trigger a stupid bug in the HPUX C library, # causing the sscanf() call to produce a core dump. # For proper operation, DON'T give the `+ESlit' option to the HP cc, # or use gcc WITH the `-fwritable-strings' option. install: poster strip poster cp poster /usr/local/bin cp poster.1 /usr/local/man/man1 clean: rm -f poster core poster.o getopt.o tar: tar -cvf poster.tar README Makefile poster.c poster.1 manual.ps rm -f poster.tar.gz gzip poster.tar poster-20050907/poster.10000644000023600242400000002675107533155172013721 0ustar hermanntkm.TH POSTER 1 .fi .SH NAME poster \- Scale and tile a postscript image to print on multiple pages .SH SYNOPSIS .in +7n .ti -7n poster infile .in -7n .SH DESCRIPTION \fIPoster\fP can be used to create a large poster by building it from multiple pages and/or printing it on large media. It expects as input a generic (encapsulated) postscript file, normally printing on a single page. The output is again a postscript file, maybe containing multiple pages together building the poster. The output pages bear cutmarks and have slightly overlapping images for easier assembling. The input picture will be scaled to obtain the desired size. .P The program uses a brute-force method: it copies the entire input file for each output page, hence the output file can be very large. Since the program does not really bother about the input file contents, it clearly works for both black-and-white and color postscript. .P To control its operation, you need to specify either the size of the desired poster or a scale factor for the image: .TP 2n - Given the poster size, it calculates the required number of sheets to print on, and from that a scale factor to fill these sheets optimally with the input image. .TP - Given a scale factor, it derives the required number of pages from the input image size, and positions the scaled image centered on this area. .P Its input file should best be a real `Encapsulated Postscript' file (often denoted with the extension .eps or .epsf). Such files can be generated from about all current drawing applications, and text processors like Word, Interleaf and Framemaker. .br However \fIposter\fP tries to behave properly also on more relaxed, general postscript files containing a single page definition. Proper operation is obtained for instance on pages generated by (La)TeX and (g)troff. .P The media to print on can be selected independently from the input image size and/or the poster size. \fIPoster\fP will determine by itself whether it is beneficial to rotate the output image on the media. .P To preview the output results of \fIposter\fP and/or to (re-)print individual output pages, you should use a postscript previewer like ghostview(1). .ne 5 .SH OPTIONS .TP 3n -v Be verbose. Tell about scaling, rotation and number of pages. .br Default is silent operation. .TP -f Ask manual media feed on the plotting/printing device, instead of using its standard paper tray. .br Default is adhering to the device settings. .TP -i Specify the size of the input image. .br Default is reading the image size from the `%%BoundingBox' specification in the input file header. .TP -m Specify the desired media size to print on. See below for . .br The default is set at compile time, being A4 in the standard package. .TP -p Specify the poster size. See below for . Since \fIposter\fP will autonomously choose for rotation, always specify a `portrait' poster size (i.e. higher then wide). .br If you don't give the -s option, the default poster size is identical to the media size. .TP -s Specify a linear scaling factor to produce the poster. Together with the input image size and optional margins, this induces an output poster size. So don't specify both -s and -p. .br Default is deriving the scale factor to fit a given poster size. .TP -c \fIor\fP -c % .br Specify the cut margin. This is the distance between the cutmarks and the paper edge. If the output is really tiled on multiple sheets, the cut marks indicate where to cut the paper for assembly. This margin must be big enough to cover the non-printable margin which almost all printers have. For see below. .br Default is 5%. Only when you specify identical poster and media sizes, the default cut margin becomes 0, effectively removing the cutmarks. .TP -w \fIor\fP -w % .br Specify a white margin around the output image. .br In the `ideal' situation (when an input `eps' file specifies an exact BoundingBox in its header), the output image will be scaled exactly to the edges of the resulting poster (minus cut margin). If you desire a certain margin to remain around the picture after poster assembly, you can specify this with `-w'. .br (This option is actually redundant, since you can obtain the same result using -s or -i. However some might find this more convenient.) .br Default is 0. .TP -P .br Specify which pages of the poster to print. It consists of a comma-separated list of single pages or page ranges (using the dash). The order in which page number appears determines the final page order in the result PostScript file. Page numbering starts at 1, from left to right and bottom-up. .br Examples: 1-2 or 1,3-4,7 .TP -o Specify the name of the file to write the output into. .br (Only added for those poor people who cannot specify output redirection from their command line due to a silly OS.) .br Default is writing to standard output. .P The mentioned above is a specification of horizontal and vertical size. Only in combination with the `-i' option, the program also understands the offset specification in the . .br In general: = [][] .br with multipier and offset being specified optionally. = * .br = +, .br = or .P Many international media names are recognised by the program, in upper and lower case, and can be shortened to their first few characters, as long as unique. For instance `A0', `Let'. .br Distance names are like `cm', `i', `ft'. .ne 5 .SH EXAMPLES The following command prints an A4 input file on 8 A3 pages, forming an A0 poster: poster -v -iA4 -mA3 -pA0 infile >outfile .ne 3 The next command prints an eps input image on a poster of 3x3 Letter pages: poster -v -mLet -p3x3Let image.eps > outfile .ne 3 The next command enlarges an eps input image to print on a large-media A0 capable device, maintaining 2 inch margins: poster -v -mA0 -w2x2i image.eps > outfile .ne 3 Enlarge a postscript image exactly 4 times, print on the default A4 media, and let \fIposter\fP determine the number of pages required: poster -v -s4 image.eps > outfile .ne 6 Scale a postscript image to a poster of about 1 square meter, printing on `Legal' media, maintaining a 10% of `Legal' size as white margin around the poster. poster -v -mLegal -p1x1m -w10% infile.ps >outfile .ne 5 .SH "PROBLEMS & QUESTIONS" .SS "I get a blurry image and/or interference patterns" If your input file contains -or consists of- pixel images (as opposed to just vector data which is essentially resolution independent), you might have this problem. Such pixel images are normally made to fit well to standard 300 (or 600) dpi devices. Scaling such a picture with an uncarefully chosen factor, can easily lead to hazy edges and interference patterns on the output. The solution is to provide \fIposter\fP with an exact scaling factor (with the -s option), chosen as an integer. If integer scaling is unpractical for your purpose, choose a fractional number made from a small integer denominator (2, 3, 4). .SS "Can I select only a small part of a given input picture?" Yes, for this purpose you can define both the size (width and height) and offset (from left and bottom) of a window on the input image. Specify these numbers as argument to a `-i' command line option. .br One way to obtain such numbers is previewing the original image with ghostview, and observing the coordinate numbers which it continually displays. These numbers are in postscript units (points), named by \fIposter\fP as just `p'. .SS "Poster doesn't seem to work properly, output pages are empty" The major cause for poster not to work correctly, is giving it postscript files which don't conform to proper 'eps' behaviour. Try whether your application (or printer driver) cannot generate real 'encapsulated postscript'. .SS "If I ask for a 50x50cm poster, it always generates something bigger" Yes, probably. When specifying a desired output size with the `-p' option, \fIposter\fP first determines an array of sheets to cover such an area. Then it determines a scale factor for the picture to fill these sheets upto their edge. As result your requested size is used as rough guess only. If you want an exact output size, specify the scaling factor yourself with the `-s' option (and omit the `-p'). .SS "I want to keep the white space around the poster as in my original" \fIPoster\fP will as default use the input image bounding box, and scale/translate that to the edges of your poster. If the program which generated your input file specifies an exact and tight %%BoundingBox, you will indeed loose your white margin. To keep the original margin, specify a `-i' option with as argument the papersize on which the original document was formatted (such as `-iA4'). Alternatively specify a smaller scale factor (with -s) or an explicit new margin (with -w). .ne 4 .SH "POSTER ASSEMBLY" Our preferred method for the assembly of a poster from multiple sheets is as follows: .TP 2n - Arrange the sheets in the proper order on a large table or on the floor. .TP - Remove from all sheets, except from those in the leftmost column or bottom row, their left and bottom cutmargin. .TP - In left-to-right and bottom-to-top order, glue the right (and top) cutmargin and stick the right (and upper) neighbouring page on top of that. .TP - Turn the glued-together poster face bottom, and put adhesive tape on the sheet edges (on the backside of the poster) for more strength. .TP - Remove the remaining cutmargin around the poster. .ne 4 .SH "DEVICE SETTINGS" For postscript level-2 capable printers/plotters, which is about all modern postscript devices today, \fIposter\fP will send device settings in its output file. This consists of a `setpagedevice' call, setting: .TP 2n - the media size. .br This is required for all printers I know to get correct behaviour on different media/picture sizes. .TP - duplexing off. .br Some printers will otherwise perform double-side printing by default. Clearly that is not what you want to print a poster. .TP - manual media feed. .br This is given only when \fIposter\fP was executed with the `-f' command line option. This is a convenient feature if you want to print your job on different media than normally installed in the paper tray, and you are submitting your job through a multi-user networking and spooling environment. .P These settings cause proper device behaviour, without the need to manually interact with the printer settings, and has been here locally tested to work on devices like the HP300XL and HP650C. .P The settings thus passed in the postscript file, will affect the device for this job only. .SH "DSC CONFORMANCE" \fIPoster\fP will generate its own DSC header and other DSC lines in the output file, according the `Document Structuring Conventions - version 3.0', as written down in the `Postscript Language Reference Manual, 2nd ed.' from Adobe Systems Inc, Addison Wesley Publ comp., 1990. .P It will copy any `%%Document...' line from the input file DSC header to its own header output. This is used here in particular for required nonresident fonts. .P However the copy(s) of the input file included in the output, are stripped from all lines starting with a `%', since they tend to disturb our `ghostview' previewer and take useless space anyhow. .SH "SEE ALSO" ghostview(1) .SH "CONTRIBUTED BY" .nf .na Jos van Eijndhoven (email: J.T.J.v.Eijndhoven@ele.tue.nl) Design Automation Section (http://www.es.ele.tue.nl) Dept. of Elec. Eng. Eindhoven Univ of Technology The Netherlands 24 August, 1995 poster-20050907/README0000644000023600242400000000730706030214505013162 0ustar hermanntkmHello candidate `poster' user! Here you have the new release of `poster', to scale postscript images to a larger size, and print them on larger media and/or tile them to print on multiple sheets. With respect to the earlier release: - support is added for foreign (Non European A*) media sizes. - options for scaling became more flexible - original restrictions on white margins in your drawing are removed. For a complete explanation see the accompanying manual. This distribution has the following files: ========================================== README (which you are reading now) Makefile (To compile `poster' in UNIX environments) poster.c (The complete source code) poster.1 (A troff-source manual page for online installation in UNIX) manual.ps (A formatted version of poster.1 in postscript) Furthermore for your convenience: poster.tar.gz (The compressed collection of the above 5 files) poster.exe (a compiled DOS executable) getopt.c (you normally don't need to fetch this, see below) Here a few words on the installation of `poster': ================================================== The complete program consists of really only one file: `poster.c'. Before starting compilation you might want to take a look on the C sources in `poster.c', where you can set a few options around line 30: Maybe you want to change the `DefaultMedia' and `DefaultImage' from "A4" to better reflect your local situation (such as "Letter"). Media names can be chosen from the `mediatable' further down the code. (Maybe you even want to add new media sizes/names there, you can do that without requiring any other change elsewhere) The `Gv_gs_orientbug 1' disables a feature of this program to ask for landscape (horizontal) previewing of rotated images. Our currently installed combination of ghostview 1.5 with ghostscript 3.33 cannot properly do a landscape viewing of the `poster' output. The problem does not exist in combination with an older ghostscript 2.x, and has the attention of the ghostview authors. If you have a different postscript previewing environment, you might want to remove or comment-out the `#define Gv_gs_orientbug 1' line. You should be able to compile this with any ansi-C compiler in a Posix or Xopen environment. You can probably compile it with a command like: cc -O -o poster poster.c -lm (i.e. compile with optimization, and link with the math library) (Some environments miss the required 'getopt()' call, with the include file, if your environment supports none of the SVID, XPG or POSIX standards. If you have this problem, you can comment out the '#include ' line in `poster.c', fetch `getopt.c' from the poster directory, and compile and link these two files together.) (Note that this program might trigger a stupid bug in the HPUX 9.? C library, causing the sscanf() call to produce a core dump. For proper operation, DON'T give the `+ESlit' option to the HP cc, or use gcc WITH the `-fwritable-strings' option.) The resulting executable is fully self-contained, and doesn't require you to install other files at `special' places in the OS. (For DOS users without C compiler, an executable `poster.exe' is available) For UNIX environments (the primary target for the program) there is a man page available `poster.1', which you can copy to /usr/local/man/man1/ to obtain online manual support for the users. The formatted version of this manual is available as a postscript file `manual.ps', such that people who don't know how to format unix man pages, still have documentation to read and print. Success! Jos van Eijndhoven Dept. of Elec. Eng. Eindhoven Univ of Technology The Netherlands email: J.T.J.v.Eijndhoven@ele.tue.nl Sept 20, 1995