--- /dev/null
+--- xmloutputdev.cpp
++++ xmloutputdev.cpp
+@@ -336,7 +336,7 @@
+ // dump JPEG stream
+ std::vector<char> buffer;
+ // initialize stream
+- str = ((DCTStream *)str)->getRawStream();
++ str = str->getNextStream();
+ str->reset();
+ // copy the stream
+ while ((c = str->getChar()) != EOF)