GdPicture.NET.14
GdPicture14 Namespace / GdPictureDocumentConverter Class / SaveAsPDF Method / SaveAsPDF(String,PdfConformance) Method
The file path where the destination document will save. If the specified file already exists, it will be overwritten.
A member of the PdfConformance enumeration. Specifies the required conformance to the PDF or PDF/A standard of the saved PDF document.

You can use the value of the PdfConformance.PDF to save the file as a common PDF document.

Example





In This Topic
SaveAsPDF(String,PdfConformance) Method
In This Topic
This method converts and saves (in other words, creates a brand new destination document) the currently loaded document to a PDF document according to a file path you have specified.

The PDF conformance level of the saved PDF document is set according to the parameter specified by you. Currently, this class doesn't provide a valid conversion of existing PDF documents to PDF/A documents. For more details, please see the section Remarks below.

Syntax
'Declaration
 
Public Overloads Function SaveAsPDF( _
   ByVal FilePath As String, _
   Optional ByVal Conformance As PdfConformance _
) As GdPictureStatus
public GdPictureStatus SaveAsPDF( 
   string FilePath,
   PdfConformance Conformance
)
public function SaveAsPDF( 
    FilePath: String;
    Conformance: PdfConformance
): GdPictureStatus; 
public function SaveAsPDF( 
   FilePath : String,
   Conformance : PdfConformance
) : GdPictureStatus;
public: GdPictureStatus SaveAsPDF( 
   string* FilePath,
   PdfConformance Conformance
) 
public:
GdPictureStatus SaveAsPDF( 
   String^ FilePath,
   PdfConformance Conformance
) 

Parameters

FilePath
The file path where the destination document will save. If the specified file already exists, it will be overwritten.
Conformance
A member of the PdfConformance enumeration. Specifies the required conformance to the PDF or PDF/A standard of the saved PDF document.

You can use the value of the PdfConformance.PDF to save the file as a common PDF document.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
Remarks
You have to specify a full file path with the correct file extension, which is "pdf".

If you use the value of the PdfConformance.PDF, the library will create the PDF document conformed to the lowest PDF version (version 1.3 is the minimum) based on what the output PDF document will contain.

Example
Converting and saving a JPEG image to a single PDF document.
Using gdpictureDocumentConverter As New GdPictureDocumentConverter()
    Dim status As GdPictureStatus = gdpictureDocumentConverter.LoadFromFile("image.jpg", GdPicture14.DocumentFormat.DocumentFormatJPEG)
    If status = GdPictureStatus.OK Then
        MessageBox.Show("The file has been loaded successfully.", "GdPicture")
        gdpictureDocumentConverter.PdfImageQuality = 50
        status = gdpictureDocumentConverter.SaveAsPDF("output.pdf", PdfConformance.PDF)
        If status = GdPictureStatus.OK Then
            MessageBox.Show("The file has been saved successfully.", "GdPicture")
        Else
            MessageBox.Show("The file has failed to save. Status: " + status.ToString(), "GdPicture")
        End If
    Else
        MessageBox.Show("The file has failed to load. Status: " + status.ToString(), "GdPicture")
    End If
End Using
using (GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter())
{
    GdPictureStatus status = gdpictureDocumentConverter.LoadFromFile("image.jpg", GdPicture14.DocumentFormat.DocumentFormatJPEG);
    if (status == GdPictureStatus.OK)
    {
        MessageBox.Show("The file has been loaded successfully.", "GdPicture");
        gdpictureDocumentConverter.PdfImageQuality = 50;
        status = gdpictureDocumentConverter.SaveAsPDF("output.pdf", PdfConformance.PDF);
        if (status == GdPictureStatus.OK)
        {
            MessageBox.Show("The file has been saved successfully.", "GdPicture");
        }
        else
        {
            MessageBox.Show("The file has failed to save. Status: " + status.ToString(), "GdPicture");
        }
    }
    else
    {
        MessageBox.Show("The file has failed to load. Status: " + status.ToString(), "GdPicture");
    }
}
See Also