I need to open a PDF file from BIM 360 Docs on the Viewer selecting a specific page. I'm currently opening the PDF on the Viewer but I don't know how to select a page.
-
In the default viewer every pdf page is accessable as a viewable within a translated document. If you list all viewables you can switch between pages, get a well placed extension with `-` and `+` and you got a pretty well emulated pdf viewer. Cheers – Samuel Middendorp Jun 22 '20 at 08:00
-
Thanks Samuel. I'm new to Forge. How can initialize the Viewer using a specific page? – Alejandro Jun 22 '20 at 13:18
2 Answers
Adding on to my comment, you can get a list of all available viewables when using the onDocumentLoadSucces
callback. This callback is triggered after initting the viewer and loading the first Urn(model) into the viewer. You can look into more functionality on bubble nodes in the documentation
Example in angular/typescript:
private onDocumentLoadSucces(viewerDocument: Autodesk.Viewing.Document) {
// Default viewable
let defaultModel = viewerDocument.getRoot().getDefaultGeometry();
// list of all viewables in this model
this.viewables = viewerDocument.getRoot().search({'type':'geometry'});
// We load in the default viewable here but we could choose to load any viewable
// in this.viewables
this.viewer.loadDocumentNode(viewerDocument, defaultModel);
console.log('model changed');
}

- 652
- 4
- 14
-
Thanks Samuel. It can helps me to understand how to access the views. – Alejandro Jun 24 '20 at 01:55
I assume you are using the PDF extension to directly load and view PDF. If so, you can tell it the page number in the loadModel call. For example:
viewer.loadModel( pdf, {page:2});
Here's the whole function:
function initializeViewer( pdf ) {
var options = {
env: "Local",
useADP: false
}
Autodesk.Viewing.Initializer(options, () => {
viewer = new Autodesk.Viewing.Private.GuiViewer3D(document.getElementById('viewer3D'));
viewer.setTheme("light-theme");
viewer.start();
if (!pdf) return;
viewer.loadExtension('Autodesk.PDF').then( () => {
viewer.loadModel( pdf, {page:2});
});
});
};
The docs mention this here: https://forge.autodesk.com/en/docs/viewer/v7/reference/Extensions/PDFExtension/ and there is also an example I used to test from a blog post here: https://forge.autodesk.com/blog/fast-pdf-viewingmarkup-inside-forge-viewer
hope it helps

- 176
- 1
- 3
-
Thanks kevinvandecar for the quick answer.I'm not using the PDF Extension to load it on the Viewer. The way I am accessing the PDF is through BIM 360Docs, looking for the 'derivative' field to launch the viewer. What is the best way to view a PDF stored in BIM 360 Docs (in both cases: Plans folder and Project Files)? – Alejandro Jun 22 '20 at 20:55
-
Please check here for finding storage or derivative fields: https://stackoverflow.com/a/55338576/7745569 – Eason Kang Jun 23 '20 at 10:08
-
FYI, I double checked internally and sounds like BIM 360 PDF viewing is not supported in the Viewer PDF extension. As others here have said, you will have to use the translated viewables. For a specific page you will need to select the viewable for that PDF page. Sorry for any misinformation earlier and thanks for @Samuel Middendorp detailed response. – kevinvandecar Jun 24 '20 at 14:19
-