Pinstripe/Printer: Difference between revisions
→{{header|Go}}: Amended to now work on both Windows and Unix based systems.
(→{{header|Go}}: Tweaked drawing parameters to produce 1 inch bands when printing on A4 paper.) |
(→{{header|Go}}: Amended to now work on both Windows and Unix based systems.) |
||
Line 50:
=={{header|Go}}==
{{libheader|Go Graphics}}
<br>
The code for this task is basically the same as for [[Pinstripe/Display#Go]] except that the drawing parameters have been tweaked to produce 1 inch bands when printing on A4 paper and some code has been added to dump the image to the default printer.
Line 59 ⟶ 58:
"log"
"os/exec"
"runtime"
)
Line 82:
dc := gg.NewContext(842, 595)
pinstripe(dc)
dc.SavePNG(fileName)
cmd := exec.Command("mspaint", "/pt", "w_pinstripe.png")▼
var cmd *exec.Cmd
if runtime.GOOS == "windows" {
} else {
cmd = exec.Command("lp", fileName)
}
if err := cmd.Run(); err != nil {
log.Fatal(err)
|