Dim caption As String = "Example: GetTextHeight"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
Dim fontName As String = gdpicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontTimesRoman)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
Dim message As String = ""
Dim height As Single = gdpicturePDF.GetTextHeight(fontName, 20, True)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
message = message + "The height of the Times-Roman font with the size 20, with respect to the font boundary box, is " + height.ToString() + " centimeters."
Else
message = message + "The GetTextHeight() method has failed with the status: " + status.ToString()
End If
height = gdpicturePDF.GetTextHeight(fontName, 20, False)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
message = message + vbCrLf + "The height of the Times-Roman font with the size 20, without respecting the font boundary box, is " + height.ToString() + " centimeters."
Else
message = message + vbCrLf + "The GetTextHeight() method has failed with the status: " + status.ToString()
End If
MessageBox.Show(message, caption)
Else
MessageBox.Show("The AddStandardFont() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("Units can't be set correctly.", caption)
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetTextHeight";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
string fontName = gdpicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontTimesRoman);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
string message = "";
float height = gdpicturePDF.GetTextHeight(fontName, 20, true);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
message = message + "The height of the Times-Roman font with the size 20, with respect to the font boundary box, is " + height.ToString() + " centimeters.";
else
message = message + "The GetTextHeight() method has failed with the status: " + status.ToString();
height = gdpicturePDF.GetTextHeight(fontName, 20, false);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
message = message + "\nThe height of the Times-Roman font with the size 20, without respecting the font boundary box, is " + height.ToString() + " centimeters.";
else
message = message + "\nThe GetTextHeight() method has failed with the status: " + status.ToString();
MessageBox.Show(message, caption);
}
else
MessageBox.Show("The AddStandardFont() method has failed with the status: " + status.ToString(), caption);
}
else
MessageBox.Show("Units can't be set correctly.", caption);
}
else
MessageBox.Show("The file can't be loaded.", caption);
gdpicturePDF.Dispose();