Skip to content

Commit a54985a

Browse files
authored
Merge pull request #76 from j-obriot/pdftoipe
pdftoipe: use image colorspace instead of components
2 parents 8f9432d + 09bfcc7 commit a54985a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pdftoipe/xmloutputdev.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,13 @@ void XmlOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
345345
GfxRGB rgb;
346346
int x, y;
347347
int c;
348+
GfxColorSpaceMode colormode = colorMap->getColorSpace()->getMode();
348349

349350
writePSFmt("<image width=\"%d\" height=\"%d\"", width, height);
350351

351352
const double *mat = state->getCTM();
352-
double tx = mat[0] + mat[2] + mat[4];
353-
double ty = mat[1] + mat[3] + mat[5];
354-
writePSFmt(" rect=\"%g %g %g %g\"", mat[4], mat[5], tx, ty);
353+
writePSFmt(" rect=\"0 1 1 0\" matrix=\"%g %g %g %g %g %g\"",
354+
mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
355355

356356
if (str->getKind() == strDCT && !inlineImg &&
357357
3 <= colorMap->getNumPixelComps() && colorMap->getNumPixelComps() <= 4) {
@@ -398,7 +398,7 @@ void XmlOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
398398
}
399399
str->close();
400400
#endif
401-
} else if (colorMap->getNumPixelComps() == 1) {
401+
} else if (colormode == csDeviceGray || colormode == csCalGray) {
402402
// write as gray level image
403403
writePS(" ColorSpace=\"DeviceGray\"");
404404
writePS(" BitsPerComponent=\"8\"");

0 commit comments

Comments
 (0)