This project is read-only.

pdf has unreadable words after compression

Jul 22, 2010 at 12:49 PM
Edited Jul 22, 2010 at 12:51 PM
Hi all, There is a problem with the zip generation in The zip is filled with pdf's (created with bullzip from word 2003 docs) and sometimes (to make it simple) some pdf's have headers where all characters are on top of each other. The rest of the paragraph is readable. The source generated pdf does not have this problem, so this is cosed by the compression. Problem is that the pdf;s are legal contracts and therefore illegal when signing...

Does anybody have any ideas or similar experiences?


Dim WithEvents mobj_Zip As Ionic.Zip.ZipFile

Public Function ZipFiles(ByVal aZipFile As String, ByVal FoldersAndOrFiles As String(), Optional ByVal aDirectoryPathInArchive As Boolean = True) As Boolean
7960: Using mobj_Zip = New Ionic.Zip.ZipFile
7970: With mobj_Zip
7980: .CompressionLevel = Ionic.Zlib.CompressionLevel.Default
7990: .ZipErrorAction = ZipErrorAction.Throw
8000: End With
8010: RaiseEvent Progress(1, Nothing, Nothing, 0)
8020: For Each Entry As String In FoldersAndOrFiles
8030: Dim f = New IO.FileInfo(Entry)
8040: If (f.Attributes And IO.FileAttributes.Directory) > 0 Then
8050: RaiseEvent Progress(10, "Folder", Entry, 0)
8060: If aDirectoryPathInArchive Then
8070: mobj_Zip.AddDirectory(Entry)
8080: Else
8090: mobj_Zip.AddDirectory(Entry, "")
8100: End If
8110: Else
8120: RaiseEvent Progress(11, Entry, IO.Path.GetDirectoryName(Entry), 0)
8130: If aDirectoryPathInArchive Then
8140: mobj_Zip.AddFile(Entry)
8150: Else
8160: mobj_Zip.AddFile(Entry, "")
8170: End If
8180: End If
8190: Next Entry

8200: RaiseEvent Progress(20, Nothing, Nothing, Nothing)
8210: Call mobj_Zip.Save(aZipFile)
8220: RaiseEvent Progress(30, Nothing, Nothing, Nothing)

8230: mobj_Zip.Dispose()
End Using
8240: mobj_Zip = Nothing
8250: Return True

End Function

Jul 28, 2010 at 12:55 PM
Looks like that code does the compression. Hard to tell what the problem is when you don't show the code that does decompression. Here's the thing: zip archives use a crc, which verifies that the decompressed content is identical to the original file content. Dotnetzip automatically verifies that crc in most cases and throws an exception if the crc does not match. This means it's impossible to get modified content in a compress/decompress cycle using the zip format. Something you are doing is causing this. I suggest that it is how you are creAting the output file. Post your code. Pls eliminate line numbers and use the codeplex code formatting widget. It makes it much easier to read code. Good luck.