Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta data added #272

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Source/lib/aztec/encoder/AztecEncodingOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

using System;
using System.ComponentModel;

using ZXing.Common;

Expand All @@ -30,6 +31,9 @@ public class AztecEncodingOptions : EncodingOptions
/// Representing the minimal percentage of error correction words.
/// Note: an Aztec symbol should have a minimum of 25% EC words.
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Standard"), DescriptionAttribute("The minimal percentage of error correction words (> 25%).")]
#endif
public int? ErrorCorrection
{
get
Expand Down Expand Up @@ -60,6 +64,11 @@ public int? ErrorCorrection
/// 0 indicates to use the minimum number of layers (the default)
/// a positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Standard"), DescriptionAttribute("The required number of layers for an Aztec code" +
" -1 to -4 specify a compact code, 0 indicates to use the minimum number of layers and" +
" 1 to 32 specify a normal (non-compact) Aztec code.")]
#endif
public int? Layers
{
get
Expand Down
18 changes: 18 additions & 0 deletions Source/lib/common/EncodingOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public class EncodingOptions
/// <summary>
/// Specifies the height of the barcode image
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Output dimensions"), DescriptionAttribute("Height in pixels.")]
#endif
public int Height
{
get
Expand All @@ -56,6 +59,9 @@ public int Height
/// <summary>
/// Specifies the width of the barcode image
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Output dimensions"), DescriptionAttribute("Width in pixels.")]
#endif
public int Width
{
get
Expand All @@ -75,6 +81,9 @@ public int Width
/// <summary>
/// Don't put the content string into the output image.
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Output options"), DescriptionAttribute("Output only barcode, no Human Readable Interpretation.")]
#endif
public bool PureBarcode
{
get
Expand All @@ -96,6 +105,11 @@ public bool PureBarcode
/// by format; for example it controls margin before and after the barcode horizontally for
/// most 1D formats.
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Output dimensions"), DescriptionAttribute("Specifies margin, in pixels, to use " +
"when generating the barcode. The meaning can vary by format; for example it controls margin " +
"before and after the barcode horizontally for most 1D formats.")]
#endif
public int Margin
{
get
Expand All @@ -116,6 +130,10 @@ public int Margin
/// Specifies whether the data should be encoded to the GS1 standard;
/// FNC1 character is added in front of the data
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Standard"), DescriptionAttribute("Specifies whether the data should be encoded " +
"to the GS1 standard; if so a FNC1 character is added in front of the data.")]
#endif
public bool GS1Format
{
get
Expand Down
15 changes: 15 additions & 0 deletions Source/lib/datamatrix/encoder/DatamatrixEncodingOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

using System;
using System.ComponentModel;

using ZXing.Common;
using ZXing.Datamatrix.Encoder;
Expand All @@ -30,6 +31,9 @@ public class DatamatrixEncodingOptions : EncodingOptions
/// <summary>
/// Specifies the matrix shape for Data Matrix
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Output options"), DescriptionAttribute("Specifies the matrix shape for Data Matrix.")]
#endif
public SymbolShapeHint? SymbolShape
{
get
Expand Down Expand Up @@ -57,6 +61,9 @@ public SymbolShapeHint? SymbolShape
/// <summary>
/// Specifies a minimum barcode size
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Standard"), DescriptionAttribute("Specifies a minimum barcode size.")]
#endif
public Dimension MinSize
{
get
Expand Down Expand Up @@ -84,6 +91,9 @@ public Dimension MinSize
/// <summary>
/// Specifies a maximum barcode size
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Standard"), DescriptionAttribute("Specifies a maximum barcode size.")]
#endif
public Dimension MaxSize
{
get
Expand Down Expand Up @@ -113,6 +123,11 @@ public Dimension MaxSize
/// Make sure that the content fits into the encodation value, otherwise there will be an exception thrown.
/// standard value: Encodation.ASCII
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Standard"), DescriptionAttribute("Specifies the default encodation." +
" Make sure that the content fits into the encodation value, otherwise there will be an exception thrown." +
" Standard value: Encodation.ASCII")]
#endif
public int? DefaultEncodation
{
get
Expand Down
6 changes: 5 additions & 1 deletion Source/lib/oned/Code128EncodingOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@
*/

using System;
using System.ComponentModel;

using ZXing.Common;

namespace ZXing.OneD
{
/// <summary>
/// The class holds the available options for the QrCodeWriter
/// The class holds the available options for the Code128 1D Writer
/// </summary>
[Serializable]
public class Code128EncodingOptions : EncodingOptions
{
/// <summary>
/// if true, don't switch to codeset C for numbers
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Standard"), DescriptionAttribute("If true, don't switch to codeset C for numbers.")]
#endif
public bool ForceCodesetB
{
get
Expand Down
230 changes: 230 additions & 0 deletions Source/lib/pdf417/PDF417EncodingOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
/*
* Copyright 2012 ZXing.Net authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System;
using System.ComponentModel;

using ZXing.Common;
using ZXing.PDF417.Internal;

namespace ZXing.PDF417
{
/// <summary>
/// The class holds the available options for the <see cref="PDF417Writer" />
/// </summary>
[Serializable]
public class PDF417EncodingOptions : EncodingOptions
{
/// <summary>
/// Specifies whether to use compact mode for PDF417 (type <see cref="bool" />).
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Output options"), DescriptionAttribute("Specifies whether to use compact mode.")]
#endif
public bool Compact
{
get
{
if (Hints.ContainsKey(EncodeHintType.PDF417_COMPACT))
{
return (bool)Hints[EncodeHintType.PDF417_COMPACT];
}
return false;
}
set { Hints[EncodeHintType.PDF417_COMPACT] = value; }
}

/// <summary>
/// Specifies what compaction mode to use for PDF417 (type
/// <see cref="Compaction" />).
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Standard"), DescriptionAttribute("Specifies what compaction mode to use.")]
#endif
public Compaction Compaction
{
get
{
if (Hints.ContainsKey(EncodeHintType.PDF417_COMPACTION))
{
return (Compaction)Hints[EncodeHintType.PDF417_COMPACTION];
}
return Compaction.AUTO;
}
set { Hints[EncodeHintType.PDF417_COMPACTION] = value; }
}

/// <summary>
/// Specifies the minimum and maximum number of rows and columns for PDF417 (type
/// <see cref="Dimensions" />).
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Standard"), DescriptionAttribute("Specifies the minimum and maximum number of rows and columns.")]
#endif
public Dimensions Dimensions
{
get
{
if (Hints.ContainsKey(EncodeHintType.PDF417_DIMENSIONS))
{
return (Dimensions)Hints[EncodeHintType.PDF417_DIMENSIONS];
}
return null;
}
set { Hints[EncodeHintType.PDF417_DIMENSIONS] = value; }
}

/// <summary>
/// Specifies what degree of error correction to use
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Standard"), DescriptionAttribute("Specifies what degree of error correction to use.")]
#endif
public PDF417ErrorCorrectionLevel ErrorCorrection
{
get
{
if (Hints.ContainsKey(EncodeHintType.ERROR_CORRECTION))
{
var value = Hints[EncodeHintType.ERROR_CORRECTION];
if (value is PDF417ErrorCorrectionLevel)
{
return (PDF417ErrorCorrectionLevel)value;
}
if (value is int)
{
return (PDF417ErrorCorrectionLevel)Enum.Parse(typeof(PDF417ErrorCorrectionLevel), value.ToString(), true);
}
}
return PDF417ErrorCorrectionLevel.L2;
}
set { Hints[EncodeHintType.ERROR_CORRECTION] = value; }
}

/// <summary>
/// Specifies the aspect ratio of the smallest codeword.
/// (Width of narrowest bar / Row Height)
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Output options"), DescriptionAttribute("Specifies the aspect ratio of the " +
"smallest codeword. (Width of narrowest bar / row height).")]
#endif
public PDF417AspectRatio AspectRatio
{
get
{
if (Hints.ContainsKey(EncodeHintType.PDF417_ASPECT_RATIO))
{
var value = Hints[EncodeHintType.PDF417_ASPECT_RATIO];
if (value is PDF417AspectRatio)
{
return (PDF417AspectRatio)value;
}
if (value is int)
{
return (PDF417AspectRatio)Enum.Parse(typeof(PDF417AspectRatio), value.ToString(), true);
}
}
return PDF417AspectRatio.A4;
}
set { Hints[EncodeHintType.PDF417_ASPECT_RATIO] = value; }
}

/// <summary>
/// Specifies the desired output image aspect ratio (Width / Height).
/// The actual aspect ratio is calculated based on the necessary number of codewords.
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Output options"), DescriptionAttribute("Specifies the desired output image aspect ratio (Width / Height)." +
"The actual aspect ratio is calculated based on the necessary number of codewords.")]
#endif
public float ImageAspectRatio
{
get
{
if (Hints.ContainsKey(EncodeHintType.PDF417_IMAGE_ASPECT_RATIO))
{
var value = Hints[EncodeHintType.PDF417_IMAGE_ASPECT_RATIO];
if (value is float)
{
return (float)value;
}
}
return PDF417.Internal.PDF417.DEFAULT_PREFERRED_RATIO;
}
set { Hints[EncodeHintType.PDF417_IMAGE_ASPECT_RATIO] = value; }
}

/// <summary>
/// Specifies what character encoding to use where applicable (type {@link String})
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Standard"), DescriptionAttribute("Specifies what character encoding to " +
"use where applicable.")]
#endif
public string CharacterSet
{
get
{
if (Hints.ContainsKey(EncodeHintType.CHARACTER_SET))
{
return (string)Hints[EncodeHintType.CHARACTER_SET];
}
return null;
}
set
{
if (value == null)
{
if (Hints.ContainsKey(EncodeHintType.CHARACTER_SET))
Hints.Remove(EncodeHintType.CHARACTER_SET);
}
else
{
Hints[EncodeHintType.CHARACTER_SET] = value;
}
}
}

/// <summary>
/// Explicitly disables ECI segment when generating PDF417 Code
/// That is against the specification but some
/// readers have problems if the charset is switched from
/// CP437 (default) to UTF-8 with the necessary ECI segment.
/// If you set the property to true you can use different encodings
/// and the ECI segment is omitted.
/// </summary>
#if !NETSTANDARD && !NETFX_CORE && !WindowsCE && !SILVERLIGHT && !PORTABLE && !UNITY
[CategoryAttribute("Standard"), DescriptionAttribute("Explicitly disables ECI segment when generating PDF417 Code." +
"That is against the specification but some readers have problems otherwise when switching charset to UTF-8.")]
#endif
public bool DisableECI
{
get
{
if (Hints.ContainsKey(EncodeHintType.DISABLE_ECI))
{
return (bool)Hints[EncodeHintType.DISABLE_ECI];
}
return false;
}
set
{
Hints[EncodeHintType.DISABLE_ECI] = value;
}
}
}
}
Loading