Lambda the Ultimate had an interesting story yesterday about domain-specific languages.
#!/usr/bin/perl -w use strict; use PDFLib; my $pdf = new PDFLib ( filename => "slides.pdf", papersize => "letter", orientation => "landscape", creator => "Paul Hudak", title => "The Promise of Domain Specific Languages", ); foreach (<*.gif>) { my ($stem) = m/(.*?).gif/; print STDERR "$stem\n"; `convert $stem.gif $stem.png`; my $img = $pdf->load_image(filetype => "png", filename => "$stem.png",); $pdf->start_page(); $pdf->add_image(img => $img, x => 0, y => 0); $pdf->end_page(); unlink ("$stem.png"); }Many thanks to Matt Sergeant for the PDFLib module. I actually spent more time looking at the module documentation than I did writing and testing this code. :-)
Now back to that presentation about DSLs...
Re:Hah!
ziggy on 2002-05-16T22:04:53
I vaguely remember a discussion about this a few months ago. What are the issues involved? According to the business topics page, the only commercial issues involve shipping commercial products that incorporate PDFlib. Use in a commercial setting seems OK.As to the PDF spec, it's dense, but comprehesible. There's a lot of prior art involved as well, so PDF falles under the "exceedingly well documented" umbrella (modulo PDF Forms). If only that were true of RTF, which looks like a TeX-influenced bad acid trip, with a spec (v1.5) that's about as clear (once you pry it away from its forgotten ghetto of the web).
Re:Hah!
Matts on 2002-05-16T22:46:59
You can't run a web site where you make money that uses PDFLib. Their license forbids it (obviously unless you have a commercial license from them). I think this makes axkit.org actually illegal, since I host ads there (I should remove them since they pay so little) and I serve presentations generated with AxPoint.Re:Hah!
gav on 2002-05-17T04:04:37
There seems to be lots of PDF modules on cpan including: I looked over these a few months back and found the lack of documentation and examples quite daunting. I can't use PDFLib due as everything I do at work is in a commerical setting:) Has anyone had any luck with these modules? On reading and working with existing PDFs I've actually had more luck using pdftohtml (not to be confused with pdf2html!) and then post-processing using HTML::TreeBuilder.