[Sussex] 2D Bar codes

Brendan Whelan b_whelan at mistral.co.uk
Wed May 25 12:28:27 UTC 2005


Thanks for the responses.

Useful bits if found whilst investigating how to create a 2d bar code and
load it into an RTF document.

I found a useful zip file at  http://examples.oreilly.com/rtfpg/  The
rtf_image_embed_sample.pl contains a jpeg example

The example below shows how to unpack an ASCII string, as found in images,
and convert it to a hex string (which we then embedded) in an RTF file.
<?php
/*
* Convert a hex string to ASCII with hexstr()
* Convert a ASCII string to a hex string with strhex()
*
*
* Paul Gregg <pgregg at pgregg.com>
* 3 October 2003
*
* Open Source Code:   If you use this code on your site for public
* access (i.e. on the Internet) then you must attribute the author and
* source web site: http://www.pgregg.com/projects/php/code/hexstr.phps
*
*/

Function hexstr($hexstr) {
  $hexstr = str_replace(' ', '', $hexstr);
  $retstr = pack('H*', $hexstr);
  return $retstr;
}

Function strhex($string) {
  $hexstr = unpack('H*', $string);
  return array_shift($hexstr);
}

$teststr = "64 65 74 61 69 6c 73";
#$teststr = "01 02 63 00 39 00 45 00 36 00 43 00 32 00 30 00 41 00 30 00 00
00";

$str = hexstr($teststr);
$hex = strhex($str);
print "<pre>";
print "Original Hex: $teststr\n\n";
print "Result from hexstr: "; var_dump( $str ); print "\n";
print "Result from strhex: "; var_dump( $hex ); print "\n";

?>
Regards,

Brendan


----- Original Message -----
From: "Chris Jones" <cmsj at tenshu.net>
To: "LUG email list for the Sussex Counties" <sussex at mailman.lug.org.uk>
Sent: Monday, May 23, 2005 11:43 AM
Subject: Re: [Sussex] 2D Bar codes


> Hi
>
> On Fri, 20 May, 2005 16:09, Brendan Whelan said:
> > Has anyone any suggestions as to where we could get a free copy of the
> > PDF417 font or any other comments on what we want to achieve ?
>
> Are you able to insert images into the RTFs at will? If so there is a
> PDF417 encoder available here:
>
> http://webpages.charter.net/jtlien/pdf.html
>
> Never used it though, could be complete pap ;)
>
> Cheers,
> --
> Chris Jones
>   cmsj at tenshu.net
>    www.tenshu.net
>
>
> _______________________________________________
> Sussex mailing list
> Sussex at mailman.lug.org.uk
> Sussex LUG Website: http://www.sussex.lug.org.uk/
> http://mailman.lug.org.uk/mailman/listinfo/sussex
>
>






More information about the Sussex mailing list