On Thu, 30 Mar 2023 at 17:03, Andreas Matthias <[email protected]> wrote:
> On Thu, Mar 30, 2023 at 1:54 PM luigi scarso <[email protected]> > wrote: > >> >> >> On Tue, 14 Mar 2023 at 20:35, Andreas Matthias < >> [email protected]> 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. > use this as test.pdf %% context --luatex test.tex \nopdfcompression \startTEXpage \switchtobodyfont[3pt] \dorecurse{4500}{ Lorem ipsum dolor sit amet ... a lot more text here ...} \stopTEXpage -- luigi
