Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26415

    Hi (again :-p),

    I search to open a dialog with save/open when I generate a PDF. How can I do it ?
    I know that it seems to be possible to do it with tags but I can’t to use them easily.

    I tried to do it with setContentType(), setHeader()… but I didn’t succeed…

    Thanks for your help.

    #28103

    If you use PD4ML JSP taglib, just define inline=”false” and fileName=”file.pdf” attributes of

    In servlet/PHP/etc scenarios, define

    Content-disposition: attachment; filename=file.pdf

    HTTP response header.

    #28104

    Ok, thanks.

    It was difficult but I succeed. It is a little bit sad and it need to be ameliorated but it works. A simple example :

    int userSpaceWidth = 780;<br /> File output = new File("document.pdf");<br /> FileOutputStream fos = new FileOutputStream(output);<br /> PD4ML pd4ml = new PD4ML();<br /> pd4ml.setHtmlWidth(userSpaceWidth);<br /> pd4ml.render("http://www.w3.org/", fos);<br /> <br /> response.setContentType("application/pdf");<br /> response.setHeader("Content-Disposition", "attachment; filename=document.pdf");<br /> FileInputStream fileInputStream = new FileInputStream(output);<br /> int i;<br /> while ((i=fileInputStream.read())!=-1)<br /> {<br /> response.getOutputStream().write(i);<br /> }<br /> response.getOutputStream().flush();<br /> response.getOutputStream().close();<br /> fileInputStream.close();<br /> output.delete();

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘General questions / FAQ’ is closed to new topics and replies.