Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Render a PDF using Perl
    primarykey
    data
    text
    <p>Is it possible to render a pdf in a browser using PERL? What I have is a flash application that sends the rendered pdf binary to perl. The pdf is generated from AlivePDF.</p> <pre><code>#!C:\Perl\bin\perl.exe ## BEGIN { $ENV{PATH} = ''; delete @ENV{ 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; } use strict; use warnings; no warnings qw (redefine closure); use CGI; my $CGI = new CGI(); #name=generated.pdf&amp;method=inline these are passed via the URL and are in the environmental variable QUERY_STRING my %nv_pairs = map{my @tmp = split(/=/,$_);$tmp[0] =&gt; $tmp[1] }split(/&amp;/,$ENV{QUERY_STRING}); my $name = $nv_pairs{name}; my $method = $nv_pairs{method}; #Raw Data is stored in the POST Parameter POSTDATA my $pdf = $CGI-&gt;param('POSTDATA'); print "Content-Type: application/pdf\r\n"; print "Content-Length: " . length($pdf) . "\r\n"; print "Content-Disposition :$method\n\n"; print $pdf; </code></pre> <p>The problem is that I want to actually render what a pdf will look like. I can save that binary code and open it manually in Adobe Reader and it renders properly.</p> <p>I would like for it to render in the browser, but I don't know how to get it to.</p> <p>Currently the output (what the browser displays), looks like this:</p> <pre><code>Content-Type: application/pdf Content-Length: 432785 Content-disposition:inline; filename="test.pdf" %PDF-1.5 1 0 obj &lt;&lt;/Type /Pages /Kids [3 0 R 5 0 R] /Count 2&gt;&gt; endobj 3 0 obj &lt;&lt;/Type /Page /Parent 1 0 R /MediaBox [0 0 612.00 792.00] /Resources 2 0 R </code></pre> <p>This is only part of the displayed file, but I hope this helps. I don't want the code to display, I want it to look graphical. If I download this file, and change the extension to .pdf, it works perfectly.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload