[Wylug-help] Suggestions - printing to ZEBRA credit card printer attached to Win7 PC

Gary Stainburn gary.stainburn at ringways.co.uk
Wed Sep 17 15:54:50 UTC 2014


On Wednesday 17 September 2014 16:46:31 Smylers wrote:
> Hi, Gary. I no almost nothing about printing on Windows, and have never
> heard of the device you're trying to print to.
>
> But if your question is really ‘How do I automate generating custom
> documents which I can then print?’, then I have had success with
> WeasyPrint, which works along the lines of:
>
>   weasyprint input.html output.pdf
>
> input.html can link to a style-sheet. It supports the CSS paged media
> directives, so you can set any page size you want.
>
> I generate input.html using the Perl Template module: the template is an
> HTML file with a few [% placeholders %], which gets instantiated with
> values passed to it from Perl to generate a specific HTML file for the
> current record, and that is what gets passed to WeasyPrint. Other Perl
> templating modules are available, and may be superior.
>
> That just leaves sending the resultant PDF file on Windows to your
> Zebra.
>
> Smylers

Hi Smylers,

Thanks for this. I had already considered using a perl PDF module to generate 
a PDF file, but that still leaves the question of how to print the PDF.

Another option I'm looking at is using perl with Win32::OLE to drive MS Word 
to do the work, but that then needs Word installing on the PC concerned (not 
a huge issue) and relying on MS software (which I try to avoid)
There doesn't seem to be a perl equivelent of the old Delphi print component, 
which is what I was really hoping for. I could have then done everything in 
perl and not relied on Windows / OLE / Word at all.

Gary



More information about the Wylug-help mailing list