FlateDecode for PDF file (Flate Compression)
-
Does anyone know how to use the .net2 (c#)
DeflateStream
to compress content for a pdf? I have the PDF stuff written and working fine including text, images etc with the page contents in plain unicode. Example5 0 obj<< /Length 278 >>stream [commands to write to PDF page in unicode] endstream
When I try to compress the [commands to write to PDF page in unicode] part and add the /Filter /FlateDecode into the pdf object header, Acrobat seems not to recognise the compression and just returns a blank page. I found a Microsoft article http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=97064[^] which seems to indicate the the MS version of flate compression does not follow the original spec for zlib and needs two additional characters before the stream. I have used byte[0] = 88 and also 120 and byte[1] = 0 followed by the byte stream of the compressed page, but still doesn't work. Has anyone managed to use the DeflateStream successfully and if so, could you point me in the right direction please.