cancel
Showing results for 
Search instead for 
Did you mean: 

RFC returning PDF form in Binary table

Former Member
0 Kudos

Hello,

In our earlier application we were using a RFC to return PDF form as a table of binary fields and then these fields were concatenated and .pdf extension addded at the end. This will then display correctly in browser as a pdf form. Typically, this returns about 30000+ lines of binary for one form.

Now we are migrating this application to Portal and I'm trying to display all this information through Adobe Interactive form. We do not currently have any other RFC to return all data that is part of the existing PDF document returned by current RFC. Getting all that data through one RFC is a tedious and time consuming task that we want to avoid. Is there a way to use the binary table returned by existing application and convert it to a pdf form? I was thinking of using the 'pdfsource' property of Interactive form - but am not sure about the possibilities.

Can anyone help with some pointers?

Thanks,

Vishwas.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

If you want to convert Binary data into PDF in WD JAVA you can use following code:

IWDResource resource;

resource = WDResourceFactory.createCachedResource(

"Binary String",

"FileName",

WDWebResourceType.PDF);

IWDWindow window = wdComponentAPI .getWindowManager() .createNonModalExternalWindow(

resource.getUrl(0), "FileName");

window.show();

Hope this helps.

With Regards,

Amit

Former Member
0 Kudos

I'm using following code to concatenate the binary string and then to display the PDF file.

Concatenation was being done in earlier application and there is no code available for reference. I've tried following code, it opens the Adobe PDF viewer but it always shows error "File does not start with %PDF-". Please let me know if the code below is correct or is there something I need to do differently.

public void wdDoInit()

{

//@@begin wdDoInit()

IWDMessageManager manager = wdComponentAPI.getMessageManager();

//Populate data for RFC

wdContext.currentZ_Sd_Get_Output_Pdf_Verify_InputElement().setKappl("V1");

wdContext.currentZ_Sd_Get_Output_Pdf_Verify_InputElement().setKschl("ZA00");

wdContext.currentZ_Sd_Get_Output_Pdf_Verify_InputElement().setKunag("0001000021");

wdContext.currentZ_Sd_Get_Output_Pdf_Verify_InputElement().setKunwe("0001000023");

wdContext.currentZ_Sd_Get_Output_Pdf_Verify_InputElement().setVbeln("0000018261");

//Call RFC

wdThis.wdGetPDF_from_Binary_compController().executeZ_Sd_Get_Output_Pdf_Verify_Input();

int num = wdContext.nodePdf4().size();

//Initial string

String s = "";

for(int n=0;n<num;n){

//Concatenate binary data in string with Radix 2

BigInteger bi = new BigInteger(wdContext.nodePdf4().getPdf4ElementAt(n).getData());

s= bi.toString(2);+

}

manager.reportSuccess(s);

// Display pdf

IWDResource resource = WDResourceFactory.createCachedResource(s.getBytes(), "file.pdf", WDWebResourceType.PDF);

IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(resource.getUrl(0),"file.pdf");

window.show();

//@@end

}

It opens the Adobe PDF viewer but gives error "file does not start with %PDF-".

What is it that I'm not doing correctly here?

Thanks,

Vishwas.

The data being returned from RFC is in RAW format. Is it same as Binary?

Edited by: Vishwas Madhuvarshi on Mar 6, 2008 10:54 PM