code: function print( theme ) {
      if ( theme === 'grid' || ( !theme && isGrid() ) ) {
          let swapped = false;
          dialog.prompt( 'Enter valid paper format', 'A4' )
              .then( format => {
                  if ( !format ) {
                      throw new Error( 'Print cancelled by user.' );
                  }
                  swapped = styleToAll();
                  return fixGrid( {
                      format
                  } );
              } )
              .then( window.print )
              .catch( console.error )
              .then( () => {
                  if ( swapped ) {
                      setTimeout( styleReset, 500 );
                  }
              } );
      } else {
          window.print();
      }
  }
docs: Prints the form after first preparing the Grid (every time it is called).
  
  It's just demo function that only collects paper format and should be replaced
  in your app with a dialog that collects a complete paper format (size, margin, orientation);