This release of GroupDocs.Signature for .NET 24.7 (MSI) focuses on providing a more efficient and feature-rich experience for developers. The update enhances preview options and expands Code93 barcode functionality.
Modernized PreviewOptions
Class
Previously marked as obsolete, constructors within the PreviewOptions
class have been removed in this release of the .NET barcode processing API. To generate signature previews, developers can utilize the updated constructors as demonstrated in the provided code example.
public static void GeneratePreview()
{
// The path to the documents directory.
string filePath = Constants.SAMPLE_PDF;
using (Signature signature = new Signature(filePath))
{
// create preview options object
PreviewOptions previewOption = new PreviewOptions(GeneratePreview.CreatePageStream, GeneratePreview.ReleasePageStream)
{
PreviewFormat = PreviewOptions.PreviewFormats.JPEG,
};
// generate preview
signature.GeneratePreview(previewOption);
}
}
private static Stream CreatePageStream(PreviewPageData pageData)
{
string imageFilePath = Path.Combine(Constants.OutputPath, "GeneratePreviewFolder", "image-" + pageData.PageNumber.ToString() + ".jpg");
var folder = Path.GetDirectoryName(imageFilePath);
if (!Directory.Exists(folder))
{
Directory.CreateDirectory(folder);
}
return new FileStream(imageFilePath, FileMode.Create);
}
private static void ReleasePageStream(PreviewPageData pageData, Stream pageStream)
{
pageStream.Dispose();
string imageFilePath = Path.Combine(Constants.OutputPath, "GeneratePreviewFolder", "image-" + pageData.PageNumber.ToString() + ".jpg");
Console.WriteLine($"Image file {imageFilePath} is ready for preview");
}
Source*
Simplified Barcodes
For enhanced clarity, consistency, and alignment with industry standards, Code39Standard
and Code93Extended
have been consolidated into their base types, Code39 and Code93
, respectively, in the latest version of GroupDocs.Signature for .NET. Moreover, we have expanded the available barcode options by adding support for RectMicroQR
and MicroQR
types. Check out the following code example to learn how to use Code39
barcodes in your C# apps.
static BarcodeSignOptions GetBarcodeSignOptions()
{
BarcodeSignOptions result = new BarcodeSignOptions("123456789012", BarcodeTypes.Code39);
// alignment settings
result.Left = 100;
result.Top = 50;
result.Width = 200;
result.Height = 120;
result.AllPages = true;
result.PageNumber = 1;
result.PagesSetup = new PagesSetup() { FirstPage = true, LastPage = false, OddPages = true, EvenPages = false, PageNumbers = { 1, 2, 3 } };
result.HorizontalAlignment = Domain.HorizontalAlignment.Right;
result.VerticalAlignment = Domain.VerticalAlignment.Top;
// border settings
result.Border.Color = System.Drawing.Color.Red;
result.Border.DashStyle = GroupDocs.Signature.Domain.DashStyle.DashLongDash;
result.Border.Transparency = 0.8;
result.Border.Weight = 2;
result.Border.Visible = true;
// background settings
result.Background.Color = System.Drawing.Color.Yellow;
result.Background.Transparency = 0.5;
result.ForeColor = System.Drawing.Color.Green;
return result;
}
Source*
You can view the list of all new features, enhancements, and bug fixes introduced in this release by visiting GroupDocs.Signature for .NET 24.7 Release Notes.