Example #1
0
 private static void test2()
 {
     // load the PDF in PdfConverter
     using (var converter = new Aspose.Pdf.Facades.PdfConverter())
     {
         converter.BindPdf("template.pdf");
         // initiate conversion
         converter.DoConvert();
         // create TiffSettings & set compression type
         var settings = new Aspose.Pdf.Devices.TiffSettings()
         {
             Compression = Aspose.Pdf.Devices.CompressionType.None,
         };
         // save PDF as TIFF
         converter.SaveAsTIFF("output.tiff", settings);
     }
 }
Example #2
0
        private static string SaveAsTiff(string inputFile, string outputFolder)
        {
            try
            {
                if (!File.Exists(inputFile))
                {
                    throw new FileNotFoundException($"Die Datei {inputFile} konnte nicht gefunden werden");
                }

                //create
                var pdfConverter = new Aspose.Pdf.Facades.PdfConverter();
                // create Resolution object with 300 as an argument
                var resolution = new Resolution(240);
                // specify the resolution value for PdfConverter object - default is 150
                pdfConverter.Resolution = resolution;
                // bind the source PDF file
                pdfConverter.BindPdf(inputFile);
                // start the conversion process
                pdfConverter.DoConvert();
                //create TiffSettings object, set Compression and ColorDepth
                var tiffSettings = new TiffSettings {
                    Compression = CompressionType.None
                };

                var guid     = Guid.NewGuid().ToString();
                var filepath = Path.Combine(outputFolder, $"{Path.GetFileNameWithoutExtension(guid)}.tiff");

                pdfConverter.SaveAsTIFF(filepath, tiffSettings);
                pdfConverter.Close();
                return(filepath);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }