[NTG-pdftex] pdflatex includegraphics eats newline of stream

The Thanh Han hanthethanh at gmail.com
Wed Jan 8 23:26:33 CET 2014


On 8 January 2014 21:12, Florian Breitwieser <florian.bw at gmail.com> wrote:
> Hi Peter and Karl,
> I think I found the reason:
>
> In [pdftexdir/pdftoepdf.cc, line 603], a stream is written, and
> pdf_newline() is called after it:
>     } else if (obj->isStream()) {
>         initDictFromDict(obj1, obj->streamGetDict());
>         pdf_puts("<<\n");
>         copyDict(&obj1);
>         pdf_puts(">>\n");
>         pdf_puts("stream\n");
>         copyStream(obj->getStream()->getUndecodedStream());
>         pdf_newline();
>         pdf_puts("endstream");  // can't simply write pdfendstream()
>
> However, this pdf_newline is optional [pdftexdir/utils.c, line 161]:
>   void pdf_newline(void)
>   {
>       if (pdflastbyte != '\n')
>           pdf_puts("\n");
>   }
>
> The new line should be always written using pdf_puts("\n") instead of
> pdf_newline() to have a correct stream length.

yes indeed, many thanks for your effort. Please feel free to commit
the change to texlive svn if you would like, would be much
appreciated.

Regards,
Thanh


More information about the ntg-pdftex mailing list