edabg / jsprintsetup

JSPrintSetup Firefox addon
Mozilla Public License 2.0
76 stars 39 forks source link

FF 51.0.1 on OSX El Capitan: setPaperSizeData not working #37

Open h0jeZvgoxFepBQ2C opened 7 years ago

h0jeZvgoxFepBQ2C commented 7 years ago

Hi,

This is my code, and it's always selecting A4 in the print dialoge...

      jsPrintSetup.setShowPrintProgress(0);
      jsPrintSetup.clearSilentPrint();
      jsPrintSetup.setOption('printSilent', 0);
      jsPrintSetup.setOption('orientation', jsPrintSetup.kPortraitOrientation);
      jsPrintSetup.setOption('shrinkToFit', '1');
      // Reduce margins
      jsPrintSetup.setOption('unwriteableMarginTop', 10);
      jsPrintSetup.setOption('unwriteableMarginLeft', 0);
      jsPrintSetup.setOption('unwriteableMarginBottom', 0);
      jsPrintSetup.setOption('unwriteableMarginRight', 0);

      jsPrintSetup.setOption('marginTop',0);
      jsPrintSetup.setOption('marginBottom',0);
      jsPrintSetup.setOption('marginLeft',0);
      jsPrintSetup.setOption('marginRight',0);

      // Empty headers & footers
      jsPrintSetup.setOption('headerStrLeft', '');
      jsPrintSetup.setOption('headerStrCenter', '');
      jsPrintSetup.setOption('headerStrRight', '');
      jsPrintSetup.setOption('footerStrLeft', '');
      jsPrintSetup.setOption('footerStrCenter', '');
      jsPrintSetup.setOption('footerStrRight', '');

      //jsPrintSetup.definePaperSize(123, 123, 'FLAVE',  'FLAVE', 'FLAVE', #{(@print_setting.document_width * 100).round} , #{(@print_setting.document_height * 100).round }, jsPrintSetup.kPaperSizeMillimeters); 

      jsPrintSetup.setPaperSizeData(2);

      jsPrintSetup.saveOptions(jsPrintSetup.kSaveAll);
      jsPrintSetup.saveGlobalOptions(jsPrintSetup.kSaveAll);

      jsPrintSetup.print();

At first I tried to create my own paper size data, but it didn't work - always A4 is selected. But also the other (already existing) paper formats are not selected if I provide them via the setPaperSizeData method...

Any hints? Thanks!