コード例 #1
0
        /// <summary>
        /// Converts <see cref="PdfCompression"/> enum to <see cref="PdfImageCompression"/> enum.
        /// </summary>
        private PdfImageCompression ConvertToPdfImageCompression(PdfCompression compression)
        {
            switch (compression)
            {
            case PdfCompression.CcittFax:
                return(PdfImageCompression.CcittFax);

            case PdfCompression.Jbig2:
                return(PdfImageCompression.Jbig2);

            case PdfCompression.Jpeg:
                return(PdfImageCompression.Jpeg);

            case PdfCompression.Jpeg2000:
                return(PdfImageCompression.Jpeg2000);

            case PdfCompression.Lzw:
                return(PdfImageCompression.Lzw);

            case PdfCompression.None:
                return(PdfImageCompression.None);

            case PdfCompression.Zip:
                return(PdfImageCompression.Zip);

            case PdfCompression.Zip | PdfCompression.Jpeg:
                return(PdfImageCompression.Zip | PdfImageCompression.Jpeg);
            }
            return(PdfImageCompression.Auto);
        }
コード例 #2
0
        /// <summary>
        /// Handles the CheckedChanged event of CompressionRadioButton object.
        /// </summary>
        private void compressionRadioButton_CheckedChanged(object sender, EventArgs e)
        {
#if !REMOVE_PDF_PLUGIN
            // if 'Auto' compression must be used
            if (compressionAutoRadioButton.Checked)
            {
                _compression = PdfCompression.Auto;
            }
            // if 'CcittFax' compression must be used
            else if (compressionCcittRadioButton.Checked)
            {
                _compression = PdfCompression.CcittFax;
            }
            // if 'JBIG2' compression must be used
            else if (compressionJbig2RadioButton.Checked)
            {
                _compression = PdfCompression.Jbig2;
            }
            // if 'JPEG2000' compression must be used
            else if (compressionJpeg2000RadioButton.Checked)
            {
                _compression = PdfCompression.Jpeg2000;
            }
            // if 'Jpeg' compression must be used
            else if (compressionJpegRadioButton.Checked)
            {
                _compression = PdfCompression.Jpeg;
            }
            // if 'Lzw' compression must be used
            else if (compressionLzwRadioButton.Checked)
            {
                _compression = PdfCompression.Lzw;
            }
            // if compression should not be used
            else if (compressionNoneRadioButton.Checked)
            {
                _compression = PdfCompression.None;
            }
            // if 'Zip' compression must be used
            else if (compressionZipRadioButton.Checked)
            {
                _compression = PdfCompression.Zip;
            }
            // if 'Jpeg' and 'Zip' compression must be used
            else if (compressionJpegZipRadioButton.Checked)
            {
                _compression = PdfCompression.Jpeg | PdfCompression.Zip;
            }
#endif
            UpdateUI();
        }
コード例 #3
0
 public PdfFile(PdfCompression compression, Func <byte[], byte[]> compressor)
 {
     _compression = compression;
     _compressor  = compressor;
 }
コード例 #4
0
 public PdfFile()
 {
     (PdfDocument = new PdfDocument()).Initialize(this, 0, 65535);
     Add(PdfCatalog = new PdfCatalog());
     _compression   = PdfCompression.None;
 }