Dim caption As String = "Example: SetPageLabelsRangeNumPortion"
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
Dim rangesCount As Integer = gdpicturePDF.GetPageLabelsRangeCount()
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If rangesCount > 0 Then
Dim message As String = ""
Dim startPage As Integer = 0, num As Integer = 0
Dim style As PdfPageLabelStyle = PdfPageLabelStyle.PdfPageLabelStyleUndefined
Dim prefix As String = ""
status = gdpicturePDF.GetPageLabelsRange(0, startPage, style, prefix, num)
If status = GdPictureStatus.OK Then
message = message + "The previously defined attributes for the first labeling range are:" + vbCrLf + "style = " + style.ToString() + vbCrLf + "prefix = """ + prefix.ToString() + """" + vbCrLf + "num.portion = " + num.ToString() + vbCrLf
Else
message = message + "The GetPageLabelsRange() method has failed with the status: " + status.ToString() + vbCrLf
End If
status = gdpicturePDF.SetPageLabelsRangeNumPortion(0, 5)
If status <> GdPictureStatus.OK Then
message = message + "The SetPageLabelsRangeNumPortion() method has failed with the status: " + status.ToString() + vbCrLf
End If
status = gdpicturePDF.SetPageLabelsRangePrefix(0, "Prefix:")
If status <> GdPictureStatus.OK Then
message = message + "The SetPageLabelsRangePrefix() method has failed with the status: " + status.ToString() + vbCrLf
End If
status = gdpicturePDF.SetPageLabelsRangeStyle(0, PdfPageLabelStyle.PdfPageLabelStyleLowercaseRomanNumerals)
If status <> GdPictureStatus.OK Then
message = message + "The SetPageLabelsRangeStyle() method has failed with the status: " + status.ToString() + vbCrLf
End If
status = gdpicturePDF.GetPageLabelsRange(0, startPage, style, prefix, num)
If status = GdPictureStatus.OK Then
message = message + "The newly defined attributes for the first labeling range are:" + vbCrLf + "style = " + style.ToString() + vbCrLf + "prefix = """ + prefix.ToString() + """" + vbCrLf + "num.portion = " + num.ToString() + vbCrLf
Else
message = message + "The GetPageLabelsRange() method has failed with the status: " + status.ToString() + vbCrLf
End If
If gdpicturePDF.SaveToFile("test_SetPageLabelsRangeAttributes.pdf") = GdPictureStatus.OK Then
MessageBox.Show("The file has been saved successfully.", caption)
Else
MessageBox.Show("The file can't be saved.", caption)
End If
MessageBox.Show(message, caption)
Else
MessageBox.Show("No page labeling ranges are defined in this PDF document.", caption)
End If
Else
MessageBox.Show("The GetPageLabelsRangeCount() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: SetPageLabelsRangeNumPortion";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
int rangesCount = gdpicturePDF.GetPageLabelsRangeCount();
GdPictureStatus status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (rangesCount > 0)
{
string message = "";
int startPage = 0, num = 0;
PdfPageLabelStyle style = PdfPageLabelStyle.PdfPageLabelStyleUndefined;
string prefix = "";
status = gdpicturePDF.GetPageLabelsRange(0, ref startPage, ref style, ref prefix, ref num);
if (status == GdPictureStatus.OK)
{
message = message + "The previously defined attributes for the first labeling range are:\n" +
"style = " + style.ToString() + "\nprefix = \"" + prefix.ToString() + "\"\nnum.portion = " + num.ToString() + "\n";
}
else
message = message + "The GetPageLabelsRange() method has failed with the status: " + status.ToString() + "\n";
status = gdpicturePDF.SetPageLabelsRangeNumPortion(0, 5);
if (status != GdPictureStatus.OK)
message = message + "The SetPageLabelsRangeNumPortion() method has failed with the status: " + status.ToString() + "\n";
status = gdpicturePDF.SetPageLabelsRangePrefix(0, "Prefix:");
if (status != GdPictureStatus.OK)
message = message + "The SetPageLabelsRangePrefix() method has failed with the status: " + status.ToString() + "\n";
status = gdpicturePDF.SetPageLabelsRangeStyle(0, PdfPageLabelStyle.PdfPageLabelStyleLowercaseRomanNumerals);
if (status != GdPictureStatus.OK)
message = message + "The SetPageLabelsRangeStyle() method has failed with the status: " + status.ToString() + "\n";
status = gdpicturePDF.GetPageLabelsRange(0, ref startPage, ref style, ref prefix, ref num);
if (status == GdPictureStatus.OK)
{
message = message + "The newly defined attributes for the first labeling range are:\n" +
"style = " + style.ToString() + "\nprefix = \"" + prefix.ToString() + "\"\nnum.portion = " + num.ToString() + "\n";
}
else
message = message + "The GetPageLabelsRange() method has failed with the status: " + status.ToString() + "\n";
if (gdpicturePDF.SaveToFile("test_SetPageLabelsRangeAttributes.pdf") == GdPictureStatus.OK)
MessageBox.Show("The file has been saved successfully.", caption);
else
MessageBox.Show("The file can't be saved.", caption);
MessageBox.Show(message, caption);
}
else
MessageBox.Show("No page labeling ranges are defined in this PDF document.", caption);
}
else
MessageBox.Show("The GetPageLabelsRangeCount() method has failed with the status: " + status.ToString(), caption);
}
else
MessageBox.Show("The file can't be loaded.", caption);
gdpicturePDF.Dispose();