You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Kaare Rasmussen <ka...@kakidata.dk> on 2003/02/14 16:12:11 UTC
Serve pdf files.
I would like to serve some pdf documents with Embperl. I don't want Apache
to do it if I can avoid it.
I can't just put "$http_headers_out{'Content-Type'} = 'application/pdf';"
at the top; this is in the middle of an EmbperlObject page that has more
work to do.
Solution 1. Open a window with JavaScript. Write to the window with one or
more window.document.write statements.
Backdraw: A lot of effort has to be put into escaping pdf characters that
could annoy JavaScript
Solution 2: Put the file somewhere where I can use an URL.
Backdraw: I have to maintain some kind of temporary directory and unique
file names.
Solution 3: EmbPerl will help me somehow
--
Kaare Rasmussen --Linux, spil,-- Tlf: 3816 2582
Kaki Data tshirts, merchandize Fax: 3816 2501
Howitzvej 75 Åben 12.00-18.00 Web: www.suse.dk
2000 Frederiksberg Lørdag 12.00-16.00 Email:kar@kakidata.dk
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Serve pdf files.
Posted by Gerald Richter <ri...@ecos.de>.
>
> Now I have the pdf file in $var. How do I display it with Embperl?
>
I really thinks it's easier (and faster) to make an Alias in your httpd.conf
e.g.
Alias /pdf /usr/local/pdf
If you really want to do this with Embperl, you either need a directory (or
a fileextention) that is served by Embperl only (no EMbperl::Object) or your
Embperl::Object base template must serve the pdf and exit afterwards.
Something like:
[-
$http_headers_out{'content-type'} = 'application/pdf' ;
$escmode = 0 ;
-][+ $var +]
Do must not have any spaces outside of the brackets
Gerald
--------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
IT-Securitylösungen * dynamische Webapplikationen * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 939-122
WWW: http://www.ecos.de/ Fax: +49 6133 939-333
--------------------------------------------------------------
|
| Besuchen Sie uns auf der CeBIT vom 12. - 19. März 2003
| Messe Hannover * Halle 17 * Stand F 36
| http://www.cebit.de/
|
+-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Serve pdf files.
Posted by Kaare Rasmussen <ka...@kakidata.dk>.
> Try writing more about what you are trying to do instead of how you
> thought you would do it. :-)
Of course. Thought I did that, though.
I have a directory with pdf files, let's call it /usr/local/pdf. I want to be
able to display these pdf files with Embperl.
I don't want to alias the directory into htdocs space.
To do this I have a perl module with two functions.
- first function returns an array with the file names. This lets me choose the
file that I want to display.
- second function takes the file name as a parameter and returns the content
of the pdf file.
Now I have the pdf file in $var. How do I display it with Embperl?
--
Kaare Rasmussen --Linux, spil,-- Tlf: 3816 2582
Kaki Data tshirts, merchandize Fax: 3816 2501
Howitzvej 75 Åben 12.00-18.00 Email: kar@kakidata.dk
2000 Frederiksberg Lørdag 12.00-16.00 Web: www.suse.dk
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Serve pdf files.
Posted by Gerald Richter <ri...@ecos.de>.
> Solution 3: EmbPerl will help me somehow
>
Sorry, but I am not quite understand what's your question? Is it the problem
that it's inside an EmberlObject?
Gerald
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Serve pdf files.
Posted by Ask Bjoern Hansen <as...@develooper.com>.
On Fri, 14 Feb 2003, Kaare Rasmussen wrote:
> Solution 1. Open a window with JavaScript. Write to the window with one or
> more window.document.write statements.
> Backdraw: A lot of effort has to be put into escaping pdf characters that
> could annoy JavaScript
And it could never work; unless the browser natively could figure
out to show the PDF file. It needs to be in a separate document.
> Solution 2: Put the file somewhere where I can use an URL.
> Backdraw: I have to maintain some kind of temporary directory and unique
> file names.
The directory or file does not necessarily have to exist.
Try writing more about what you are trying to do instead of how you
thought you would do it. :-)
- ask
--
ask bjoern hansen, http://www.askbjoernhansen.com/ !try; do();
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org