function pj = newpage( pj )
%NEWPAGE Method to finish the current page of a PrintJob and start next.
%   Depending on current driver being used, may cause current page
%   from being ejected from output device.
%
%   Ex:
%      pj = NEWPAGE( pj ); %modfies PrintJob object state
%
%   See also RENDER, FINISH, CANCEL.

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.2 $  $Date: 1998/05/22 23:24:05 $

if nargin ~= 1 | ~isa(pj,'printjob')
    error('Requires PrintJob object')
end

if ~pj.Active
   error('PrintJob is not active')
end

pj.PageNumber = pj.PageNumber + 1;

%Tell internal driver
if feature('NewPrintAPI')
    err = hardcopy( pj, 'newpage' );
end
