cancel
Showing results for 
Search instead for 
Did you mean: 

upload Pdf: how to write byte code to context

Former Member
0 Kudos

Hi,

I have a web dynpro application that uses a webservice to upload any Pdf file. The webservice takes the url of the byte code of the pdf file as input as well as filename and url.

For the purpose of sending the byte code to the web service i want to know how to write byte code to the context. How do i go about this?

Thanks

Debashri Prajapati

Accepted Solutions (0)

Answers (2)

Answers (2)

Steven_UM
Contributor
0 Kudos

Write your own custom class that handles the logic and create a context attribute of this java native type ...

This will allow you to hide the inner workings of how to deal with the file handling ( and any other manipulation )

Then you can simply do something like:

wdContext.current<MyElement>().getPDFHandler().<executeMethod>

Regards,

Steven

Former Member
0 Kudos

Hi,

File actualfile = new File(<<fileName>>);

FileInputStream fis = null;

byte[] bytes = null;

try{

fis = new FileInputStream(actualfile);

long length = actualfile.length();

bytes = new byte[(int) length];

long bytesRead = fis.read(bytes);

}

You can create a context Attribute of type binary and assign the above byte array to binary.

Regards, Anilkumar