deflatestream

Error while trying to decompress stream in PDF

帅比萌擦擦* 提交于 2019-12-01 14:23:17
问题 I'm trying to decompress a stream from a PDF Object in this file: 4 0 obj << /Filter /FlateDecode /Length 64 >> stream xœs QÐw34V02UIS0´0P030PIQÐpÉÏKIUH-.ITH.-*Ê··×TÉRp á T‰ Ê endstream endobj I have this stream copy-pasted with the same format as in the original file in a file called Stream.file xœs QÐw34V02UIS0´0P030PIQÐpÉÏKIUH-.ITH.-*Ê··×TÉRp á T‰ Ê This stream should translate to: Donde esta curro?? . Added that stream to a Stream.file in a C# Console application. using System.IO; using

Is it possible to use the .NET DeflateStream for pdf creation?

依然范特西╮ 提交于 2019-12-01 05:53:17
I'm playing around with the ability to create pdf files through C# code. I have been looking at the PDF specifications and have been able to create a working PDF file, done by taking strings of data and encoding them into byte arrays using the UTF8 Encoding. The problem I run into is when I try to use the DeflateStream on the pdf stream objects. It just doesn't seem to work: Here is the text version of the pdf object that is in question ( \r\n is at the end of each line, just not visible here): 5 0 obj <</Length 45>> stream BT 70 50 TD /F1 12 Tf (Hello, world!) Tj ET endstream endobj When I

GZipStream and DeflateStream produce bigger files

怎甘沉沦 提交于 2019-12-01 03:35:30
I'm trying to use deflate/gzip streams in C# but it appears that the files after compression are bigger than before. For example, I compress a docx file of 900ko, but it produce a 1.4Mo one ! And it does it for every file I tried. May be I am wrong in the way I'm doing it? Here is my code : FileStream input = File.OpenRead(Environment.CurrentDirectory + "/file.docx"); FileStream output = File.OpenWrite(Environment.CurrentDirectory + "/compressedfile.dat"); GZipStream comp = new GZipStream(output, CompressionMode.Compress); while (input.Position != input.Length) comp.WriteByte((byte)input

zip and unzip string with Deflate

♀尐吖头ヾ 提交于 2019-11-28 10:52:53
I need to zip and unzip string Here is code: public static byte[] ZipStr(String str) { using (MemoryStream output = new MemoryStream()) using (DeflateStream gzip = new DeflateStream(output, CompressionMode.Compress)) using (StreamWriter writer = new StreamWriter(gzip)) { writer.Write(str); return output.ToArray(); } } and public static string UnZipStr(byte[] input) { using (MemoryStream inputStream = new MemoryStream(input)) using (DeflateStream gzip = new DeflateStream(inputStream, CompressionMode.Decompress)) using (StreamReader reader = new StreamReader(gzip)) { reader.ReadToEnd(); return

Read Dynamics NAV Table Metadata with SQL

半世苍凉 提交于 2019-11-27 03:45:30
问题 I would like to be able to read the Dynamics NAV 2013 Table Metadata directly from the SQL Server database without requiring the NAV Development Environment. I can view the binary SQL "image" BLOB columns with a query like the following (filter as appropriate with WHERE clause): SELECT o.[Name], m.[Object Type], m.[Metadata], -- XML Metadata m.[User Code], -- C# Metadata m.[User AL Code] -- C/AL Metadata FROM [Navision].[dbo].[Object Metadata] AS m JOIN [Navision].[dbo].[Object] AS o ON m.