You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Mitchell, Scott(LIT)" <S....@Liberty-IT.co.uk> on 2002/01/31 11:55:43 UTC
pdf filename
Does anyone know how I can specify a filename to come up on the Save As
dialog when running FOP from a Servlet.
I have the following code, and when the pdf is created, the resultant action
is inserted as the filename. Is there any way I can change this?
// Create a new driver
Driver driver = new Driver();
driver.setRenderer(new org.apache.fop.render.pdf.PDFRenderer());
driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
// Carry out SVG element mapping
driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
// Send output
driver.setOutputStream(new BufferedOutputStream(baos));
// Build the FO tree
driver.buildFOTree(xmlReader, new InputSource(formReader));
// Format the driver
driver.format();
// Render PDF
driver.render();
// Remove temoporary xml file if it exists
File xml = new File(xmlFile);
if (xml != null)
{
mLogger.logDebug("Deleting temporary XML File");
xml.delete();
}
// Clean up
baos.close();
stylesheet.close();
Thanks.
Scott Mitchell
Experienced Software Developer
Liberty Information Technology Direct Line: ++44 (0) 28 9044 5582
Clarendon House Fax: ++44 (0) 28 9044 5511
9-21 Adelaide Street Switchboard: ++44 (0) 28 9044 5500
Belfast, Northern Ireland BT2 8DJ Email:
S.Mitchell@Liberty-IT.co.uk
Disclaimer: The contents of this e-mail and attached files in no way reflect
any policies of Liberty Information Technology Ltd.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
RE: pdf filename
Posted by Alistair Hopkins <al...@berthengron.co.uk>.
You should be able to specify various filenames in headers but IE5 doesn't
play.
response.setHeader("Content-Disposition","attachment;
filename=\"myFile.pdf\""); //This doesn't seem to work!
Add a bogus bit of xtra path info - the filename - on the end of the calling
URL, and that does work
Replace
http://www.myServer.com/myServlet?file=myFile.pdf
With
http://www.myServer.com/myServlet/myFile.pdf?file=myFile.pdf
-----Original Message-----
From: Mitchell, Scott(LIT) [mailto:S.Mitchell@Liberty-IT.co.uk]
Sent: Thursday, January 31, 2002 10:56 AM
To: fop-dev@xml.apache.org
Subject: pdf filename
Does anyone know how I can specify a filename to come up on the Save As
dialog when running FOP from a Servlet.
I have the following code, and when the pdf is created, the resultant action
is inserted as the filename. Is there any way I can change this?
// Create a new driver
Driver driver = new Driver();
driver.setRenderer(new org.apache.fop.render.pdf.PDFRenderer());
driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
// Carry out SVG element mapping
driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
// Send output
driver.setOutputStream(new BufferedOutputStream(baos));
// Build the FO tree
driver.buildFOTree(xmlReader, new InputSource(formReader));
// Format the driver
driver.format();
// Render PDF
driver.render();
// Remove temoporary xml file if it exists
File xml = new File(xmlFile);
if (xml != null)
{
mLogger.logDebug("Deleting temporary XML File");
xml.delete();
}
// Clean up
baos.close();
stylesheet.close();
Thanks.
Scott Mitchell
Experienced Software Developer
Liberty Information Technology Direct Line: ++44 (0) 28 9044 5582
Clarendon House Fax: ++44 (0) 28 9044 5511
9-21 Adelaide Street Switchboard: ++44 (0) 28 9044 5500
Belfast, Northern Ireland BT2 8DJ Email:
S.Mitchell@Liberty-IT.co.uk
Disclaimer: The contents of this e-mail and attached files in no way reflect
any policies of Liberty Information Technology Ltd.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org