TiffCreateMultiPageFromFile(String,Boolean) Method
Creates a new GdPicture image representing the editable multipage TIFF image based on an input file. The newly created image is identified by its unique non-zero image identifier.
Please note that you can specify the read-only or read-write mode using the GdPictureImaging.TiffOpenMultiPageForWrite method before loading the file.
public int TiffCreateMultiPageFromFile(
string ,
bool
)
public function TiffCreateMultiPageFromFile(
: String;
: Boolean
): Integer;
public function TiffCreateMultiPageFromFile(
: String,
: boolean
) : int;
public: int TiffCreateMultiPageFromFile(
string* ,
bool
)
public:
int TiffCreateMultiPageFromFile(
String^ ,
bool
)
'Declaration
Public Overloads Function TiffCreateMultiPageFromFile( _
ByVal As String, _
ByVal As Boolean _
) As Integer
Parameters
- FilePath
- The file path of the source file. Use the empty string to allow the control to prompt users to select a file. Specifies if the file content will be loaded into memory (true). Loading the file content directly into memory results in a better manipulation performance, but it consumes more memory. If you load a file into memory, you can subsequently overwrite or delete the file. Suggested value is false, which means that the file is opened in read access mode.
You can subsequently use the GdPictureImaging.GetLastPath method to retrieve the path of the selected file.
- LoadInMemory
- Specifies if the file content will be loaded into memory (true). Loading the file content directly into memory results in
a better manipulation performance, but it consumes more memory. If you load a file into memory, you can subsequently overwrite or delete the file.
Suggested value is false, which means that the file is opened in read access mode.
Return Value
A unique image identifier of the GdPicture image representing the newly created editable multipage TIFF image. The returned value is non-zero if the image is successfully created. Please first of all use the
GdPictureImaging.GetStat method to determine if this method has been successful.
Be aware that you need to release the image with the GdPictureImaging.ReleaseGdPictureImage method after being used.
Handling with a multipage tiff document.
Swapping two pages in a multipage tiff document.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// LoadInMemory parameter is set to true in order to be able to update the input file.
int imageID = gdpictureImaging.TiffCreateMultiPageFromFile("multipage.tif", true);
gdpictureImaging.TiffSwapPages(imageID, 1, 2);
gdpictureImaging.TiffSaveMultiPageToFile(imageID, "multipage.tif", TiffCompression.TiffCompressionAUTO);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Deleting the last page of a multipage tiff document.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
// LoadInMemory parameter is set to true in order to be able to update the input file.
int imageID = gdpictureImaging.TiffCreateMultiPageFromFile("multipage.tif", true);
int pageCount = gdpictureImaging.TiffGetPageCount(imageID);
gdpictureImaging.TiffDeletePage(imageID, pageCount);
gdpictureImaging.TiffSaveMultiPageToFile(imageID, "multipage.tif", TiffCompression.TiffCompressionAUTO);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}