on 04-16-2007 9:47 AM
Hi!
I'm tryng to create an Adobe PDF for user to download and print in Web Dynpro. I've all the information previously create into a dynamically form, but now I try to put a print button for print this form into a PDF. There are some documentation?
Thanks and sorry for my english
hi,
when you execute the application , the form will be opened in adobe reader services , there itself you will get the option of print button.
check this link
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you can use iText (http://www.lowagie.com/iText/) to create your PDF.
As an example create a ActionButton in your view named ShowPDF and the related onActionShowPDF Method. You can Print/Save/Send via EMail etc..
(<b>Note: Part of the SourceCode posted is from the the Weblog of Prakash Singh
"Create a PDF file using JAVA which i used when i tried to solve my problem.
/people/prakash.singh4/blog/2005/04/05/create-a-pdf-file-using-java
public void onActionShowPDF(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionShowPDF(ServerEvent)
try
{
//create your document
Document document = new Document(PageSize.A4);
//we need a buffer to where the PDF Content will be written into
ByteArrayOutputStream aos = new ByteArrayOutputStream();
//bind the pdf writer to your document and the output stream
PdfWriter.getInstance(document, aos);
//open the document to add your content
document.open();
//create a table with 3 columns
PdfPTable table = new PdfPTable(3);
//create a cell
PdfPCell cell;
//add the first row as header
cell = new PdfPCell(new Paragraph("Rank"));
cell.setBackgroundColor(new Color(34, 90, 141));
table.addCell(cell);
cell = new PdfPCell(new Paragraph("Name"));
cell.setBackgroundColor(new Color(34, 90, 141));
table.addCell(cell);
cell = new PdfPCell(new Paragraph("Points"));
cell.setBackgroundColor(new Color(34, 90, 141));
table.addCell(cell);
//add the data rows.
int flag = 0;
Color bg;
for (int i = 0; i <= 10; i++)
{
//alternate colors
if (flag == 0)
{
flag = 1;
bg = new Color(204, 204, 255);
} else
{
flag = 0;
bg = new Color(255, 255, 255);
}
cell = new PdfPCell(new Paragraph("1"));
cell.setBackgroundColor(bg);
table.addCell(cell);
cell = new PdfPCell(new Paragraph("Prakash Singh: " + i));
cell.setBackgroundColor(bg);
table.addCell(cell);
cell = new PdfPCell(new Paragraph("" + (50000 - i * 10) + ""));
cell.setBackgroundColor(bg);
table.addCell(cell);
}
document.add(table);
document.close();
//ok we have now a filled bytearray with our PDF content and we want to display it
byte[] pdfContent=aos.toByteArray();
IWDCachedWebResource pdfResource = WDWebResource.getWebResource(pdfContent,WDWebResourceType.PDF);
wdComponentAPI.getWindowManager().createExternalWindow(pdfResource.getURL(),"Test View",true).open();
} catch (Exception e)
{
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.