[Solved] PDF file size

If you are a VFP developer and have any questions about using our products from VFP here is the place to post them.
Post Reply
Jürgen
Posts: 2
Joined: Wed Jan 07 2009

[Solved] PDF file size

Post by Jürgen »

Hello,

to reduce the size of the pdf file I tried to set the property FileNameOptions respectively FileNameOptionsEx to 0x80000000. That should give automatic image compression.

But in both cases I got the error message: out of range

The maximum value accepted for FileNameOptions is 0x7fff and for FileNameOptionsEx is 0x7fffffff.

So I set ImageOptions to 0x00000003 to remove duplicate images and downsample high-resolution images and FileNameOptionsEx to 0x00020003 which should give low quality jpeg compression.

But there was no effect to the size of the pdf output file.

To generate the output we use VFP9 and Virtual Print Engine ActiveX from Ideal Software.

Could anybody help?
Thanks,

Jürgen
David
Amyuni Team
Posts: 89
Joined: Mon Dec 18 2006

Re: PDF file size

Post by David »

Hello

After setting the ImageOptions value, you need to call the SetDefaultConfig to apply the changes.

Below is a sample VFP code snippet that demonstrates this:

Public NoPrompt
NoPrompt = 0x00000001 && do not prompt for file name
Public UseFileName
UseFileName = 0x00000002 && use file name set by SetDefaultFileName else use document name


cdi = CreateObject("CDIntfEx.CDIntfEx")

&& initialise the Printer
cdi.DriverInit (PrinterName)

&& Set the default output directory and file name
cdi.DefaultDirectory = "c:\temp"
cdi.DefaultFileName = "c:\temp\myfile.pdf"

cdi.JPEGCompression = True && activate JPeg image compression
cdi.JPegLevel = 3 && activate high compression to reduce file size

cdi.ImageOptions = 1 + 2 && removes duplicate images + downsample high resolution image

cdi.SetDefaultConfig && Apply new settings to the printer


SET PRINTER TO NAME (PrinterName)

&& Setting the file name options to NoPrompt and UseFileName
&& To give the generated pdf file a specific name
cdi.FileNameOptions = NoPrompt + UseFileName

&& Enable the printer before each printout for the Developer version
cdi.EnablePrinter (LicensedTo, ActivationCode)

&& Print report
REPORT FORM employees.frx NOEJECT NOCONSOLE TO PRINTER

&& When Printing ends reset fileNameOptions to 0
cdi.FileNameOptions = 0

Hope that helps
David
Amyuni Custom Development
Do you need a specific PDF solution? Are you looking for expertise that will enable you to start or complete a PDF integration project?
http://www.amyuni.com/en/company/services.php
Jürgen
Posts: 2
Joined: Wed Jan 07 2009

Re: PDF file size

Post by Jürgen »

Hello David,

I tried your example today. It works fine.

Thank you for your help!

Jürgen
Post Reply