You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Sabine K." <la...@gmail.com> on 2007/05/10 11:10:51 UTC
T5: Generate pdfs.
Hello,
i want to generate a pdf file from some textareas. To generate the pdfs i
want to use itext. Can u give me some hinds were i can get some information
for generating pdfs?
Best regards
--
View this message in context: http://www.nabble.com/T5%3A-Generate-pdfs.-tf3720491.html#a10409778
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: AW: AW: T5: Generate pdfs.
Posted by Marcus <mv...@gmail.com>.
Thank you Daniel.
Re: AW: AW: T5: Generate pdfs.
Posted by Daniel Jue <te...@gmail.com>.
Like this:
1) For action links, informal parameters
<t:actionlink target="_blank">Start guessing</t:actionlink>
2)
For forms with a submit, where the result page opens in a new window:
<t:form t:id="doReportsForm" action="reportsForm" target="_blank">
<t:submit t:id="onSubmit" name="Run Report" value="Run Report" />
</t:form>
On 5/11/07, Marcus <mv...@gmail.com> wrote:
> Hi Sabine,
>
> Do you know how to open it in another window?
>
> Thank's
>
> Marcus
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: AW: AW: T5: Generate pdfs.
Posted by Marcus <mv...@gmail.com>.
Hi Sabine,
Do you know how to open it in another window?
Thank's
Marcus
Re: AW: AW: T5: Generate pdfs.
Posted by "Sabine K." <la...@gmail.com>.
Thx Peter,
i found a way with this:
public class PdfWriterTestPage
{
public StreamResponse onSubmit()
{
// Create PDF
InputStream is=generatePDF("Hello very nice world");
// Return response
return new PdfStreamResponse(is);
}
public InputStream generatePDF(String teststring)
{
// step 1: creation of a document-object
Document document = new Document();
ByteArrayOutputStream baos=new ByteArrayOutputStream();
try
{
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter.getInstance(document, baos);
// step 3: we open the document
document.open();
// step 4: we add a paragraph to the document
document.add(new Paragraph(teststring));
}
catch (DocumentException de)
{
System.err.println(de.getMessage());
}
// step 5: we close the document
document.close();
ByteArrayInputStream bais=new ByteArrayInputStream(baos.toByteArray());
return bais;
}
class PdfStreamResponse implements StreamResponse
{
private InputStream is;
public PdfStreamResponse(InputStream is)
{
this.is=is;
}
public String getContentType()
{
return "application/pdf";
}
public InputStream getStream() throws IOException
{
return is;
}
}
}
Peter Schröder-2 wrote:
>
> hi sabine,
>
> i overlooked your topic!
>
> there are other possibilities in T5, you can use the SreamResponse to
> return a PDF via a listener!
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html
>
> -----Ursprüngliche Nachricht-----
> Von: Ulrich Stärk [mailto:uli@spielviel.de]
> Gesendet: Donnerstag, 10. Mai 2007 11:46
> An: Tapestry users
> Betreff: Re: AW: T5: Generate pdfs.
>
> Especially have a look at how to create your own service to output raw
> bytes instead of rendering a
> HTML page.
>
> Uli
>
> Peter Schröder schrieb:
>> hi sabine,
>>
>> take a look at http://www.agileskills2.org/EWDT/
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Sabine K. [mailto:larrelt@gmail.com]
>> Gesendet: Donnerstag, 10. Mai 2007 11:11
>> An: users@tapestry.apache.org
>> Betreff: T5: Generate pdfs.
>>
>>
>> Hello,
>>
>> i want to generate a pdf file from some textareas. To generate the pdfs i
>> want to use itext. Can u give me some hinds were i can get some
>> information
>> for generating pdfs?
>>
>> Best regards
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/T5%3A-Generate-pdfs.-tf3720491.html#a10410947
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org