[javascript] util.readFileIntoStream.read() doesn't return anything  SOLVED

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

User avatar
Mathew
User
Posts: 957
Joined: Thu Jun 19, 2014 7:30 pm

[javascript] util.readFileIntoStream.read() doesn't return anything

Post by Mathew »

[PXCE 11.0.1] According to the API, util.readFileIntoStream() should return a readstream object that I can get hex encoded string from its read() method. I've tried the following, that does return chunks from Acrobat, but from PXCE the object returns nothing.

Is the only way to get the whole string with util.stringFromStream()? Is there a better way to do this?

Code: Select all

function parseFile(path) {
  var stream = util.readFileIntoStream(path);
  var chunk;
  console.show();
  while (chunk = stream.read(1000)) {
    console.println("Chunk: " + chunk.length);
  }
}

parseFile(this.path)
I've also tried Collab.documentToStream(doc) and also with that, I can only get the whole lot as a string in one go with util.stringFromStream()
Last edited by Mathew on Thu Sep 17, 2026 11:32 pm, edited 1 time in total.
User avatar
Sean - PDF-XChange
Site Admin
Posts: 1467
Joined: Wed Sep 14, 2016 5:42 pm

Re: [javascript] util.readFileIntoStream.read() doesn't return anything

Post by Sean - PDF-XChange »

Hi Mathew,

I've asked the team for their input here.

Kind regards,
Sean Godley
Technical Writer
PDF-XChange Co LTD
Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623
User avatar
Sean - PDF-XChange
Site Admin
Posts: 1467
Joined: Wed Sep 14, 2016 5:42 pm

Re: [javascript] util.readFileIntoStream.read() doesn't return anything  SOLVED

Post by Sean - PDF-XChange »

Update - this will be fixed in the next build.

Kind regards,
Sean Godley
Technical Writer
PDF-XChange Co LTD
Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623