Allows to specify jpeg compression ratio and reduce PDF document size

Namespace:  SautinSoft
Assembly:  SautinSoft.PdfVision (in SautinSoft.PdfVision.dll) Version: 5.1.2.13

Syntax

      
 C#  Visual Basic 
public int JPEGQuality { get; set; }
Public Property JPEGQuality As Integer

Remarks

Typically the only thing that the user can control in Jpeg compression is the quality setting. The value chosen is used in quantisation stage above, where less common values are discarded by using tables tuned to visual perception. This reduces the amount of information while preserving the perceived quality.

Examples

CopyHow to convert JPG file to PDF file in C#
using System;
using System.IO;

namespace Sample
{
    class Test
    {

        static void Main(string[] args)
        {

            // Convert JPG file to PDF file             
            SautinSoft.PdfVision v = new SautinSoft.PdfVision();
            //v.Serial = "XXXXXXXXXXXXXXX";

            //specify converting options
            v.PageStyle.PageSize.Auto();
            //v.PageStyle.PageMarginLeft.Inch(1);
            //v.ImageStyle.Heightmm(150);
            //v.ImageStyle.WidthInch(10);

            v.ImageStyle.JPEGQuality=90;

            string jpgFile = Path.GetFullPath(@"..\..\..\..\..\Testing Files\image1.jpg");
            string pdfFile = Path.ChangeExtension(jpgFile,".pdf");

            //Convert image file to pdf file
            int ret = v.ConvertImageFileToPDFFile(jpgFile, pdfFile);

            // 0 - converting successfully
            // 1 - can't open input file, check the input path
            // 2 - can't create output file, check the output path
            // 3 - converting failed
            if(ret==0 )
            {
                // Open produced PDF in default PDF Reader.
                System.Diagnostics.Process.Start(pdfFile);
            }
        }
    }
}
CopyHow to convert JPG file to PDF file in VB.Net
Imports System.IO

Namespace Sample
    Friend Class Test

        Shared Sub Main(ByVal args() As String)
            ' Convert JPG file to PDF file             
            Dim v As New SautinSoft.PdfVision()
            'v.Serial = "XXXXXXXXXXXXXXX";


            'specify converting options
            v.PageStyle.PageSize.Auto()
            'v.PageStyle.PageMarginLeft.Inch(1);
            'v.ImageStyle.Heightmm(150);
            'v.ImageStyle.WidthInch(10);


            v.ImageStyle.JPEGQuality = 90

            Dim jpgFile As String = Path.GetFullPath("..\..\..\..\..\Testing Files\image1.jpg")
            Dim pdfFile As String = Path.ChangeExtension(jpgFile, ".pdf")

            'Convert image file to pdf file
            Dim ret As Integer = v.ConvertImageFileToPDFFile(jpgFile, pdfFile)

            ' 0 - converting successfully
            ' 1 - can't open input file, check the input path
            ' 2 - can't create output file, check the output path
            ' 3 - converting failed
            If ret = 0 Then
                ' Open produced PDF in default PDF Reader.
                System.Diagnostics.Process.Start(pdfFile)
            End If
        End Sub
    End Class
End Namespace

See Also