Last active
July 18, 2021 10:01
-
-
Save GroupDocsGists/bceca465883f710a35bf6c447f251634 to your computer and use it in GitHub Desktop.
Generate Barcode using C# - Add Barcodes to Documents and Images using Signature API for .NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generate and apply barcodes to documents (DOC, DOCX, PDF, PPT, XLS, XLSX, ...) | |
using (Signature signature = new Signature("path/document.pdf")) | |
{ | |
// Create barcode options with the barcode text | |
BarcodeSignOptions options = new BarcodeSignOptions("Signed by GroupDocs using GroupDocs.Signature.") | |
{ | |
// Set the Barcode Encoding Ttype | |
EncodeType = BarcodeTypes.Code128, | |
// Set Signature Position | |
Left = 205, | |
Top = 170, | |
Width = 200, | |
Height = 50 | |
}; | |
// Apply Barcode on document to Sign. | |
SignResult result = signature.Sign("path/document-with-barcode.pdf", options); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generate and apply barcodes to Images (JPG, PNG, BMP, ...) | |
using (Signature signature = new Signature("path/image.jpg")) | |
{ | |
// Create barcode options with the barcode text | |
BarcodeSignOptions options = new BarcodeSignOptions("Signed by GroupDocs using GroupDocs.Signature.") | |
{ | |
// Set the Barcode Encoding Ttype | |
EncodeType = BarcodeTypes.Code128, | |
// Set Signature Position | |
Left = 20, | |
Top = 150, | |
Width = 160, | |
Height = 30 | |
}; | |
// Apply Barcode on document to Sign. | |
SignResult result = signature.Sign("path/document-with-barcode.jpg", options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment