ultimatepp/uppdev/DecompressPDF/DecompressPDF.cpp
cxl acd590d240 Syncing uppdev
git-svn-id: svn://ultimatepp.org/upp/trunk@1809 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2009-12-13 22:16:41 +00:00

28 lines
561 B
C++

#include <Core/Core.h>
#include <plugin/z/z.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
FileIn in("u:/Dokument-A.pdf");
FileOut out("u:/out.pdf");
while(!in.IsEof()) {
String s = in.GetLine();
int q = s.Find("stream");
if(q < 0)
out << s << "\n";
else {
out << s.Mid(0, q + 6);
out << "stream";
s = s.Mid(q + 6);
while(!in.IsEof()) {
s.Cat(in.Get());
if(s.GetLength() > 9 && memcmp(s.End() - 9, "endstream", 9) == 0) {
out << ZDecompress(s) << "\nendstream\n";
break;
}
}
}
}
}