Dim caption As String = "Example: ScalePage"
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
Dim count As Integer = gdpicturePDF.GetPageCount()
Dim status As GdPictureStatus = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
If count > 0 Then
status = gdpicturePDF.SelectPage(1)
If status = GdPictureStatus.OK Then
status = gdpicturePDF.ScalePage(0.5, 0.5)
If status = GdPictureStatus.OK Then
If gdpicturePDF.SaveToFile("test_ScalePage.pdf") = GdPictureStatus.OK Then
MessageBox.Show("The page has been scaled successfully and the file has been saved.", caption)
Else
MessageBox.Show("The page has been scaled successfully, but the file can't be saved.", caption)
End If
Else
MessageBox.Show("The ScalePage() method has failed with the status: " + status.ToString(), caption)
status = GdPictureStatus.OK
End If
End If
Else
status = GdPictureStatus.InvalidParameter
End If
End If
If status <> GdPictureStatus.OK Then
MessageBox.Show("The example HAS NOT been followed successfully. The last error status is: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: ScalePage";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
int count = gdpicturePDF.GetPageCount();
GdPictureStatus status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
if (count > 0)
{
status = gdpicturePDF.SelectPage(1);
if (status == GdPictureStatus.OK)
{
status = gdpicturePDF.ScalePage((float)0.5, (float)0.5);
if (status == GdPictureStatus.OK)
{
if (gdpicturePDF.SaveToFile("test_ScalePage.pdf") == GdPictureStatus.OK)
MessageBox.Show("The page has been scaled successfully and the file has been saved.", caption);
else
MessageBox.Show("The page has been scaled successfully, but the file can't be saved.", caption);
}
else
{
MessageBox.Show("The ScalePage() method has failed with the status: " + status.ToString(), caption);
status = GdPictureStatus.OK;
}
}
}
else
status = GdPictureStatus.InvalidParameter;
}
if (status != GdPictureStatus.OK)
MessageBox.Show("The example HAS NOT been followed successfully. The last error status is: " + status.ToString(), caption);
}
else
MessageBox.Show("The file can't be loaded.", caption);
gdpicturePDF.Dispose();