Dim caption As String = "Example: SaveToFileInc"
Dim oSrcPDF As New GdPicturePDF()
Dim oDstPDF As New GdPicturePDF()
'The file access mode will be read/write.
Dim status As GdPictureStatus = oDstPDF.LoadFromFileEx("doc1.pdf", True)
If status = GdPictureStatus.OK Then
' The file will not load into memory.
status = oSrcPDF.LoadFromFile("doc2.pdf", False)
If status = GdPictureStatus.OK Then
Dim srcPageCount As Integer = oSrcPDF.GetPageCount()
If oSrcPDF.GetStat() = GdPictureStatus.OK Then
For i As Integer = 1 To srcPageCount
status = oDstPDF.ClonePage(oSrcPDF, i)
If status <> GdPictureStatus.OK Then
Exit For
End If
Next
If status = GdPictureStatus.OK Then
status = oDstPDF.SaveToFileInc("doc1.pdf")
If status = GdPictureStatus.OK Then
MessageBox.Show("The file has been successfully saved.", caption)
Else
MessageBox.Show("The file can't be saved. Status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The ClonePage() method has failed with the status: " + status.ToString(), caption)
End If
End If
Else
MessageBox.Show("The source file can't be opened. Status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The destination file can't be opened. Status: " + status.ToString(), caption)
End If
oDstPDF.Dispose()
oSrcPDF.Dispose()
string caption = "Example: SaveToFileInc";
GdPicturePDF oSrcPDF = new GdPicturePDF();
GdPicturePDF oDstPDF = new GdPicturePDF();
//The file access mode will be read/write.
GdPictureStatus status = oDstPDF.LoadFromFileEx("doc1.pdf", true);
if (status == GdPictureStatus.OK)
{
//The file will not load into memory.
status = oSrcPDF.LoadFromFile("doc2.pdf", false);
if (status == GdPictureStatus.OK)
{
int srcPageCount = oSrcPDF.GetPageCount();
if (oSrcPDF.GetStat() == GdPictureStatus.OK)
{
for (int i = 1; i <= srcPageCount; i++)
{
status = oDstPDF.ClonePage(oSrcPDF, i);
if (status != GdPictureStatus.OK) break;
}
if (status == GdPictureStatus.OK)
{
status = oDstPDF.SaveToFileInc("doc1.pdf");
if (status == GdPictureStatus.OK)
MessageBox.Show("The file has been successfully saved.", caption);
else
MessageBox.Show("The file can't be saved. Status: " + status.ToString(), caption);
}
else
{
MessageBox.Show("The ClonePage() method has failed with the status: " + status.ToString(), caption);
}
}
}
else
{
MessageBox.Show("The source file can't be opened. Status: " + status.ToString(), caption);
}
}
else
{
MessageBox.Show("The destination file can't be opened. Status: " + status.ToString(), caption);
}
oDstPDF.Dispose();
oSrcPDF.Dispose();