GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureDocumentConverter Class / LoadOnlyFirstPage Property
Example





In This Topic
LoadOnlyFirstPage Property (GdPictureDocumentConverter)
In This Topic
Specifies that all executed actions with the loaded document will be processed using only the first page of the document.
Syntax
'Declaration
 
Public Property LoadOnlyFirstPage As Boolean
public bool LoadOnlyFirstPage {get; set;}
public read-write property LoadOnlyFirstPage: Boolean; 
public function get,set LoadOnlyFirstPage : boolean
public: __property bool get_LoadOnlyFirstPage();
public: __property void set_LoadOnlyFirstPage( 
   bool value
);
public:
property bool LoadOnlyFirstPage {
   bool get();
   void set (    bool value);
}

Property Value

The default value is false.
Example
Loading and converting only the first page of the source document.
Using gdpictureDocumentConverter As New GdPictureDocumentConverter()
    gdpictureDocumentConverter.LoadOnlyFirstPage = True
    'Please try to use also a multi-page document.
    Dim status As GdPictureStatus = gdpictureDocumentConverter.LoadFromFile("test_doc.docx", GdPicture14.DocumentFormat.DocumentFormatDOCX)
    If status = GdPictureStatus.OK Then
        MessageBox.Show("The file has been loaded successfully.", "GdPicture")
        gdpictureDocumentConverter.DropGdPictureAnnotations = True
        status = gdpictureDocumentConverter.SaveAsPDF("first_page_dropped_annots.pdf", PdfConformance.PDF)
        If status = GdPictureStatus.OK Then
            MessageBox.Show("The file has been saved successfully.", "GdPicture")
        Else
            MessageBox.Show("The file has failed to save. Status: " + status.ToString(), "GdPicture")
        End If
    Else
        MessageBox.Show("The file has failed to load. Status: " + status.ToString(), "GdPicture")
    End If
End Using
using (GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter())
{
    gdpictureDocumentConverter.LoadOnlyFirstPage = true;
    //Please try to use also a multi-page document.
    GdPictureStatus status = gdpictureDocumentConverter.LoadFromFile("test_doc.docx", GdPicture14.DocumentFormat.DocumentFormatDOCX);
    if (status == GdPictureStatus.OK)
    {
        MessageBox.Show("The file has been loaded successfully.", "GdPicture");
        gdpictureDocumentConverter.DropGdPictureAnnotations = true;
        status = gdpictureDocumentConverter.SaveAsPDF("first_page_dropped_annots.pdf", PdfConformance.PDF);
        if (status == GdPictureStatus.OK)
        {
            MessageBox.Show("The file has been saved successfully.", "GdPicture");
        }
        else
        {
            MessageBox.Show("The file has failed to save. Status: " + status.ToString(), "GdPicture");
        }
    }
    else
    {
        MessageBox.Show("The file has failed to load. Status: " + status.ToString(), "GdPicture");
    }
}
See Also