function print_hreps(varargin); %...dpi, width,heigth);

%Default values, if no input
w=30; %width in cm
h=40; % height in cm
fts=30;

if nargin==1;
    filename=varargin{1};
    dpi=10; % pixel resolution
    w=20; % width in cm
    h=20; % height in cm  
elseif nargin==2
    filename=varargin{1};
    dpi=varargin{2};
elseif nargin==3
    filename=varargin{1};
    dpi=varargin{2};
    w=varargin{3};
    h=varargin{3};
elseif nargin==4
    filename=varargin{1};
    dpi=varargin{2};
    w=varargin{3};
    h=varargin{4};
elseif nargin==5
    filename=varargin{1};
    dpi=varargin{2};
    w=varargin{3};
    h=varargin{4};
    fts=varargin{5};
end

% % Change size (it doesn't work!)
% width=50; %3.5;
% height=10; %3.5;
set(gcf,'Units','centimeters')
set(gcf, 'Position',[0 20 w h])

% set(gcf,'PaperUnits','centimeters')
% set(gcf,'papersize',[width,height])
% set(gcf, 'PaperPositionMode', 'manual');
% set(gcf,'paperposition',[0 0 width height])


% Change font
fontsize=fts; %30; % 36; %
set(findall(gcf,'-property','FontSize'),'FontSize',fontsize)
set(findall(gcf,'-property','FontName'),'FontName','Helvetica')
set(findall(gcf,'-property','linewidth'),'linewidth',2); %2)
set(findall(gcf,'-property','markersize'),'linewidth',4); %4) 

% Chnage renderer (MATLAB default renderer doesn't work well with eps
% see e.g. http://stackoverflow.com/questions/8280971/matlab-and-high-quality-eps-figures
set(gcf, 'renderer', 'painters');

% To set tranparent background % Comment out in MATLAB 2016, transparent background doesn't
% work
set(gca,'Color','none'); % I updated the mapping toolbox and now transparency shows black in the screen
set(gcf, 'Color', 'none');
% set(gca,'Color','white')
% set(gcf, 'Color', 'white');

% % To change background color when running in MATLAB 2016
% fig = gcf;
% fig.Color = 'none'; %'white'; %if 'none', it looks black in screen but should be transparent in print
% fig = gca;
% fig.Color = 'none';

% Save in high resolution .eps using export_fig.m
% export_fig(filename,['-r',num2str(dpi),'-<painters>']); %,' -<OpenGL>']); %use for .eps
export_fig(filename,['-r',num2str(dpi),' -<OpenGL>']); %use OpenGL for transparency in boundedline.m to work
% export_fig(filename); %use this to save in MATLAB2016
end