SaveAsPDF(Int32,String,Boolean,String,String,String,String,String) Method
In This Topic
Saves a GdPicture image as single page pdf.
Syntax
'Declaration
Public Overloads Function SaveAsPDF( _
ByVal As Integer, _
ByVal As String, _
ByVal As Boolean, _
ByVal As String, _
ByVal As String, _
ByVal As String, _
ByVal As String, _
ByVal As String _
) As GdPictureStatus
public GdPictureStatus SaveAsPDF(
int ,
string ,
bool ,
string ,
string ,
string ,
string ,
string
)
public function SaveAsPDF(
: Integer;
: String;
: Boolean;
: String;
: String;
: String;
: String;
: String
): GdPictureStatus;
public function SaveAsPDF(
: int,
: String,
: boolean,
: String,
: String,
: String,
: String,
: String
) : GdPictureStatus;
public: GdPictureStatus SaveAsPDF(
int ,
string* ,
bool ,
string* ,
string* ,
string* ,
string* ,
string*
)
public:
GdPictureStatus SaveAsPDF(
int ,
String^ ,
bool ,
String^ ,
String^ ,
String^ ,
String^ ,
String^
)
Parameters
- ImageID
- GdPicture image identifier.
- FilePath
- The complete PDF file path to save a GdPicture image. Can be an empty string. If empty, prompts the user to select a file. You can subsequently use the GetLastPath() method to retrieve the path of the selected file.
- PDFA
- True to generate PDF in PDF/A 1-b format else False.
- Title
- The title of the PDF.
- Author
- The PDF Author.
- Subject
- The PDF Subject.
- Keywords
- The PDF Keywords.
- Creator
- The name of the application which creates the PDF.
Return Value
A member of the GdPictureStatus enumeration.
Example
Saving the image as a PDF document specifying document properties.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("");
if (gdpictureImaging.GetStat() == GdPictureStatus.OK)
{
// Get the file path of the loaded image file.
string filePath = gdpictureImaging.GetLastPath();
string pdfPath = System.IO.Path.ChangeExtension(filePath, ".pdf");
// Get the current version of the GdPicture.NET toolkit.
string version = (gdpictureImaging.GetVersion()).ToString();
version = version.Insert(version.IndexOf('.') + 2, ".");
// Define the document properties when saving, for example, the current version of the GdPicture.NET toolkit.
gdpictureImaging.SaveAsPDF(imageID, pdfPath, false, "Saving image as PDF", "GdPicture ver." + version.ToString(), "For test", "image, pdf", "Orpalis");
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
else
MessageBox.Show("An image can't be created.\nError: " + gdpictureImaging.GetStat().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Example
Saving the image as a PDF document specifying document properties.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("");
if (gdpictureImaging.GetStat() == GdPictureStatus.OK)
{
// Get the file path of the loaded image file.
string filePath = gdpictureImaging.GetLastPath();
string pdfPath = System.IO.Path.ChangeExtension(filePath, ".pdf");
// Get the current version of the GdPicture.NET toolkit.
string version = (gdpictureImaging.GetVersion()).ToString();
version = version.Insert(version.IndexOf('.') + 2, ".");
// Define the document properties when saving, for example, the current version of the GdPicture.NET toolkit.
gdpictureImaging.SaveAsPDF(imageID, pdfPath, false, "Saving image as PDF", "GdPicture ver." + version.ToString(), "For test", "image, pdf", "Orpalis");
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
else
MessageBox.Show("An image can't be created.\nError: " + gdpictureImaging.GetStat().ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
See Also