When using forge viewer for PDF’s, is it possible to enable the Snap feature for measuring (same as when viewing models). Also, can the zoom level be changed i.e. we want to zoom in closer than the default maximum?
Both of these are possible in BIM360 so I hope it is also possible in our application, can you please advise.
Currently we are used v7 viewer. We are added the snap extension and setZoomInLimitFactor method also. But still we are unable to get snapping feature and zoom in function at PDF files.
function launchViewer(urn, viewableId) {
var options = {
env: 'AutodeskProduction',
getAccessToken: getForgeToken,
api: 'derivativeV2' + (atob(urn.replace('_', '/')).indexOf('emea') > -1 ? '_EU' : '') // Both BIM 360 US and EU regions
};
Autodesk.Viewing.Initializer(options, () => {
viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('forgeViewer'));
viewer.start();
var documentId = 'urn:' + urn;
Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
});
function onDocumentLoadSuccess(doc) {
// if a viewableId was specified, load that view, otherwise the default view
var viewables = (viewableId ? doc.getRoot().findByGuid(viewableId) : doc.getRoot().getDefaultGeometry());
viewer.loadDocumentNode(doc, viewables).then(i => {
viewer.loadExtension('Autodesk.VisualClusters');
viewer.loadExtension('Autodesk.Snapping');
viewer.loadExtension("Autodesk.Viewing.MarkupsCore");
viewer.loadExtension("Autodesk.Viewing.MarkupsGui");
viewer.loadExtension('Autodesk.Measure');
viewer.loadExtension('Autodesk.DefaultTools.NavTools');
viewer.loadExtension('Autodesk.PDF');
viewer.loadExtension('Autodesk.DocumentBrowser');
viewer.loadExtension('Autodesk.Viewing.ZoomWindow');
// any additional added here
});
viewer.navigation.setZoomInLimitFactor(2500);
console.log(viewer.navigation.getZoomInLimitFactor());
}
function onDocumentLoadFailure(viewerErrorCode) {
console.error('onDocumentLoadFailure() - errorCode:' + viewerErrorCode);
}
}
kindly advise if we missed anything. Thanks in advance.