SetSubject Method (GdPicturePDF)
Sets up a new subject of the currently loaded PDF document into the document information dictionary and in the document catalog's metadata as well.
If the loaded PDF document contains metadata stored in the Metadata entry in the document catalog, the newly specified Subject property is synchronized with those metadata. That means, you will be able to see the changed value of this property using the Acrobat's Document Properties dialogue box.
public void SetSubject(
string
)
public procedure SetSubject(
: String
);
public function SetSubject(
: String
);
public: void SetSubject(
string*
)
public:
void SetSubject(
String^
)
'Declaration
Public Sub SetSubject( _
ByVal As String _
)
Parameters
- Subject
- A new value of the Subject property as a string.
How to set up a new subject of the PDF document.
Using gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", True) = GdPictureStatus.OK Then
Dim subject As String = gdpicturePDF.GetSubject()
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
MessageBox.Show("The original subject of this PDF is: " + subject, "Example: SetSubject")
gdpicturePDF.SetSubject("Test GdPicture working on PDFs.")
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If gdpicturePDF.SaveToFile("test.pdf") = GdPictureStatus.OK Then
subject = gdpicturePDF.GetSubject()
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
MessageBox.Show("The new subject of this PDF is: " + subject, "Example: SetSubject")
End If
Else
MessageBox.Show("The file can't be saved.", "Example: SetSubject")
End If
Else
MessageBox.Show("The SetSubject() method has failed with the status: " + status.ToString(), "Example: SetSubject")
End If
Else
MessageBox.Show("The GetSubject() method has failed with the status: " + status.ToString(), "Example: SetSubject")
End If
Else
MessageBox.Show("The file can't be loaded.", "Example: SetSubject")
End If
End Using
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
if (gdpicturePDF.LoadFromFile("test.pdf", true) == GdPictureStatus.OK)
{
string subject = gdpicturePDF.GetSubject();
GdPictureStatus status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
MessageBox.Show("The original subject of this PDF is: " + subject, "Example: SetSubject");
gdpicturePDF.SetSubject("Test GdPicture working on PDFs.");
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (gdpicturePDF.SaveToFile("test.pdf") == GdPictureStatus.OK)
{
subject = gdpicturePDF.GetSubject();
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
MessageBox.Show("The new subject of this PDF is: " + subject, "Example: SetSubject");
}
}
else
{
MessageBox.Show("The file can't be saved.", "Example: SetSubject");
}
}
else
{
MessageBox.Show("The SetSubject() method has failed with the status: " + status.ToString(), "Example: SetSubject");
}
}
else
{
MessageBox.Show("The GetSubject() method has failed with the status: " + status.ToString(), "Example: SetSubject");
}
}
else
{
MessageBox.Show("The file can't be loaded.", "Example: SetSubject");
}
}