Converting TIFF to PDF in Aspose.Words

I want to know if any Aspose API would convert multi-page TIFF image to multi-page PDF file?
I am using .NET.
Would you please forward this to the right person?
Thank you


This Topic is created by adam.skelton1 using the Email to Topic plugin.

Hi, Should this be Aspose.pdf instead of Aspose.Words?
Thanks

@NguyenQ1,

Thanks for your inquiry. You can just use Aspose.Words for .NET API to convert a TIFF image to PDF. Please refer to the following article:

Convert an Image to PDF

Best regards,
Awais Hafeez

We have Aspose.PDF_17.7 license and want to use that. However I don’t find Aspose.Pdf.Generator in this version anymore. I still see it in version _11.7. Does that mean it can only be done in Aspose.Word for _17.7 version?
My old sample source codes Aspose.PDF_11.7 is like this:

            FileStream fs = new FileStream(myFile, FileMode.Open, FileAccess.Read);
            byte[] tmpBytes = new byte[fs.Length];
            fs.Read(tmpBytes, 0, Convert.ToInt32(fs.Length));

            MemoryStream mystream = new MemoryStream(tmpBytes);
            Bitmap b = new Bitmap(mystream);
            // Create a new section in the Pdf document
            Aspose.Pdf.Generator.Section sec1 = new Aspose.Pdf.Generator.Section(pdf1);

            // Set margins so image will fit, etc.
            sec1.PageInfo.Margin.Top = 5;
            sec1.PageInfo.Margin.Bottom = 5;
            sec1.PageInfo.Margin.Left = 5;
            sec1.PageInfo.Margin.Right = 5;

            sec1.PageInfo.PageWidth = (b.Width / b.HorizontalResolution) * 72;
            sec1.PageInfo.PageHeight = (b.Height / b.VerticalResolution) * 72;

            // Add the section in the sections collection of the Pdf document
            pdf1.Sections.Add(sec1);

            // Create an image object
            Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);

            // Add the image into paragraphs collection of the section
            sec1.Paragraphs.Add(image1);
            image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Tiff;

            // Set IsBlackWhite property to true for performance improvement
            image1.ImageInfo.IsBlackWhite = true;
            // Set the ImageStream to a MemoryStream object
            image1.ImageInfo.ImageStream = mystream;
            // Set desired image scale
            image1.ImageScale = 0.95F;

@NguyenQ1,

Thanks for contacting support.

The legacy Aspose.Pdf.Generator is obsolete and we recommend using new DOM model to generate and manipulate existing PDF files. I am working on migrating the code to new DOM and will update you accordingly. We are sorry for this inconvenience.

Thank you for the clarification. I am trying to use Aspose.Word.Document and can convert some TIFF to PDF. However when I try to use large TIFF image of around more than 1200 pages (file size about 100MB), it can’t produce a good PDF (size 0MB) and I can’t open it. Is this a known issue? Is there any log to see what went wrong?

Thank you.

@NguyenQ1,

Please ZIP (make multi-part archive) your problematic TIFF file and attach here for testing. You may also upload TIFF file on Dropbox or any other file hosting service and share here the download link. We will investigate the issue on our end and provide you more information.