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. Best, Florian