Unable to set image compression

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
marco
Posts: 6
Joined: Wed Nov 06 2002

Unable to set image compression

Post by marco » Wed Nov 06 2002

Hello!
I am using the ActiveX interface of the CDIntf (version 2.06) and while I am able to set the JPEG compression of the output file (by setting JPEGCompression = true) I don't seem able to set the level of compression for JPEGs.

I've tried to set the "JPegLevel" property to all the values from 1 to 9 but I always get the same result.

Any ideas in regard?

Thanks,

- Marco

Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan » Thu Nov 07 2002

Hi,

You can set Jpeg Compression and the compression level by adding the appropriate parameter to the call of FileNameOptions.

For more details please check Appendix D in the user manual "Amyuni PDF Converter.pdf"

Please note that you can use FileNameOptionsEx instead of FileNameOptions if you want to call this function with long parameters from the ActiveX interface of CDintf.

Hope this helps.

marco
Posts: 6
Joined: Wed Nov 06 2002

Post by marco » Thu Nov 07 2002

I will add a bit more of information so you can understand better my situation.

I am using C# and I want to print an Excel workbook to pdf using the CDIntf via COM interop. If I use this code:
CDIntf.CDIntf pdfPrn = new CDIntf.CDIntfClass();
pdfPrn.DriverInit("PDFConverter");
pdfPrn.JPEGCompression = true;
pdfPrn.JPegLevel = (short)7;
pdfPrn.SetDefaultConfig();

excelWKBook.PrintOut(Missing.Value, Missing.Value, 1, false, "PDFConverter on LPT1:", true, false, strReportPath.ToString() + ".pdf");

pdfPrn.DriverEnd();

Marshal.ReleaseComObject(pdfPrn);
pdfPrn = null;
it does work, but no matter which number I assing to the "JPegLevel" property I get always the same output.

If I try the following code (as you suggested):
CDIntf.CDIntf pdfPrn = new CDIntf.CDIntfClass();
pdfPrn.DriverInit("PDFConverter");
pdfPrn.DefaultFileName = strReportPath.ToString() + ".pdf";
pdfPrn.FileNameOptionsEx = 1 + 2 + 20000;

pdfPrn.SetDefaultConfig(); //<- with or without this does not make difference

excelWKBook.PrintOut(Missing.Value, Missing.Value, 1, false, "PDFConverter on LPT1:", true, false, strReportPath.ToString() + ".pdf");

pdfPrn.FileNameOptionsEx = 0;

pdfPrn.DriverEnd();
Marshal.ReleaseComObject(pdfPrn);
pdfPrn = null;
Excel hangs my application when I call the PrintOut method.

Now, this is very important for me since my boss has to decide if buying your component or not in the next 48 hours. JPeg compression is not really a biggie for us but would greatly help in having a customizable output.

Thanks for any help,

- Marco

Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan » Fri Nov 08 2002

Hi,

Hanging the application is not related to adding JpegCompression to FileNameOptions.

Please call:

pdfPrn.FileNameOptionsEx = 1 + 2 + 131072

20000 is the Hex value, when converting it to decimal you will get 131072.

Have a nice day!

Post Reply