Hi.
You don't mention what version of PowerBuilder you are using. This is a problem, because there are objects in PB to compress and decompress files but they were introduced in PB 2019. So if you use PB 2019+ then you can compress your files but you may have in mind that:
- PDF may have content such as images that may already be compressed.
- PDF has many formats, depending on the format used compression may vary.
What I wanna say is that depending on the content of the pdfs you may see different grades of compression.
Simple example of compression in PB 2019:
blob lbl_pdf, lbl_pdf_compressed
CompressorObject lnv_compressor
// your blob should contain the pdf somehow (example using selectblob)...
lnv_compressor = create CompressorObject
lnv_compressor.level = CompressionLevelMaximum!
lnv_compressor.compress(lbl_pdf, lbl_pdf_compressed, ArchiveFormat7Zip!)
if isvalid(lnv_compressor) then destroy lnv_compressor
// lbl_pdf_compressed will contain the pdf compressed as 7zip.
Formats in which you can compress are as follow (mentioned in documentation):
- ArchiveFormatZIP! -- zip file. Supports AES-256 encryption for password. This is the default value.
- ArchiveFormat7Zip! -- 7zip file. Supports AES-256 encryption for password.
- ArchiveFormatGZip! -- gzip format archive. Supports compressing a single file.
- ArchiveFormatTAR! -- tar format archive.
From my tests usually 7zip gives the best result.
You may wanna read:
New or enhanced PowerBuilder objects - - What's New (appeon.com)
CompressorObject object - - Objects and Controls (appeon.com)
ExtractorObject object - - Objects and Controls (appeon.com)
Andreas.