Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Avery Label Layout in PDF-Maker

From: greggirwin:mindspring at: 4-Nov-2003 16:58

Hi Ted, Here's something QAD you can probably hack against and improve. -- Gregg REBOL [ title: "PDF label maker" author: "Gregg Irwin" ] do %pdf-maker.r rows-per-page: 10 cols-per-page: 3 labels-per-page: 30 x-coordinate: [6.223 76.073 145.923] y-coordinate: [241.3 215.9 190.5 165.1 139.7 114.3 88.9 63.5 38.1 12.7] ; The address data is in the following format - typically the block will ; contain a couple of hundred addresses: addresses: copy [] repeat i 60 [ append addresses compose/deep [ [(join "JOE-" i) "BLOW" "1234 MELISSA DRIVE" "BURLINGTON" "VT" "00822-2957"] [(join "JILL-" i) "BLOW" "5678 CAMAY CIRCLE" "PUTNAM" "MA" "00123-5678"] ] ] format-label-text: func [ data "A block containing a single record" /local result ][ form head insert next insert at copy data 3 newline newline ] make-page: func [ data "One page worth of data (max)" /local result cell ][ result: copy [page size 215.9 279.4] repeat row rows-per-page [ repeat col cols-per-page [ either (cell: row - 1 * cols-per-page + col) <= length? data [ append result dbg: compose/deep [ ;textbox x y w h text textbox (x-coordinate/:col) (y-coordinate/:row) 63.246 21.4 [ as-is font Times-Roman 3.53 (format-label-text pick data cell) ] ] ][ return result ] ] ] result ] make-pages: func [ data "All data" /local page-count result ][ result: copy [] page-count: to integer! divide length? data labels-per-page if 0 <> remainder length? data labels-per-page [ page-count: page-count + 1 ] repeat page page-count [ append/only result make-page copy/part at data 1 + (page - 1 * labels-per-page) labels-per-page ] result ] make-pdf-labels: func [data] [ write/binary %labels.pdf layout-pdf lay: make-pages data ; for testing ;save %labels.lay lay ] make-pdf-labels addresses halt