Dim caption As String = "Example: AddTrueTypeFontFromFile"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.NewPDF()
If status = GdPictureStatus.OK Then
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
'You need to set the correct path to your resource font file here.
Dim fontResName As String = gdpicturePDF.AddTrueTypeFontFromFile("\WINDOWS\Fonts\webdings.ttf", False, False, True)
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.SetFillColor(255, 0, 0) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.SetTextSize(30) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.DrawText(fontResName, 10, 50, "Here is some text") = GdPictureStatus.OK) Then
status = gdpicturePDF.SaveToFile("test_AddTrueTypeFontFromFile.pdf")
If status = GdPictureStatus.OK Then
MessageBox.Show("The example HAS been followed successfully.", caption)
End If
Else
status = gdpicturePDF.GetStat()
End If
Else
MessageBox.Show("The AddTrueTypeFontFromFile() method has failed with the status: " + status.ToString(), caption)
status = GdPictureStatus.OK
End If
End If
If status <> GdPictureStatus.OK Then
MessageBox.Show("The example HAS NOT been followed successfully. The last error status is = " + status.ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: AddTrueTypeFontFromFile";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.NewPDF();
if (status == GdPictureStatus.OK)
{
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter);
//You need to set the correct path to your resource font file here.
string fontResName = gdpicturePDF.AddTrueTypeFontFromFile("\\WINDOWS\\Fonts\\webdings.ttf", false, false, true);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if ((gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK) &&
(gdpicturePDF.SetFillColor(255, 0, 0) == GdPictureStatus.OK) &&
(gdpicturePDF.SetTextSize(30) == GdPictureStatus.OK) &&
(gdpicturePDF.DrawText(fontResName, 10, 50, "Here is some text") == GdPictureStatus.OK))
{
status = gdpicturePDF.SaveToFile("test_AddTrueTypeFontFromFile.pdf");
if (status == GdPictureStatus.OK)
MessageBox.Show("The example HAS been followed successfully.", caption);
}
else
status = gdpicturePDF.GetStat();
}
else
{
MessageBox.Show("The AddTrueTypeFontFromFile() method has failed with the status: " + status.ToString(), caption);
status = GdPictureStatus.OK;
}
}
if (status != GdPictureStatus.OK)
MessageBox.Show("The example HAS NOT been followed successfully. The last error status is = " + status.ToString(), caption);
gdpicturePDF.Dispose();