autodesk-forgeautodesk-viewer

Autodesk PDFExtension with Markup, Rotating document and markup layers together


we're currently using Autodesk forgeviewer and a combination of the PDF and Markup Extensions to allow our users to markup technical drawings.

We're currently looking to add a Rotate button, to rotate the document by 90 degrees following this:

viewer.loadModel("TestSheet.pdf", {}, (model) => {
  var bb = model.getBoundingBox();
  var mx = new THREE.Matrix4();
  mx.makeRotationZ(90 * Math.PI / 180);
  // translation along X axis
  mx.elements[12] = bb.max.y;
  model.setPlacementTransform(mx);
});

Which we found here: https://aps.autodesk.com/blog/rotate-sheets-viewer.

The problem being that the as the document is flipped, the markup remains in its original position and is no longer, against the correct document position.

I've tried to rotate the markup layer manually using css rotate, transform / translate but cant seem to find a set way that works consistently.

I'm not sure if I'm going about this correct way, and maybe rotating the camera is a better approach? I found this function here in Navigation.js but struggled to fathom what was supplied to be provided for the pivot, viewVec.

enter image description here

I wonder if anyone has succesfully rotated a pdf with a markup layer. And what approach they have taken? Any help appreciated.


Solution

  • model is loaded in canvas and markups are SVG layer, positioning for both is different, that's why the viewer is in locked position when edit markup mode is on. We don't have a built-in function to manage this rotation simultaneously. You can experiment using this blog content.