Esempio n. 1
0
        /// <summary>
        /// Convierte una imagen pdf a una multi tiff
        /// </summary>
        /// <param name="pdfPath">Ruta del archivo origen </param>
        /// <param name="tiffPath">Ruta del archivo destino con extencion tiff</param>
        public static int ConvertirimagenPDFaTIFF(string pdfPath, string tiffPath)
        {
            //modifica William Cicua; 05/05/2016; se crea parametro que activa u desactiva la
            // conversion a .tif
            GestorDocumentalEnt db = new GestorDocumentalEnt();

            SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
            f.Serial = "10160711675";   //Serial develop
            //f.Serial = "10160735830"; //Serial Server
            f.OpenPdf(pdfPath);
            if (f.PageCount > 0)
            {
                f.ImageOptions.Dpi = 200;
                var    algo       = f.PageCount;
                string tifactivo1 = db.Parametros.Where(c => c.codigo == "CONVERSION_A_TIFF_ACTIVO").First().valor;

                int tifactivo = Convert.ToInt32(tifactivo1);
                if (tifactivo == 1)
                {
                    if (f.ToMultipageTiff(tiffPath, System.Drawing.Imaging.EncoderValue.CompressionCCITT4) == 0)
                    {
                        //System.Diagnostics.Process.Start(tiffPath);
                    }
                }
            }
            return(f.PageCount);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            // Activation of PDF Focus .Net after purchasing
            SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();

            // Place your serial number here.
            // You will get an own serial number after purchasing the license.
            // If have any questions, email us to [email protected] or ask at online chat http://www.sautinsoft.com.
            f.Serial = "1234567890";

            string pdfPath  = @"..\..\..\..\simple text.pdf";
            string tiffPath = Path.ChangeExtension(pdfPath, ".tiff");

            // Open PDF
            f.OpenPdf(pdfPath);

            if (f.PageCount > 0)
            {
                // 0 - converting successfully
                // 2 - can't create output file, check the output path
                // 3 - converting failed
                f.ImageOptions.Dpi = 120;
                if (f.ToMultipageTiff(tiffPath) == 0)
                {
                    System.Diagnostics.Process.Start(tiffPath);
                }
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            // Convert PDF file to BlackAndWhite Multipage-TIFF.
            SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();

            // This property is necessary only for registered version.
            //f.Serial = "XXXXXXXXXXX";

            string pdfPath  = @"..\..\simple text.pdf";
            string tiffPath = "Result.tiff";

            f.OpenPdf(pdfPath);

            if (f.PageCount > 0)
            {
                f.ImageOptions.Dpi        = 200;
                f.ImageOptions.ColorDepth = SautinSoft.PdfFocus.CImageOptions.eColorDepth.BlackWhite1bpp;
                // EncoderValue.CompressionCCITT4 - also makes image black&white 1 bit
                if (f.ToMultipageTiff(tiffPath, EncoderValue.CompressionCCITT4) == 0)
                {
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(tiffPath)
                    {
                        UseShellExecute = true
                    });
                }
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            //Convert PDF file to Multipage TIFF file
            SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
            //this property is necessary only for registered version
            //f.Serial = "XXXXXXXXXXX";

            string pdfPath  = @"..\..\..\..\..\simple text.pdf";
            string tiffPath = Path.ChangeExtension(pdfPath, ".tiff");

            f.OpenPdf(pdfPath);

            if (f.PageCount > 0)
            {
                f.ImageOptions.Dpi = 120;
                if (f.ToMultipageTiff(tiffPath) == 0)
                {
                    System.Diagnostics.Process.Start(tiffPath);
                }
            }
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            //Convert PDF file to Multipage TIFF file
            SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
            //this property is necessary only for registered version
            //f.Serial = "XXXXXXXXXXX";

            string pdfPath  = @"..\..\simple text.pdf";
            string tiffPath = "Result.tiff";

            f.OpenPdf(pdfPath);

            if (f.PageCount > 0)
            {
                f.ImageOptions.Dpi = 200;
                if (f.ToMultipageTiff(tiffPath) == 0)
                {
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(tiffPath)
                    {
                        UseShellExecute = true
                    });
                }
            }
        }
Esempio n. 6
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.PostedFile.FileName.Length == 0 || FileUpload1.FileBytes.Length == 0)
        {
            Result.Text = "Please select PDF file at first!";
            return;
        }
        Result.Text = "Converting ...";

        SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
        //this property is necessary only for registered version
        //f.Serial = "XXXXXXXXXXX";
        f.OpenPdf(FileUpload1.FileBytes);

        if (f.PageCount > 0)
        {
            //Set dpi for TIFF image
            f.ImageOptions.Dpi = 120;

            //Let's whole PDF into multipage-TIFF
            byte[] tiff = f.ToMultipageTiff();

            //show image
            Response.Buffer = true;
            Response.Clear();
            Response.ContentType = "image/tiff";
            Response.AddHeader("Content-Disposition:", "attachment; filename=Result.tiff");
            Response.BinaryWrite(tiff);
            Response.Flush();
            Response.End();
        }
        else
        {
            Result.Text = "Converting failed!";
        }
    }