Autodesk Forge API - Data Management API - How to Get File Total Page in BIM Docs Project Files

62 views Asked by At

Currently I'm using Autodesk Platform Services for the first time and have already utilized the Data Management API to integrate drawing file information into our ERP system. Currently, is there any method or API to retrieve the total number of pages in a file within the Project Files directory ?.

Description Image

As far as I know, the Data Management API does not have this feature; it only provides features for displaying metadata information from documents.

Data Management API

references

Your assistance would be greatly appreciated.

1

There are 1 answers

1
Eason Kang On

Unfortunately, you're correct. Data Management API doesn't provide such info for PDF files.

However, an indirect way is to get the PDF page number by using Model Derivative API. You might know BIM360 Docs will automatically process PDF files with Model Derivative API after uploading.

We can get the derivative urn of that PDF version tip by following https://aps.autodesk.com/blog/get-derivative-urn-accbim360-file-viewing-it-viewer

Afterward, we call GET /{urn}/manifest of Model Derivative API to get the manifest for the PDF file, and then count how many views inside to know the page amounts. Model Derivative API will process each PDF page into a view. Here is a pseudocode:

var manifest = await getManifestAsync(urn);

var pdfPageNumber = manifest.derivatives[0].children.filter(view => view.role == "2d" && view.type == "geometry").length;