Dim caption As String = "Example: GuessPageTextRotation"
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
Dim pageCount As Integer = gdpicturePDF.GetPageCount()
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
Dim message As String = Nothing
Dim page_text_rotation As Integer = 0
For i As Integer = 1 To pageCount
gdpicturePDF.SelectPage(i)
message = message + "The page nr. " + i + ": "
'Eliminating the possible page rotation.
status = gdpicturePDF.NormalizePage()
If status = GdPictureStatus.OK Then
page_text_rotation = gdpicturePDF.GuessPageTextRotation()
status = gdpicturePDF.GetStat()
If status = GdPictureStatus.OK Then
message = message + "text rotation: " + page_text_rotation.ToString()
If page_text_rotation > 0 Then
status = gdpicturePDF.RotatePage(page_text_rotation)
If status = GdPictureStatus.OK Then
message = message + " :page has been rotated" + vbCrLf
Else
message = message + " :page has NOT been rotated: " + status.ToString()
Exit For
End If
Else
message = message + " :page has not been rotated" + vbCrLf
End If
End If
Else
message = message + status.ToString()
Exit For
End If
Next
If status = GdPictureStatus.OK Then
status = gdpicturePDF.SaveToFile("test_rotated.pdf")
If status = GdPictureStatus.OK Then
message = message + vbCrLf + "The pages have been rotated successfully and the file has been saved."
Else
message = message + vbCrLf + "The pages have been rotated successfully but the file can't be saved."
End If
End If
MessageBox.Show(message, caption)
Else
MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GuessPageTextRotation";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
int pageCount = gdpicturePDF.GetPageCount();
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
string message = null;
int page_text_rotation = 0;
for (int i = 1; i <= pageCount; i++)
{
gdpicturePDF.SelectPage(i);
message = message + "The page nr. " + i + ": ";
//Eliminating the possible page rotation.
status = gdpicturePDF.NormalizePage();
if (status == GdPictureStatus.OK)
{
page_text_rotation = gdpicturePDF.GuessPageTextRotation();
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
message = message + "text rotation: " + page_text_rotation.ToString();
if (page_text_rotation > 0)
{
status = gdpicturePDF.RotatePage(page_text_rotation);
if (status == GdPictureStatus.OK)
{
message = message + " :page has been rotated\n";
}
else
{
message = message + " :page has NOT been rotated: " + status.ToString();
break;
}
}
else
{
message = message + " :page has not been rotated\n";
}
}
}
else
{
message = message + status.ToString();
break;
}
}
if (status == GdPictureStatus.OK)
{
status = gdpicturePDF.SaveToFile("test_rotated.pdf");
if (status == GdPictureStatus.OK)
message = message + "\nThe pages have been rotated successfully and the file has been saved.";
else
message = message + "\nThe pages have been rotated successfully but the file can't be saved.";
}
MessageBox.Show(message, caption);
}
else
{
MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), caption);
}
}
else
{
MessageBox.Show("The file can't be loaded.", caption);
}
gdpicturePDF.Dispose();