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
[Solved] PDF file size
Re: PDF file size
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
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
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
Re: PDF file size
Hello David,
I tried your example today. It works fine.
Thank you for your help!
Jürgen
I tried your example today. It works fine.
Thank you for your help!
Jürgen