Button that rotates ALL pages clockwise continuously

Product: PDFTron

Please give a brief summary of your issue:
I’ve pushed a button to header and I wish for the button to rotate all pages clockwise, every time the button is clicked. The implementation that I have rotates all pages clockwise only once. I know there’s already controls that has this functionality but I’m creating my own header where this button is not in the overlay.

  UI.setHeaderItems(header => {
    header.push(
      {
        type: 'actionButton',
        img: '',
        onClick: () => {
          instance.UI.setLayoutMode(instance.UI.LayoutMode.Facing);
        }
      },
      {
        type: 'actionButton',
        img: '',
        onClick: () => {
          Core.documentViewer.setRotation(1);
        }
      }
    );
  });

Hello there.

In order to rotate the pages incrementally, you need to get the current rotation and increment that. So, in the example you provided, instead of Core.documentViewer.setRotation(1);, you need to use Core.documentViewer.setRotation(Core.documentViewer.getRotation() + 1);.

Also please note that the valid rotation values are 0, 1, 2 and 3 corresponding to 0, 90, 180 and 270 degrees.

Let me know how this works for you and if you have any further questions.

Best Regards,
Diego Felix
Web Software Developer
PDFTron Systems, Inc.
www.pdftron.com

CONFIDENTIALITY NOTICE: This message (and any attachment to it) is intended only for the use of the individual or entity to which it is addressed in the header, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Any reproduction, distribution, modification or use of the contents of this message (and any attachment to it) by any individual or entity other than the intended recipient is prohibited. If you have received this communication in error, please notify us immediately and delete the original.