如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來

i042416發表於2020-08-30

My series of Cloud Application Studio Blogs

Requirement

You have created your custom BO with attachment upload functionality available via this blog  Step by step to enable your custom BO with attachment upload functionality. And now you have successfully uploaded two images as attachment to a given BO instance:


如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來 如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來 如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來


You would like that once preview button is pressed, the PDF will be generated which display these two images from uploaded attachment.

The rendered PDF looks as below:


如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來


This requirement just needs a few enhancement on the form template itself, whose development is already introduced in blog  Step by Step to create an Adobe Print form in Cloud application Studio.

(1) Open the form template via Adobe Form Designer, menu File -> Form Property:


如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來


Set PDF Render Format as Dynamic XML Form:


如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來


(2) Select your body page and set the Content property as “Flowed” instead of “Positioned”:


如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來


(3) Drag a table control from control toolbox, select table header node and DO NOT bind any BO nodes to it.


如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來


Select table row node, bind it to path: $.TestBO.Attachment.DocumentList[*] and mark the checkbox “Repeat Row for Each Data Item”:


如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來


Select the last column field in table row, change its type for Text Field to Image Field:


如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來


And use relative binding to bind its path to the corresponding BO field BinaryObject which stores the binary data of an attachment.


如何將SAP C4C自定義BO中型別為圖片的附件用PDF文件顯示出來


After that in the runtime when the PDF is rendered, the table row will automatically be created based on the number of uploaded images as attachment, this behavior is called as “Data Driven Layout process”.


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2715823/,如需轉載,請註明出處,否則將追究法律責任。

相關文章