1. Raja RAMASAMY
  2. PowerBuilder
  3. Tuesday, 2 May 2023 07:48 AM UTC

Hello all

I have PDF files (retrieved from database BLOB). I need to compress these files.

How do I do it? Is there any utility or tool available that I could use from within my PowerBuilder application?

Thanks in advance.

Raja

 

Andreas Mykonios Accepted Answer Pending Moderation
  1. Tuesday, 2 May 2023 12:58 PM UTC
  2. PowerBuilder
  3. # 1

I believe that this kind of customizations may be available in PB 2022 R2... Currently the only thing you can change is the compression applied to images. By default it embeds images as bmp which are uncompressed. You can change that by setting Export.PDF.NativePDF.ImageFormatproperty = 1 or 2. No more options. Of course it depends on version of PB you are using!

As for PB 2022 R2, beta should be launched during this month. Right after we may have a better insight of new possibilities.

Andreas.

Comment
  1. Armeen Mazda @Appeon
  2. Tuesday, 2 May 2023 14:48 PM UTC
I agree with Andreas evaluate PB 2022 R2 see if it meets your needs before you consider spending money on a third-party PDF utility. The beta version should be available this month.
  1. Helpful
There are no comments made yet.
Raja RAMASAMY Accepted Answer Pending Moderation
  1. Tuesday, 2 May 2023 12:48 PM UTC
  2. PowerBuilder
  3. # 2

Hi Andreas

Thanks for your response. When I say compression, I mean compressing the PDF file and keep it as PDF file. Not compressing it to ZIP format.

Raja

 

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Tuesday, 2 May 2023 08:47 AM UTC
  2. PowerBuilder
  3. # 3

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.

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.