VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.Pdf.Processing Namespace / PdfDocumentCompressorCommand Class / FlattenAnnotations Property
Syntax Example Requirements SeeAlso
In This Topic
FlattenAnnotations Property (PdfDocumentCompressorCommand)
In This Topic
Gets or sets a value indicating whether the command must flatten (burn) annotations.
Syntax
'Declaration

<DefaultValueAttribute(False)>
<CategoryAttribute("Discard")>
<DescriptionAttribute("A value indicating whether the command must flatten annotations.")>
Public Property FlattenAnnotations As Boolean

[DefaultValue(False)]
[Category("Discard")]
[Description("A value indicating whether the command must flatten annotations.")]
public bool FlattenAnnotations { get; set; }

Property Value

True - command must flatten annotations; false - command must NOT flatten annotations.
Default value is false.
Example

Here is an example that shows how to flatten annotations and remove interactive form of the PDF document:


''' <summary>
''' Flatten an annotations and remove intractive form of the PDF document.
''' </summary>
''' <param name="inPdfFilename">The input PDF filename.</param>
''' <param name="outPdfFilename">The output PDF filename.</param>
Public Shared Sub FlattenAnnotations(inPdfFilename As String, outPdfFilename As String)
    ' create compressor with empty compression settings
    Dim compressor As Vintasoft.Imaging.Pdf.Processing.PdfDocumentCompressorCommand = Vintasoft.Imaging.Pdf.Processing.PdfDocumentCompressorCommand.CreateEmptyCompressor()

    ' specify that compressor must remove interactive form from PDF document
    compressor.RemoveInteractiveForm = True
    ' specify that compressor must flatten annotations in PDF document
    compressor.FlattenAnnotations = True

    ' compress PDF document
    compressor.Compress(inPdfFilename, outPdfFilename)
End Sub


/// <summary>
/// Flatten an annotations and remove intractive form of the PDF document.
/// </summary>
/// <param name="inPdfFilename">The input PDF filename.</param>
/// <param name="outPdfFilename">The output PDF filename.</param>
public static void FlattenAnnotations(string inPdfFilename, string outPdfFilename)
{
    // create compressor with empty compression settings
    Vintasoft.Imaging.Pdf.Processing.PdfDocumentCompressorCommand compressor =
       Vintasoft.Imaging.Pdf.Processing.PdfDocumentCompressorCommand.CreateEmptyCompressor();

    // specify that compressor must remove interactive form from PDF document
    compressor.RemoveInteractiveForm = true;
    // specify that compressor must flatten annotations in PDF document
    compressor.FlattenAnnotations = true;

    // compress PDF document
    compressor.Compress(inPdfFilename, outPdfFilename);
}

Requirements

Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also