[ic] Pushing a PDF file through an IC page

Tim Nelson interchange-users@icdevgroup.org
Mon Mar 31 12:44:01 2003


Hi all.

I have a Document Imaging server that can return a PDF document containing
the scanned image of a signed Order.  I can access that PDF by pulling
data from a socket.  I am trying to use an ActionMap to re-direct and
handle this. As a test I cobbled up an ActionMap that just opens a local
PDF and tries to push it through IC.  The behavior is strange, I can call
the page over and over, and every now and then the browser says the page
was processed, but the PDF plug-in is never called (if I click refresh the
image does come up!).  

Any ideas on what might be the problem, or can you propose a better way to
handle this?

Thanks.

Action map...

ActionMap do_doc_save <<EOR
sub {
   my $deliverable = shift;
   my $file = "/tmp/foo.pdf";
   my $r;
   my $filler = "";
   my $i;

   for ($i = 1; $i <= 8192; $i++) {
      $filler .= " ";
   }

   $CGI->{mv_nextpage} =~ s:^do_doc/::;
   $CGI->{mv_nextpage} .= $Session->{extension};

   if($Session->{browser} =~ /msie/i) {
      $Document->header("Content-type: application/x-foolmsie");
   } else {
      $Document->header("Content-type: application/pdf");
   }
   $Document->hot(1);

   open(IMGFILE, $file);
   binmode(IMGFILE);
   $r = join '', <IMGFILE>;
   HTML ($r . $filler);
   close(IMGFILE);

   return 0;
}
EOR

And the test page that calls to it...

[set mv_add_dot_html][/set]
[bounce href="do_doc/foo.pdf"]
[set mv_add_dot_html]1[/set]