Quantcast
Viewing all articles
Browse latest Browse all 3131

Aspose.Pdf converting pdf to tiff

Hello,

   We just bought a license to Aspose.Totals and we are trying to convert a pdf file to tiff.  The problem is some of the pages is not being converted to tiff.  As an example I attached the result tiff file and the source pdf file.  Below is the function we use to do the conversion.

//----------------------------------------------------------------------------------
        private static bool PdfToTiff(string SourceFileName, string DestinationFileName)
        {
            bool ReturnResult = true;
            TiffSettings tiffSettings;
            PdfConverter pdfConverter;
            string WorkDestinationFileName = Path.GetDirectoryName(DestinationFileName) +
                                             @"\con_" + Path.GetFileName(DestinationFileName);
            try
            {
                pdfConverter = new PdfConverter();
                pdfConverter.Resolution = 300;
                pdfConverter.BindPdf(SourceFileName);
                pdfConverter.DoConvert();
                // create TiffSettings object and set ColorDepth
                tiffSettings = new TiffSettings();
                tiffSettings.Depth = ColorDepth.Default;
                tiffSettings.Compression = CompressionType.CCITT4;
                // convert to TIFF image
                pdfConverter.SaveAsTIFF(WorkDestinationFileName, 300, 300, tiffSettings);
                pdfConverter.Close();
            }
            catch (Exception e)
            {
                ReturnResult = false;
                WriteToEventLog(EventLogEntryType.Error,
                                           "{0}\nException occurred during conversion \nFile:{1} \nType:                                                             {2}\nMessage:\n{3}",
                                            @"(PdfToTiff)", SourceFileName, e.GetType().FullName, e.Message);
            }
            finally
            {                
                pdfConverter = null;
                tiffSettings = null;
                if (File.Exists(WorkDestinationFileName)) File.Move(WorkDestinationFileName,                                   DestinationFileName);
            }
    
            return ReturnResult;
        }

this is very urgent so any help would be greatly appreciated.  Thank you !


Viewing all articles
Browse latest Browse all 3131

Trending Articles