on 04-10-2008 7:52 AM
Hi,all
I want to get byte[] from Resource property that I'm using in FileUpload element.
How can I do it?
Regards,
Michael
solved by myself
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
u can use this code for getting data
IPrivateExtractData.IContextElement contextElement = wdContext.currentContextElement();
byte[] bytes = contextElement.getPdfSource();
try
{
File file = new File("C:
Trilochan
generate.pdf");
FileOutputStream os = new FileOutputStream(file);
os.write(bytes);
os.close();
}
catch (IOException e)
{
e.printStackTrace();
}
hope this will work for u.
Regards
Trilochan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(wdContext.currentContextElement().getFileResource());
InputStreamReader isr = new InputStreamReader(byteArrayInputStream);
BufferedReader br = new BufferedReader(isr);
wdThis.wdGetMesarimAppController().fillTables();
String line = "";
try {
int i = 0;
while ((line = br.readLine())!=null && i<10) {
String l = line;
}
}catch (Exception e){
e.printStackTrace();
}
Edited by: Yoel Malekan on Apr 10, 2008 11:24 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you can give a try with the following code
IWDResource r; // Your existing resource
byte b[];
InputStream inputStream;
try {
inputStream = r.read(true);
int x = inputStream.read(b);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.