The new value of the printer document name setting.
Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / PrintSetDocumentName Method

PrintSetDocumentName Method (GdPicturePDF)

In This Topic
Sets up the printer document name setting of the active printer. You can use it to display during the next print process (for example, in a print status dialog box or printer queue) while printing the document.
Syntax
'Declaration

 

Public Function PrintSetDocumentName( _

   ByVal DocumentName As String _

) As GdPictureStatus
public GdPictureStatus PrintSetDocumentName( 

   string DocumentName

)
public function PrintSetDocumentName( 

    DocumentName: String

): GdPictureStatus; 
public function PrintSetDocumentName( 

   DocumentName : String

) : GdPictureStatus;
public: GdPictureStatus PrintSetDocumentName( 

   string* DocumentName

) 
public:

GdPictureStatus PrintSetDocumentName( 

   String^ DocumentName

) 

Parameters

DocumentName
The new value of the printer document name setting.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
It is recommend to use the GetStat method or the PrintGetStat method to identify the specific reason for the method's failure, if any.

Just to inform you that the default value specified by the toolkit is "GdPicture Print Process".

Likewise to remind you that the active printer is the printer identified by the PrintGetActivePrinter method or set by the PrintSetActivePrinter method and it is dedicated to executing all subsequent print jobs using this class as well as utilizing all by you altered printer settings.

Example
How to set up the document name property of the active printer.
Dim caption As String = "Example: PrintSetDocumentName"

Using gdpicturePDF As New GdPicturePDF()

    If gdpicturePDF.LoadFromFile("document_to_print.pdf", False) = GdPictureStatus.OK Then

        Dim docName As String = gdpicturePDF.PrintGetDocumentName()

        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then

            Dim status As GdPictureStatus = GdPictureStatus.OK

            Dim curName As String = gdpicturePDF.GetTitle()

            If String.IsNullOrEmpty(curName) = False Then

                'We only change the document name if the document title is not empty.

                status = gdpicturePDF.PrintSetDocumentName(curName)

                If status = GdPictureStatus.OK Then

                    docName = curName

                End If

            End If

            If status = GdPictureStatus.OK Then

                If gdpicturePDF.Print() = GdPictureStatus.OK Then

                    MessageBox.Show("The file " + docName + " has been printed successfully.", caption)

                Else

                    Dim message As String = "The file " + docName + " can't be printed." + vbCrLf + "Status: " + gdpicturePDF.PrintGetStat().ToString()

                    If gdpicturePDF.PrintGetStat() = GdPictureStatus.PrintingException Then

                        message = message + "    Error: " + gdpicturePDF.PrintGetLastError()

                    End If

                    MessageBox.Show(message, caption)

                End If

            Else

                MessageBox.Show("The PrintSetDocumentName() method has failed with the status: " + status, caption)

            End If

        Else

            MessageBox.Show("The PrintGetDocumentName() method has failed with the status: " + gdpicturePDF.GetStat(), caption)

        End If

        gdpicturePDF.CloseDocument()

    Else

        MessageBox.Show("The file can't be loaded. Status: " + gdpicturePDF.GetStat().ToString(), caption)

    End If

End Using
string caption = "Example: PrintSetDocumentName";

using (GdPicturePDF gdpicturePDF = new GdPicturePDF())

{

    if (gdpicturePDF.LoadFromFile("document_to_print.pdf", false) == GdPictureStatus.OK)

    {

        string docName = gdpicturePDF.PrintGetDocumentName();

        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)

        {

            GdPictureStatus status = GdPictureStatus.OK;

            string curName = gdpicturePDF.GetTitle();

            if (String.IsNullOrEmpty(curName) == false)

            {

                //We only change the document name if the document title is not empty.

                gdpicturePDF.PrintSetDocumentName(curName);

                status = gdpicturePDF.GetStat();

            }

            if (status == GdPictureStatus.OK)

            {

                if (gdpicturePDF.Print() == GdPictureStatus.OK)

                {

                    MessageBox.Show("The file " + curName + " has been printed successfully.", caption);

                }

                else

                {

                    string message = "The file " + curName + " can't be printed.\nStatus: " + gdpicturePDF.PrintGetStat().ToString();

                    if (gdpicturePDF.PrintGetStat() == GdPictureStatus.PrintingException)

                        message = message + "    Error: " + gdpicturePDF.PrintGetLastError();

                    MessageBox.Show(message, caption);

                }

            }

            else

            {

                MessageBox.Show("The PrintSetDocumentName() method has failed with the status: " + status, caption);

            }

        }

        else

        {

            MessageBox.Show("The PrintGetDocumentName() method has failed with the status: " + gdpicturePDF.GetStat(), caption);

        }

        gdpicturePDF.CloseDocument();

    }

    else

    {

        MessageBox.Show("The file can't be loaded. Status: " + gdpicturePDF.GetStat().ToString(), caption);

    }

}
See Also