diff --git a/src/android/PrintOptions.java b/src/android/PrintOptions.java index e34b26f..e752e41 100644 --- a/src/android/PrintOptions.java +++ b/src/android/PrintOptions.java @@ -89,6 +89,7 @@ class PrintOptions { @NonNull PrintAttributes toPrintAttributes() { PrintAttributes.Builder builder = new PrintAttributes.Builder(); + Object margin = spec.opt("margin"); switch (spec.optString("orientation")) { @@ -112,7 +113,7 @@ class PrintOptions { } } - if (!spec.optBoolean("border", true)) + if (margin instanceof Boolean && !((Boolean) margin)) { builder.setMinMargins(NO_MARGINS); } diff --git a/src/ios/APPPrinterLayout.m b/src/ios/APPPrinterLayout.m index 6fc2214..2c67c95 100644 --- a/src/ios/APPPrinterLayout.m +++ b/src/ios/APPPrinterLayout.m @@ -36,10 +36,13 @@ NSDictionary *margin = spec[@"margin"]; - _contentInsets = UIEdgeInsetsMake([APPPrinterUnit convert:margin[@"top"]], - [APPPrinterUnit convert:margin[@"left"]], - [APPPrinterUnit convert:margin[@"bottom"]], - [APPPrinterUnit convert:margin[@"right"]]); + if ([margin isKindOfClass:NSDictionary.class]) + { + _contentInsets = UIEdgeInsetsMake([APPPrinterUnit convert:margin[@"top"]], + [APPPrinterUnit convert:margin[@"left"]], + [APPPrinterUnit convert:margin[@"bottom"]], + [APPPrinterUnit convert:margin[@"right"]]); + } _maximumContentWidth = [APPPrinterUnit convert:spec[@"maxWidth"]]; diff --git a/src/windows/PrinterProxy.js b/src/windows/PrinterProxy.js index e0fa74c..0bf05da 100644 --- a/src/windows/PrinterProxy.js +++ b/src/windows/PrinterProxy.js @@ -138,7 +138,7 @@ exports.onPrintTaskRequested = function (event) { spec.mediaType = Printing.PrintMediaType.photographic; } - if (config.border === false) { + if (config.margin === false) { spec.bordering = Printing.PrintBordering.borderless; }