Get Page Count for the Project Introduction
This example allows you to get page count for the project to be rendered using specified time interval and given timescale, using Aspose.Tasks Cloud. Aspose.Tasks Cloud is a REST API which can be used with any language: .NET, Java, PHP, Ruby, Rails, Python, jQuery and many more.
You can also specify format and Page size.
API
Type
Description
Resource Link
/tasks/{name}/pagecount
GET
Get the page count for the project
GetPageCount
cURL Example
SDKs
The Aspose.Tasks Cloud SDKs can be downloaded from the following page: Available SDKs
SDK Examples
C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-dotnet/
var remoteName = await UploadFileToStorageAsync("Home move plan.mpp");
var response = await TasksApi.GetPageCountAsync(new GetPageCountRequest
{
PresentationFormat = PresentationFormat.TaskUsage,
Timescale = Timescale.Months,
Name = remoteName,
Folder = this.DataFolder,
});
Assert.AreEqual((int)HttpStatusCode.OK, response.Code);
Assert.AreEqual(4, response.PageCount);
PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-php/
$remoteName = "GetDocumentInCsvFormatWithSaveOptions.mpp";
$folder = $this->uploadFile("Home move plan.mpp", $remoteName, '');
$response = $this->tasks->getPageCount(new GetPageCountRequest($remoteName,
null,
Model\PresentationFormat::TASK_USAGE,
Model\Timescale::MONTHS,
new DateTime("2004-01-01"),
new DateTime("2004-02-28"),
$folder));
Assert::assertEquals(200, $response->getCode());
Assert::assertEquals(4, $response->getPageCount());
Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-python
filename = 'Home_move_plan.mpp'
self.upload_file(filename)
request = GetPageCountRequest(filename, presentation_format=PresentationFormat.TASKUSAGE, timescale=Timescale.MONTHS,
start_date=date(2004, 1, 1), end_date=date(2004, 2, 28))
result = self.tasks_api.get_page_count(request)
self.assertIsNotNone(result)
self.assertIsInstance(result, PageCountResponse)
self.assertEqual(2, result.page_count)
Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-node
const fileName = "Home_move_plan.mpp";
const localPath = "./Data/" + fileName;
const remotePath = "Temp/Data";
const remoteFullPath = remotePath + "/" + fileName;
await tasksApi.uploadFileToStorage(remoteFullPath, localPath);
const request = new GetPageCountRequest();
request.name = fileName;
request.folder = remotePath;
request.presentationFormat = PresentationFormat.TaskUsage;
request.timescale = Timescale.Months;
request.startDate = new Date(2004, 0, 1);
request.endDate = new Date(2004, 1, 28);
const result = await tasksApi.getPageCount(request);
expect(result.response.statusCode).to.equal(200);
expect(result.body.pageCount).to.equal(4);
Go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-go/
client, ctx := UploadTestFileToStorage(t, localFileName, remoteBaseTestDataFolder+"/"+remoteFileName)
options := &requests.GetPageCountOpts{
Name: remoteFileName,
Folder: optional.NewString(remoteBaseTestDataFolder),
PresentationFormat: optional.NewString(string(models.TASK_USAGE_PresentationFormat)),
Timescale: optional.NewString(string(models.MONTHS_Timescale)),
}
result, _, err := client.TasksApi.GetPageCount(ctx, options)
if err != nil {
t.Error(err)
}
assert.Equal(t, int32(200), result.Code)
assert.Equal(t, int32(4), result.PageCount)
Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-java/
String localFileName = "Home_move_plan.mpp";
String remoteFileName = TestInitializer.UploadFile(localFileName);
GetPageCountRequest request = new GetPageCountRequest(remoteFileName, null, PresentationFormat.TASKUSAGE.getValue(), Timescale.MONTHS.getValue(), null, null, null, null);
PageCountResponse result = TestInitializer.tasksApi.getPageCount(request);
assertNotNull(result);
assertEquals(200, (int) result.getCode());
assertEquals(4, result.getPageCount().intValue());