#!/usr/bin/perl # by Miguel Sánchez # Converts a D-NOTE file to an SVG file # each stroke turns into a polyline # print " image/svg+xml "; open(FILE,$ARGV[0]); # filename binmode(FILE); # it is a binary file read(FILE,$header,64); # ignore header $down = 0; while(read(FILE,$point,8)) { @byte = unpack ("C*",$point); $x = $byte[1] + $byte[2] * 128 + ($byte[6] & 3) * 16384 ; $y = $byte[3] + $byte[4] * 128 + (($byte[6]>>2) & 3) * 16384 ; $p = $byte[0]; if($p==0xa1 && $down==0) { print "\n\n"; $down=0; } } if($down==1) { print "\" stroke=\"black\" fill=\"none\"/>\n"; } print "";