Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Re: "Feature not supported", PdfCompressor.Write
Started by Andrew Polden at 06-05-2008 3:31. Topic has 3 replies.

Print Search « Previous Thread Next Thread »
  06-05-2008, 3:31
Andrew Polden is not online. Last active: 6/4/2008 1:20:33 PM Andrew Polden

Top 500 Posts
Joined on 06-08-2006
Posts 11
"Feature not supported", PdfCompressor.Write
Reply Quote
Hi.

I'm evaluating the LT15 PDF plugin for C# within a WPF application and I'm having trouble writing out a PDF document. I've read elsewhere that this can be due to missing assembly references, however I am sure I've included all that are relevant. Because I am adding JPG images to the PDF, I have referenced:
  • Leadtools.dll
  • Leadtools.Codecs.dll
  • Leadtools.Codecs.Cmp.dll
  • Leadtools.Codecs.Pdf.dll
  • Leadtools.Pdf.dll
My code is:
            RasterSupport.Unlock(RasterSupportType.PdfAdvanced, "");
            RasterSupport.Unlock(RasterSupportType.PdfRead, "");
            RasterSupport.Unlock(RasterSupportType.PdfSave, "");
            // Load an image

            RasterCodecs.Startup();
            RasterCodecs codecs = new RasterCodecs();
            codecs.ThrowExceptionsOnInvalidImages = true;

            PdfCompressor pdfCompressor = new PdfCompressor();
            PdfCompressorOptions pdfCompressorOptions = new PdfCompressorOptions();
            PdfCompressorCompressionTypes compressionTypes = new PdfCompressorCompressionTypes();

            //Sets compression types needed for each segment
            compressionTypes.Comp1Bit = PdfCompressor1BitCompression.Zip1Bit;
            compressionTypes.Comp2Bit = PdfCompressor2BitCompression.Lzw2Bit;
            compressionTypes.CompPicture = PdfCompressorPictureCompression.JpgPic;
            compressionTypes.QFactor = 2;

            //Flags for used compression types should be set
            compressionTypes.Flags = EnabledCompressionsFlags.EnableOneBit | EnabledCompressionsFlags.EnableTwoBit | EnabledCompressionsFlags.EnablePicture;

            pdfCompressor.SetCompression(compressionTypes);

            int pageNum = 1;
            DirectoryInfo dInfo = Directory.CreateDirectory(InfoProvider.OutputPath);
            FileInfo[] jpgFiles = dInfo.GetFiles(Path.GetFileNameWithoutExtension(InfoProvider.OutputFile) + "_*.jpg");

            foreach (FileInfo jpgFile in jpgFiles)
            {
                using (RasterImage image = codecs.Load(jpgFile.FullName))
                {
                    pdfCompressor.Insert(image);
                    //pdfCompressor.SegmentImage += new EventHandler<PdfCompressorSegmentImageEventArgs>(pdfCompressor_SegmentImage_PdfDocument);
                }

                jpgFile.Delete();
            }

            string filePath = InfoProvider.OutputPath + Path.GetFileNameWithoutExtension(InfoProvider.OutputFile) + ".pdf";
            pdfCompressor.Write(filePath);
            pdfCompressor.Dispose();

            RasterCodecs.Shutdown();


   Report 
  06-05-2008, 12:34
Adnan Ismail is not online. Last active: 9/4/2008 2:25:00 PM Adnan Ismail



Top 10 Posts
Joined on 07-31-2006
Posts 1,150
Re: "Feature not supported", PdfCompressor.Write
Reply Quote
You are correct that normally, 'Feature not supported' exceptions are generated when your application is missing some DLLs.
Please check 2 things:
1. If you run our pre-built C# Main demo shipped with the toolkit and open any image, can you save it as PDF using the File => Save menu?
2. If you use codecs.Save() instead of pdfCompressor.Write() to save the image as PDF, does it work?
Adnan Ismail
LEADTOOLS Technical Support

   Report 
  06-05-2008, 20:27
Andrew Polden is not online. Last active: 6/4/2008 1:20:33 PM Andrew Polden

Top 500 Posts
Joined on 06-08-2006
Posts 11
Re: "Feature not supported", PdfCompressor.Write
Reply Quote
Hi Adnan
  1. The CSPdfComp demo app works correctly, and I've looked at the code but I can't find anything I've missed - except that I have a WPF application and the demo is a WinForms app. This isn't likely to cause a problem is it?
  2. Codecs.Save also works correctly, however these is a huge difference in file size, even using RasterImageFormat.RasPdfJpeg.
Regards, Andrew


   Report 
  06-09-2008, 9:27
Adnan Ismail is not online. Last active: 9/4/2008 2:25:00 PM Adnan Ismail



Top 10 Posts
Joined on 07-31-2006
Posts 1,150
Re: "Feature not supported", PdfCompressor.Write
Reply Quote

Can you try to isolate the exception "Feature not supported" that you get in a small test project (not your full application) so I can reproduce this issue here. If you want to send the project, please put it in a ZIP or RAR file.

About file size, you can use RasPdfLzw format instead of RasPdfJpeg to reduce the file size.


Adnan Ismail
LEADTOOLS Technical Support

   Report 
Post
LEAD Support Fo... » Developer » DotNet » Re: "Feature not supported", PdfCompressor.Write

Powered by Community Server, by Telligent Systems