Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / IsLinearized Method

IsLinearized Method (GdPicturePDF)

In This Topic
Checks whether the currently loaded PDF document is a valid linearized PDF file.
Syntax
'Declaration

 

Public Function IsLinearized() As Boolean
public bool IsLinearized()
public function IsLinearized(): Boolean; 
public function IsLinearized() : boolean;
public: bool IsLinearized(); 
public:

bool IsLinearized(); 

Return Value

true if the current PDF is linearized, otherwise false. The GdPicturePDF.GetStat method can be subsequently used to determine if this method has been successful.
Remarks
It is recommend to use the GdPicturePDF.GetStat method to identify the specific reason for the method's failure, if any.

A Linearized PDF file is a file that has been organized in a special way to enable efficient incremental access in a network environment. Enhanced viewer applications can recognize that a PDF file has been linearized and can take advantage of that organization (as well as added hint information) to enhance viewing performance (see PDF Reference, Section "Linearized PDF").

Example
How to determine if the PDF document is a valid linearized PDF file.
Dim gdpicturePDF As New GdPicturePDF()

Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)

If status = GdPictureStatus.OK Then

    Dim isLinearized As Boolean = gdpicturePDF.IsLinearized()

    status = gdpicturePDF.GetStat()

    If status = GdPictureStatus.OK Then

        If isLinearized Then

            MessageBox.Show("Your PDF document is linearized.", "Example: IsLinearized")

        Else

            MessageBox.Show("Your PDF document is not linearized.", "Example: IsLinearized")

        End If

    Else

        MessageBox.Show("The IsLinearized() method has failed with the status: " + status.ToString(), "Example: IsLinearized")

    End If

Else

    MessageBox.Show("The file can't be loaded.", "Example: IsLinearized")

End If

gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();

GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);

if (status == GdPictureStatus.OK)

{

    bool isLinearized = gdpicturePDF.IsLinearized();

    status = gdpicturePDF.GetStat();

    if (status == GdPictureStatus.OK)

    {

        if (isLinearized)

        {

            MessageBox.Show("Your PDF document is linearized.", "Example: IsLinearized");

        }

        else

        {

            MessageBox.Show("Your PDF document is not linearized.", "Example: IsLinearized");

        }

    }

    else

    {

        MessageBox.Show("The IsLinearized() method has failed with the status: " + status.ToString(), "Example: IsLinearized");

    }

}

else

{

    MessageBox.Show("The file can't be loaded.", "Example: IsLinearized");

}

gdpicturePDF.Dispose();
See Also