On 2005-09-22, Evan A. Zacks <[EMAIL PROTECTED]> wrote:
> Hello folks,
>
> I'm working on an output plugin that will convert html content to
> pdf. It handles setting the content-type and content-disposition
> headers before returning.

NIce. I also generate PDFs sometimes with HTMLDoc, and welcome a helper
module for this. 

Thanks for the contribution!

>
>   # $opts{converter} is HTMLDoc, for example
>
>   my $pack= "CGI::Application::Plugin::Output::PDF::$opts{converter}";
>   eval "require $pack";
>   croak "Can't load converter [$pack]" if $@;
>
>   return $pack->convert( ... );
>
> Is this filthy? 

Yes. Follow the suggestions elsewhere in the thread about how to pass in
config options. 

> If the user has CGI::Application version 4 or newer, and he does
> not request any symbols for import, pdf_output() is automatically
> installed as a postrun callback. This allows for transparent
> conversion from html to pdf:
>
>   use CGI::Application::Plugin::Output::PDF;
>
>   # ...
>
>   return $template->output; # sent to browser as pdf

I would rather an explicit conversion call be required by default,
since one run mode out of ten may need a PDF conversion.

People who want auto-conversion for every run mode can request that:

  use CGI::Application::Plugin::Output::PDF qw/:auto_convert_all/;

That would be uncommon in my own use.

    Mark

--
 . . . . . . . . . . . . . . . . . . . . . . . . . . . 
   Mark Stosberg            Principal Developer  
   [EMAIL PROTECTED]     Summersault, LLC     
   765-939-9301 ext 202     database driven websites
 . . . . . http://www.summersault.com/ . . . . . . . .


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to