Click or drag to resize

PdfMetamorphosisPdfSetting Class

Set properties for resulting PDF document, such as PDF version, compression etc.
Inheritance Hierarchy
SystemObject
  SautinSoftPdfMetamorphosisPdfSetting

Namespace: SautinSoft
Assembly: PdfMetamorphosis (in PdfMetamorphosis.dll) Version: 2024.1.12
Syntax
public class PdfSetting

The PdfMetamorphosisPdfSetting type exposes the following members.

Properties
 NameDescription
Public propertyClipboardTextProtection Gets and sets the protection on copying of all text from PDF document through clipboard. Default value: false.
Public propertyCompression Allows to set compression type to change size of the PDF document. Default value: true.
Public propertyCode exampleEmbedAllFonts Embed all used fonts inside the PDF document. Default value: false.
Public propertyCode exampleFontsDirectory Full local path to fonts directory (any folder with *.ttf files). Default value: Fonts directory of the current OS.
Public propertyJpegQuality Specify the image quality from 1 ... 100. Allows to reduce the size of PDF document due to loss of quality of embedded images. Default value: 90.
Public propertyPdfProducer Set producer in an output document.
Public propertyPdfSecurity Sets the password in the resulting file.
Public propertyCode examplePdfVersion Set version for produced PDF document. Default value: PDF_14.
Top
Methods
 NameDescription
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Top
Example
How to set PDF version in C#
using System.IO;

namespace Sample
{
    class Test
    {

        static void Main(string[] args)
        {
            // Activate your license here
            // SautinSoft.PdfMetamorphosis.SetLicense("1234567890");

            // How to set a version for the PDF document.
            SautinSoft.PdfMetamorphosis p = new SautinSoft.PdfMetamorphosis();


            // PDF Metamorphosis .Net generates PDF 1.4 document by default.
            // Let's change the PDF version to PDF_A.
            p.PdfSettings.PdfVersion = SautinSoft.PdfMetamorphosis.PdfSetting.PdfVersions.PDF_A1a;

            if (p != null)
            {
                string rtfPath = @"..\..\..\example.rtf";
                string pdfPath = Path.ChangeExtension(rtfPath, ".pdf");

                int i = p.RtfToPdfConvertFile(rtfPath, pdfPath);

                if (i != 0)
                {
                    System.Console.WriteLine("An error occurred during converting RTF to PDF!");
                }
                else
                {
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(pdfPath) { UseShellExecute = true });
                }
            }
        }
    }
}
How to set PDF version in VB.Net
Namespace Sample
    Friend Class Test
        Shared Sub Main(ByVal args() As String)

            ' How to set a version for the PDF document.
                ' Activate your license here
                ' SautinSoft.PdfMetamorphosis.SetLicense("1234567890")

            Dim p As New SautinSoft.PdfMetamorphosis()

            ' PDF Metamorphosis .Net generates PDF 1.4 document by default.
            ' Let's change the PDF version to PDF_A.
            p.PdfSettings.PdfVersion = SautinSoft.PdfMetamorphosis.PdfSetting.PdfVersions.PDF_A1a

            If p IsNot Nothing Then
                Dim rtfPath As String = "..\..\..\example.rtf"
                Dim pdfPath As String = "..\..\..\test.pdf"

                Dim i As Integer = p.RtfToPdfConvertFile(rtfPath, pdfPath)

                If i <> 0 Then
                    System.Console.WriteLine("An error occurred during converting RTF to PDF!")
                Else
                    System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(pdfPath) With {.UseShellExecute = True})
                End If
            End If
        End Sub
    End Class
End Namespace
See Also