on 12-06-2006 11:53 AM
Hello!
Can an Interactive Form be generated without displaying it?
I want to ge hold of the pdfContent byte[], but don´t want to display the form.
Thank you!
Ilona Seifert
Hi Ilona,
You can try with the following:
-
import com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.api.IWDPDFDocument;
import com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.api.IWDPDFDocumentCreationContext;
import com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.api.WDPDFDocumentFactory;
import com.sap.tc.webdynpro.basesrvc.util.IOUtil;
...
InputStream template = ... //your XDP file as an inputstream
String xmlData = ... //business data you want to merge your form template with
ByteArrayInputStream dataSourceInputStream = new ByteArrayInputStream(xmlData.getBytes());
ByteArrayOutputStream dataSourceOutputStream = new ByteArrayOutputStream();
ByteArrayOutputStream templateSourceOutputStream = new ByteArrayOutputStream();
// convert InputStream to OutputStream
IOUtil.write(template, templateSourceOutputStream);
IOUtil.write(dataSourceInputStream,dataSourceOutputStream);
IWDPDFDocumentCreationContext creationContext = WDPDFDocumentFactory.getDocumentHandler().getDocumentCreationContext();
creationContext.setTemplate(templateSourceOutputStream);
creationContext.setData(dataSourceOutputStream);
creationContext.setDynamic(true); //if you want to create dynamic interactive form
IWDPDFDocument pdfDoc = creationContext.execute();
// create the PDF and store it as ByteArrayInputStream
InputStream pdfInputStream = pdfDoc.getPDFAsStream();
Best Regards,
Ferenc
P.S.: If you use some older version and the "com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.api" package is not available for you, then you can do the same with the old "com.sap.tc.webdynpro.pdfobject.api" package
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Can you brief me what exactly you are trying to do in your application.
I mean if you do not want to generate the PDF then what are you trying to do.
Thanks,
kris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Kris,
I want to download an interactive form, but do not want to display it on the screen. Currently my pdf is generated when clicking a button, which fires a plug to a new view and displays the interactive form.
Instead I want to use a FileDownload Element, which refers to the pdfSource context attribute, but currently the bytecode is only generated when displaying the output on the screen.
If I set the visibility of my Interactive Form to blank or none, no pdfSource byteCode is generated.
I hope I made my problem clear.
Thanks, Ilona
hi,
Generally the Filedownload is used when trying to call a PDF that is being saved in the location
\src\mimes\Components\<Application Name>\<your PDF file>
So I suppose this feature is not possible where you are trying to directly pop up a screen asking for open/save/cancel the PDF.
setting visibility would not work in this case.
Thanks,
kris
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.