Dim caption As String = "Example: AddFontFromFileU"
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.AddFontFromFileU("\WINDOWS\Fonts\mingliu.ttc", "MingLiu", FontCharSet.ANSI_CHARSET, False, False)
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, ChrW(20320) + " " + ChrW(22909)) = GdPictureStatus.OK) Then
status = gdpicturePDF.SaveToFile("test_AddFontFromFileU.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 AddFontFromFileU() 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: AddFontFromFileU";
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.AddFontFromFileU("\\WINDOWS\\Fonts\\mingliu.ttc", "MingLiu", FontCharSet.ANSI_CHARSET, false, false);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
string utext = ((char)(20320)).ToString() + " " + ((char)(22909)).ToString();
if ((gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK) &&
(gdpicturePDF.SetFillColor(255, 0, 0) == GdPictureStatus.OK) &&
(gdpicturePDF.SetTextSize(30) == GdPictureStatus.OK) &&
(gdpicturePDF.DrawText(fontResName, 10, 50, utext) == GdPictureStatus.OK))
{
status = gdpicturePDF.SaveToFile("test_AddFontFromFileU.pdf");
if (status == GdPictureStatus.OK)
MessageBox.Show("The example HAS been followed successfully.", caption);
}
else
status = gdpicturePDF.GetStat();
}
else
{
MessageBox.Show("The AddFontFromFileU() 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();