<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I have a PDF where 'pdftops -level1sep -optimizecolorspace' gets 'Syntax Error: Could not find start of jpeg data' and drops part of the image.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The problem happens in PSOutputDev::doImageL1Sep() where it prescans the image by making a new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits()).</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
When I made the patch to add -optimizecolorspace, I had first tried scanning the original stream and then using imgStr->reset(), but it didn't work for some types of streams, so I switched creating a new stream, which is the code currently in poppler.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
But even that doesn't seem to work for DCTStream.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Is the problem that some types of streams can never be reread (which means that -optimizecolorspace can't work as written) or that rereading streams isn't well tested and I might be able to fix it by reviewing the initialization?</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I can post a bug report, including the PDF, which is only 350KB, if it would help.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks, <span style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">William</span></div>
</body>
</html>