File tree Expand file tree Collapse file tree 1 file changed +27
-10
lines changed
Expand file tree Collapse file tree 1 file changed +27
-10
lines changed Original file line number Diff line number Diff line change @@ -788,16 +788,33 @@ var jsPDF = (function(global) {
788788 // @TODO : Add different output options
789789 } ) ;
790790
791- if ( unit === 'pt' ) {
792- k = 1 ;
793- } else if ( unit === 'mm' ) {
794- k = 72 / 25.4 ;
795- } else if ( unit === 'cm' ) {
796- k = 72 / 2.54 ;
797- } else if ( unit === 'in' ) {
798- k = 72 ;
799- } else {
800- throw ( 'Invalid unit: ' + unit ) ;
791+ switch ( unit ) {
792+ case 'pt' :
793+ k = 1 ;
794+ break ;
795+ case 'mm' :
796+ k = 72 / 25.4 ;
797+ break ;
798+ case 'cm' :
799+ k = 72 / 2.54 ;
800+ break ;
801+ case 'in' :
802+ k = 72 ;
803+ break ;
804+ case 'px' :
805+ k = 96 / 72 ;
806+ break ;
807+ case 'pc' :
808+ k = 12 ;
809+ break ;
810+ case 'em' :
811+ k = 12 ;
812+ break ;
813+ case 'ex' :
814+ k = 6 ;
815+ break ;
816+ default :
817+ throw ( 'Invalid unit: ' + unit ) ;
801818 }
802819
803820 // Dimensions are stored as user units and converted to points on output
You can’t perform that action at this time.
0 commit comments