itext and Java Servlets: problem

View: New views
1 Messages — Rating Filter:   Alert me  

itext and Java Servlets: problem

by rjalv :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have created a pdf file with itext using a Java Servlet. When I call the servlet, I open the file in the Web Browser. For that, I use the next code in the Servlet class:

        res.setHeader("expires", "0");
        res.setContentType("application/pdf");
        res.setHeader("Pragma", "public");
        res.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
        res.setHeader("max-age","0");
        res.setHeader("Content-Disposition","inline; filename="+ strArchivo + ".pdf");

However, when I save a copy of the pdf file, the name shown is not the specified by strArchivo, but it is "http___....pdf".

If I use         res.setHeader("Content-Disposition","attachment; filename="+ strArchivo + ".pdf"); it works, but it doesn't work with "inline".

How can I resolve the problem? Can I set the file name with itext?

Thanks.
LightInTheBox - Buy quality products at wholesale price