BstLabelPrinter 9.3.2
How to use
Import the folder "label-designer" present in ContentFiles to your vendors folder
Add automapper
services.AddAutoMapper(typeof(Program), typeof(BstLabelPrinter.LabelPrinter));
Add services
services.AddLabelPrinterServices();
Controller example
[HttpGet]
public IActionResult Create() {
return View("../Labels/LabelDesigner/Form");
}
[HttpGet("{id:int}")]
public async Task<IActionResult> Edit(int id) {
var model = await dbContext.Set<LabelTemplate>().FirstOrDefaultAsync(l => l.Id == id);
if (model == null) return NotFound();
return View("../Labels/LabelDesigner/Form", labelDesignerService.GetDto(model));
}
[HttpPost]
[ApiAction]
public async Task<IActionResult> Save(LabelTemplateDto dto) {
var returnValue = await labelDesignerService.SaveDto(dbContext, dto);
if (!returnValue.success) return BadRequest(returnValue.error);
if (dto.Id == null) return Ok(Url.Action(nameof(Edit), new { returnValue.id }));
return Ok("Template alterado com sucesso");
}
[HttpGet("{id:int}")]
public async Task<IActionResult> Duplicate(int id) {
var model = await dbContext.Set<LabelTemplate>().FirstOrDefaultAsync(a => a.Id == id);
if (model == null) return NotFound();
var duplicated = labelDesignerService.CloneTemplate(model);
duplicated.Name = $"{model.Name} - C�pia";
dbContext.Set<LabelTemplate>().Add(duplicated);
flashMessage.Success("Etiqueta duplicada com sucesso");
await dbContext.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
[HttpPost("{id:int}")]
public async Task<IActionResult> Delete(int id) {
var model = await dbContext.Set<LabelTemplate>().FirstOrDefaultAsync(a => a.Id == id);
if (model == null) return NotFound();
dbContext.Set<LabelTemplate>().Remove(model);
flashMessage.Success("Etiqueta apagada com sucesso");
dbContext.Set<LabelTemplate>().Remove(model);
await dbContext.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
View example
@section Style {
<link rel="stylesheet" type="text/css" href="~/vendors/label-designer/css/label-designer.css" asp-append-version="true" />
}
<div class="card">
<div class="card-header">Desenho de etiqueta</div>
<div class="card-body pb-3">
<div>
<div id="LabelDesigner"></div>
</div>
</div>
</div>
@section Scripts {
<script src="~/vendors/label-designer/js/label-designer.min.js" asp-append-version="true"></script>
<script type="text/javascript">
$(function () {
labelDesigner({
id: @(Model?.Id?.ToString(CultureInfo.InvariantCulture) ?? "null"),
cancelUrl: "@Url.Action(nameof(LabelDesignerController.Index), typeof(LabelDesignerController).GetControllerName())",
width: @(Model?.Width.ToString(CultureInfo.InvariantCulture) ?? "null"),
height: @(Model?.Height.ToString(CultureInfo.InvariantCulture) ?? "null"),
name: "@(Html.Raw(Model?.Name))",
containerId: "LabelDesigner",
textPlaceholders: @(Html.Raw(JsonConvert.SerializeObject(PrintingJobHelper.GetPlaceholders().Select(s=>new { name = s.description, value = s.placeholder}).OrderBy(s=>s.name)))),
code128Placeholders: @(Html.Raw(JsonConvert.SerializeObject(PrintingJobHelper.GetCode128Placeholders().Select(s => new { name = s.description, value = s.propertyName, ai = s.ai }).OrderBy(s => s.name)))),
data: @Html.Raw(JsonConvert.SerializeObject(Model, new JsonSerializerSettings {
ContractResolver = new CamelCasePropertyNamesContractResolver()
}
)),
beginCreate: function(){
showLoader();
},
beginEdit: function(){
showLoader();
},
saveUrl: "@Url.Action(nameof(LabelDesignerController.Save), typeof(LabelDesignerController).GetControllerName())",
createSuccess: function(data){
location.href = data;
hideLoader();
},
createError: function(xhr){
showMessage("Ocorreu um erro ao gravar", -1);
hideLoader();
},
editSuccess: function(data){
showMessage(data, 1);
hideLoader();
},
editError: function(xhr){
showMessage("Ocorreu um erro ao gravar", -1);
hideLoader();
},
});
});
</script>
}
No packages depend on BstLabelPrinter.
.NET 9.0
- AutoMapper (>= 14.0.0)
- BstBarCodes (>= 9.2.5)
- BstLogger (>= 9.0.7)
- Microsoft.EntityFrameworkCore (>= 9.0.3)
- Microsoft.EntityFrameworkCore.Abstractions (>= 9.0.3)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.3)
- Newtonsoft.Json (>= 13.0.3)
- System.Drawing.Common (>= 9.0.3)
| Version | Downloads | Last updated |
|---|---|---|
| 10.0.1 | 2 | 11/11/2025 |
| 9.5.8 | 1 | 20/10/2025 |
| 9.5.7 | 1 | 20/10/2025 |
| 9.5.6 | 3 | 15/10/2025 |
| 9.5.5 | 3 | 24/09/2025 |
| 9.5.4 | 4 | 06/09/2025 |
| 9.5.3 | 6 | 15/07/2025 |
| 9.5.2 | 6 | 12/06/2025 |
| 9.5.1 | 11 | 21/05/2025 |
| 9.5.0 | 8 | 21/05/2025 |
| 9.4.9 | 9 | 20/05/2025 |
| 9.4.8 | 9 | 15/05/2025 |
| 9.4.7 | 10 | 14/05/2025 |
| 9.4.6 | 10 | 07/05/2025 |
| 9.4.4 | 9 | 07/05/2025 |
| 9.4.3 | 9 | 07/05/2025 |
| 9.4.2 | 8 | 06/05/2025 |
| 9.4.1 | 10 | 10/04/2025 |
| 9.4.0 | 10 | 05/04/2025 |
| 9.3.9 | 10 | 04/04/2025 |
| 9.3.8 | 8 | 03/04/2025 |
| 9.3.7 | 8 | 03/04/2025 |
| 9.3.6 | 7 | 02/04/2025 |
| 9.3.5 | 8 | 28/03/2025 |
| 9.3.4 | 9 | 20/03/2025 |
| 9.3.3 | 6 | 19/03/2025 |
| 9.3.2 | 8 | 19/03/2025 |
| 9.3.1 | 12 | 17/02/2025 |
| 9.3.0 | 9 | 17/02/2025 |
| 9.0.1 | 8 | 17/02/2025 |