Allow margin:false
as a shortcut for no margins
This commit is contained in:
parent
6b4972918e
commit
82ba5c4a59
@ -89,6 +89,7 @@ class PrintOptions {
|
|||||||
@NonNull PrintAttributes toPrintAttributes()
|
@NonNull PrintAttributes toPrintAttributes()
|
||||||
{
|
{
|
||||||
PrintAttributes.Builder builder = new PrintAttributes.Builder();
|
PrintAttributes.Builder builder = new PrintAttributes.Builder();
|
||||||
|
Object margin = spec.opt("margin");
|
||||||
|
|
||||||
switch (spec.optString("orientation"))
|
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);
|
builder.setMinMargins(NO_MARGINS);
|
||||||
}
|
}
|
||||||
|
@ -36,10 +36,13 @@
|
|||||||
|
|
||||||
NSDictionary *margin = spec[@"margin"];
|
NSDictionary *margin = spec[@"margin"];
|
||||||
|
|
||||||
_contentInsets = UIEdgeInsetsMake([APPPrinterUnit convert:margin[@"top"]],
|
if ([margin isKindOfClass:NSDictionary.class])
|
||||||
[APPPrinterUnit convert:margin[@"left"]],
|
{
|
||||||
[APPPrinterUnit convert:margin[@"bottom"]],
|
_contentInsets = UIEdgeInsetsMake([APPPrinterUnit convert:margin[@"top"]],
|
||||||
[APPPrinterUnit convert:margin[@"right"]]);
|
[APPPrinterUnit convert:margin[@"left"]],
|
||||||
|
[APPPrinterUnit convert:margin[@"bottom"]],
|
||||||
|
[APPPrinterUnit convert:margin[@"right"]]);
|
||||||
|
}
|
||||||
|
|
||||||
_maximumContentWidth = [APPPrinterUnit convert:spec[@"maxWidth"]];
|
_maximumContentWidth = [APPPrinterUnit convert:spec[@"maxWidth"]];
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ exports.onPrintTaskRequested = function (event) {
|
|||||||
spec.mediaType = Printing.PrintMediaType.photographic;
|
spec.mediaType = Printing.PrintMediaType.photographic;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.border === false) {
|
if (config.margin === false) {
|
||||||
spec.bordering = Printing.PrintBordering.borderless;
|
spec.bordering = Printing.PrintBordering.borderless;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user