User (Old forums)MemberOctober 22, 2007 at 7:14 pmPost count: 23064
We are storing document files (images, pdf, etc) as binary in the database. I would like to compress and then stream the compressed byte to the client for download.
The download code is functional, however the resulting compressed file is “unknown format or damaged”. I am certain the file is not corrupt, as I am able to successfully stream an uncompressed image to the browser and download it as well.
Am I missing something in the compression? There is nothing in the documentation other than the single method call. Thank you for your help.
Private Sub DownloadFile()
Dim bytes As Byte()
Dim output As Byte()
‘get file binary from DAM
bytes = m_DamHelper.GetFileImageData(m_FileID)
bytes = Nothing
If m_Uncompressed Then
m_FileExt = “pdf”
output = bytes
Xceed.Compression.Licenser.LicenseKey = “REMOVED”
[b]output = QuickCompression.Compress(bytes, CompressionMethod.Deflated, CompressionLevel.Normal)[/b]
.BufferOutput = True
.ContentType = “application/” + m_FileExt
.AppendHeader(“content-disposition”, “attachment; filename=file.” + m_FileExt)
‘error during download
Imported from legacy forums. Posted by SokViChet (had 2915 views)User (Old forums)MemberOctober 22, 2007 at 7:16 pmPost count: 23064
btw, i incorrectly tagged the line i wish to highlight. I do not have the [b][/b] in my code, of course.
Imported from legacy forums. Posted by SokViChet (had 242 views)Xceed SupportMemberOctober 25, 2007 at 1:44 pmPost count: 5658
I tried reproducing this error and I was not able to. I did the same kind of process using QuickCompression and also tested it with XceedCompressedStream. Both method were able to compress and decompress the byte arrays without any glitch.
Imported from legacy forums. Posted by CharlesB (had 3670 views)
- You must be logged in to reply to this topic.