[NTG-pdftex] endstream

Martin Schröder martin at oneiros.de
Mon Jul 25 03:09:16 CEST 2005


On 2005-07-25 02:04:16 +0200, Martin Schröder wrote:
> On 2005-07-24 23:52:18 +0200, Hans Hagen wrote:
> > In former pdftex verions 'endstream' was on a line of its own, which is 
> > more handy when looking into a pdf file that the current 'end of line' 
> > method.
> 
> The only places where endstream is written without explicit
> newline before it are in pdftoepdf.cc and writejpg.c and haven't
> changed since 1.11a ...

And these aren't responsible here.
----------------------------------------
procedure pdf_end_stream; {end a stream}
begin
    if pdf_compress_level > 0 then
        zip_write_state := zip_finish
    else
        pdf_stream_length := pdf_offset - pdf_save_offset;
    pdf_flush;
    write_stream_length(pdf_stream_length, pdf_stream_length_offset);
    pdf_print_nl;
    pdf_print_ln("endstream");
    pdf_end_obj;
end;

@ Basic printing procedures for PDF output are very similiar to \TeX\ basic
printing ones but the output is going to PDF buffer. Subroutines with
suffix |_ln| append a new-line character to the PDF output.

@d pdf_new_line_char == 10 {new-line character for UNIX platforms}

@d pdf_print_nl == {output a new-line character to PDF buffer}
if (pdf_ptr > 0) and (pdf_buf[pdf_ptr - 1] <> pdf_new_line_char) then
    pdf_out(pdf_new_line_char)
----------------------------------------
This would be fine, but pdf_flush sets pdf_ptr := 0, which makes
the call to pdf_print_nl a nop. :-( Which doesn't matter in
non-compressed state, as pdf_end_text puts a nl after an "ET".

Replaced with a direct call to pdf_out(pdf_new_line_char) if
pdf_compress_level > 0.

This is a mess -- just look at samplepdf.pdf:
\pdfobj stream {Hello} 
creates 
----------------------------------------
stream
Helloendstream
endobj
----------------------------------------
 
Best
    Martin
-- 
                    http://www.tm.oneiros.de


More information about the ntg-pdftex mailing list