Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Is it accessible Stream Object string to Object Stream in C#

Community Beginner ,
Sep 14, 2020 Sep 14, 2020

I'm using Java Script to convert Image to string and store in the field value. As we can see the below Javascript:

// Getting the Object
var oFile = this.getDataObjectContents("Test1");
//object into the string 
var cFile = util.stringFromStream(oFile, "utf-8");
// storing in the field
this.getField("Text2").value = cFile;

I'm reading all the field On the pdf and I'm able to get the field Value, but when I'm trying to write it, in the Server/Local machine I'm not able to write the image. I'm using the below code.

byte[] br;
 // (cc.Value)// value of the fieldbr = Encoding.ASCII.GetBytes(cc.Value);
//br=  imgToByteArray
byte[] pdfdata = Encoding.ASCII.GetBytes(cc.Value);

Stream streamed = new MemoryStream(pdfdata);
Stream InputStream = streamed;
byte[] result;

using (var streamReaderWE = new MemoryStream())
{
    InputStream.CopyTo(streamReaderWE);    result = streamReaderWE.ToArray();
    File.WriteAllBytes(fileNameEEEE, result);
}

 

Thanks

TOPICS
Acrobat SDK and JavaScript
442
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2020 Sep 14, 2020
LATEST

This is not using Adobe products. rival products are not discussed here. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines