Context remains empty
I've uploaded a pdf using UI upload element - works fine
I'm viewing that uploaded (interactive) pdf in interactiveform ui element - works fine: the fields are filled in
Problem: the context attributes (from node bound to pdf) remain empty... (although they are bound to the textfields in the pdf)
Hello Jeroen Verdrengh,
For the UsePdf mode, the datasource is not populated automatically as it is done for other modes. The idea behind the usage of this mode is to make it work as a pdf viewer. For example, you have some reports in pdf format and in one of your workflows/applications you would like to show them on the screen that does not involve any ADS interaction, no data update, no form update. A plian pdf viewer in webdynpro. From this perspective, the way this UsePdf mode is working in your application is expected and not a bug.
Now there are two ways you can approach your problem. First one is fairly simple, offcourse if your application permists you to do so. After the pdf has been uploaded you must be submitting the pdf to the server, isn't it ? This submission will take care of context popultion from the pdf data. The other way is to use the following interface to force populate the datasource as follows:
Method transferPDFDataIntoContext extracts data from a PDF document and copies
the values into the Web Dynpro Context. The xml structure of the document data
is applied starting from the specified target node. Usually, this node should be the
same context node to which <code>InteractiveForm</code>-UIELement property <code>dataSource</code>
is bound during PDF generation.
@param pdfSource PDF document as <code>byte</code>
@param targetNode target <code>IWDNode</code>
<b>WDInteractiveFormHelper.transferPDFDataIntoContext(byte pdfSource, IWDNode targetNode);</b>
Please follow the javadoc above. Call the method in your upload action handler as soon as you have the pdf document in hand as byte array. Target node is the datasource node that is bound to the context. Make sure that you have your datasorce mapped to a context node along with any other attributes that you might have for your app.
One more suggestion, please do not use PDFObject API (you must be talking about IWDPDFObject interface, right). This has been deprecated starting with NW04s SP06. A new set of more comprehensive APIs are available for the same. Hence, moving forward to NW04s, you will have problem in maintaining your application code.