Using gdpicturePDF As New GdPicturePDF()
'A brand new empty document without any page.
Dim status As GdPictureStatus = gdpicturePDF.NewPDF(PdfConformance.PDF_A_1a)
If status = GdPictureStatus.OK Then
Dim fontResName As String = gdpicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontHelvetica)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
If (gdpicturePDF.NewPage(500, 500) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.SetFillColor(Color.Blue) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.SetTextSize(30) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.DrawText(fontResName, 200, 250, "Hello World") = GdPictureStatus.OK) Then
status = gdpicturePDF.SaveToFile("test_HelloWorld.pdf")
If status = GdPictureStatus.OK Then
MessageBox.Show("Your new PDF document has been successfully created.", "Example: NewPDF")
Else
MessageBox.Show("The file can't be saved. Status: " + status.ToString(), "Example: NewPDF")
End If
End If
End If
gdpicturePDF.CloseDocument()
Else
MessageBox.Show("The NewPDF(PdfConformance.PDF_A_1a) method has failed with the status: " + status.ToString(), "Example: NewPDF")
End If
End Using
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
//A brand new empty document without any page.
GdPictureStatus status = gdpicturePDF.NewPDF(PdfConformance.PDF_A_1a);
if (status == GdPictureStatus.OK)
{
string fontResName = gdpicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontHelvetica);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
if ((gdpicturePDF.NewPage(500, 500) == GdPictureStatus.OK) &&
(gdpicturePDF.SetFillColor(Color.Blue) == GdPictureStatus.OK) &&
(gdpicturePDF.SetTextSize(30) == GdPictureStatus.OK) &&
(gdpicturePDF.DrawText(fontResName, 200, 250, "Hello World") == GdPictureStatus.OK))
{
status = gdpicturePDF.SaveToFile("test_HelloWorld.pdf");
if (status == GdPictureStatus.OK)
MessageBox.Show("Your new PDF document has been successfully created.", "Example: NewPDF");
else
MessageBox.Show("The file can't be saved. Status: " + status.ToString(), "Example: NewPDF");
}
}
gdpicturePDF.CloseDocument();
}
else
{
MessageBox.Show("The NewPDF(PdfConformance.PDF_A_1a) method has failed with the status: " + status.ToString(), "Example: NewPDF");
}
}