Dim caption As String = "Example: AddPageLabelsRange"
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
Dim count As Integer = gdpicturePDF.GetPageCount()
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
If status <> GdPictureStatus.OK Then
MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), caption)
GoTo [error]
End If
If count = 0 Then
MessageBox.Show("This PDF document contains no pages.", caption)
GoTo [error]
End If
'Removing current labeling ranges, if any are defined.
status = gdpicturePDF.DeletePageLabels()
If status <> GdPictureStatus.OK Then
MessageBox.Show("The DeletePageLabels() method has failed with the status: " + status.ToString(), caption)
Goto [Error]
End If
status = gdpicturePDF.AddPageLabelsRange(1, PdfPageLabelStyle.PdfPageLabelStyleUppercaseRomanNumerals, "A-", 10)
If status = GdPictureStatus.OK Then
If gdpicturePDF.SaveToFile("test_AddPageLabelsRange.pdf") = GdPictureStatus.OK Then
MessageBox.Show("The pages have been labeled successfully and the file has been saved.", caption)
Else
MessageBox.Show("The pages have been labeled successfully, but the file can't be saved.", caption)
End If
Else
MessageBox.Show("The AddPageLabelsRange() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
[error]:
gdpicturePDF.Dispose()
string caption = "Example: AddPageLabelsRange";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
int count = gdpicturePDF.GetPageCount();
GdPictureStatus status = gdpicturePDF.GetStat();
if (status != GdPictureStatus.OK)
{
MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), caption);
goto error;
}
if (count == 0)
{
MessageBox.Show("This PDF document contains no pages.", caption);
goto error;
}
//Removing current labeling ranges, if any are defined.
status = gdpicturePDF.DeletePageLabels();
if (status != GdPictureStatus.OK)
{
MessageBox.Show("The DeletePageLabels() method has failed with the status: " + status.ToString(), caption);
goto error;
}
status = gdpicturePDF.AddPageLabelsRange(1, PdfPageLabelStyle.PdfPageLabelStyleUppercaseRomanNumerals, "A-", 10);
if (status == GdPictureStatus.OK)
{
if (gdpicturePDF.SaveToFile("test_AddPageLabelsRange.pdf") == GdPictureStatus.OK)
MessageBox.Show("The pages have been labeled successfully and the file has been saved.", caption);
else
MessageBox.Show("The pages have been labeled successfully, but the file can't be saved.", caption);
}
else
MessageBox.Show("The AddPageLabelsRange() method has failed with the status: " + status.ToString(), caption);
}
else
MessageBox.Show("The file can't be loaded.", caption);
error:
gdpicturePDF.Dispose();