[luatex] Chunks of pdfe.readfromstream()
Andreas Matthias
andreas.matthias at gmail.com
Thu Mar 30 17:02:44 CEST 2023
On Thu, Mar 30, 2023 at 1:54 PM luigi scarso <luigi.scarso at gmail.com> wrote:
>
>
> On Tue, 14 Mar 2023 at 20:35, Andreas Matthias <andreas.matthias at gmail.com>
> wrote:
>
>> The manual says that
>>
>> str, n = pdfe.readfromstream(<stream>)
>>
>> reads the stream in chunks. Now I had expected that `str` is just one
>> chunk of the whole stream.
>> But it seems that `str` always contains the whole stream.
>>
>> Could someone enlighten me what "read in chunks" means?
>>
>>
> I need a short example .
>
Run texlua with this code:
local doc = pdfe.open('test.pdf')
local page = pdfe.getpage(doc, 1)
local stream = page['Contents']
pdfe.openstream(stream)
local str, n = pdfe.readfromstream(stream)
print(str)
print(n)
Here test.pdf is:
\pdfvariable compresslevel = 0
\pdfvariable objcompresslevel = 0
Lorem ipsum dolor sit amet
... a lot more text here ...
\bye
Not matter how long the stream is, pdfe.readfromstream() always returns the
whole stream.
What's the difference to pdfe.readwholestream()?
Cheers
Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/luatex/attachments/20230330/915ba0ed/attachment.html>
More information about the luatex
mailing list.