CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Feb 2022
    Posts
    44

    converting TIFF to PDF & JPG to PDF

    Hi,

    Our company is currently evaluating the product whether it will cater to our needs.

    Our requirements are as follows:
    1) Convert TIFF file to PDF using JBIG2 Compression
    2) Convert JPG file to PDF using JPEG2000 Compression

    When I tried, I get an error message stating that the compression best pdf merger(Jpeg2000 and Jbig2) is not supported now.

    Basing on the documentation provided, below is the code for converting TIFF to PDF (using JBIG2):
    ImageCollection imageCollection = new ImageCollection();
    imageCollection.Add(tiffFileName);

    PdfEncoder pdfEncoder = new PdfEncoder(true);
    pdfEncoder.Settings.Compression = PdfImageCompression.Jbig2;
    pdfEncoder.Settings.Jbig2Settings.Lossy = false;
    imageCollection.SaveSync(pdfFileName, pdfEncoder);

    pdfEncoder.Dispose();
    imageCollection.Dispose();

    Below is the code for converting JPG to PDF (using JPEG2000):
    ImageCollection imageCollection = new ImageCollection();
    imageCollection.Add(jpgFileName);

    PdfEncoder pdfEncoder = new PdfEncoder(true);
    pdfEncoder.Settings.Compression = PdfImageCompression.Jpeg2000;
    pdfEncoder.Settings.Jpeg2000Settings.CompressionType = Vintasoft.Imaging.Codecs.Jpeg2000.Jpeg2000CompressionType.Lossy;
    imageCollection.SaveSync(pdfFileName, pdfEncoder);

    pdfEncoder.Dispose();
    imageCollection.Dispose();

    Is there something I should be doing to make this work or is this feature only supported in future versions? Please note that I'm currently using version 7.0.1.1.

    Please advise asap.

    Thanks.
    Last edited by existenceproduct; July 16th, 2022 at 03:48 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured