Skip to Content
Former Member
Jun 04, 2009 at 03:38 AM

Binary Data to PDF and Word Doc



We have requirement to open a PDF or DOC in a new window from a BAPI output structure. The field returned from the BAPI is a binary field. Following is the code that is implemented for this scenario.

for(int i=0;i<wdcontext.nodeOutput().nodePtx_Drao().size();i++)


IWDCachedWebResource resource = WDwebResource.getWebResource(wdcontext.nodeOutput().nodePtx_Drao().getPtx_DraoElementAt(i).getOrblk(), WdWebResourcetype.PDF);


IWDWindow win = wdComponentAPI.getWindowManager().createNonModalExternalWindow(resource.getUrl(WDFileDownloadBehaviour.OPEN_PLACE.ordinal()), "test");;

The problem we are facing here is when we try to open the PDF it throws an error saying "File does not begin with '%PDF-'". If we try to open a word document by changing the resource type some junk values are coming.

Has anyone come across this type of development issues?

Appreciate all your replies and new inputs in this regard.

Thanks & Regards,