function [fig]=printpdf(filename)
% This works best to cut out white borders in pdfs 
fig = gcf;
fig.PaperPositionMode = 'auto';
fig_pos = fig.PaperPosition;
fig.PaperSize = [fig_pos(3) fig_pos(4)];

print([filename,'.pdf'],'-dpdf','-bestfit');

