Datamatrix watermark

test.docx (15.7 KB)

test.pdf (19.2 KB)

test.docx (15.7 KB)

Hello,

When I convert word to pdf file I have a “Evaluation” watermak on my Datamatrix but I use a Aspsose.total License. My QRCode works.

Could you help me ?

Imports System
Imports System.IO
Imports System.Timers
Imports System.Net
Imports System.Xml
Imports System.IO.Compression
Imports System.CodeDom.Compiler
Imports TESTOPM.AIRS
<a class="attachment" href="/uploads/default/101082">test.docx</a> (15.7 KB)



Module Module1

    Sub Main()

        Dim LicWords As New Aspose.Words.License
        LicWords.SetLicense("C:\OPM\DLL\lic.lic")
        Dim LicPDF As New Aspose.Pdf.License
        LicWords.SetLicense("C:\OPM\DLL\lic.lic")
        Dim LicBC As New Aspose.BarCode.License
        LicBC.SetLicense("C:\OPM\DLL\lic.lic")
        Dim AsposeWord = New Aspose.Words.Document("X:\NPA\fichier-word-webai\licence-full\test.docm")
        'Ouvre le document
        AsposeWord.FieldOptions.BarcodeGenerator = New CustomBarcodeGenerator()

        'Dim gen As New Aspose.BarCode.Generation.BarcodeGenerator(Aspose.BarCode.Generation.EncodeTypes.DataMatrix, "123456789")

        AsposeWord.Save("X:\NPA\fichier-word-webai\licence-full\test.pdf", Aspose.Words.SaveFormat.Pdf)

    End Sub

End Module


Public Class CustomBarcodeGenerator


    Implements Aspose.Words.Fields.IBarcodeGenerator

    Private Shared Function ConvertColor(ByVal inputColor As String) As System.Drawing.Color
        Dim color As Integer = Integer.MinValue

        Integer.TryParse(inputColor.Replace("0x", ""), color)

        If color = Integer.MinValue Then

            Throw New Exception("Error! Incorrect color - " & inputColor & ".")
        Else
            Return System.Drawing.Color.FromArgb((color + 16), ((color And 65280) + 8), (color And 255))
        End If


    End Function

    Private Function IBarcodeGenerator_GetBarcodeImage(parameters As Aspose.Words.Fields.BarcodeParameters) As System.Drawing.Image Implements Aspose.Words.Fields.IBarcodeGenerator.GetBarcodeImage

        If parameters.BarcodeType Is Nothing OrElse parameters.BarcodeValue Is Nothing Then Return Nothing

        Dim type As String = parameters.BarcodeType.ToUpper()

        Dim encodeType = Aspose.BarCode.Generation.EncodeTypes.None

        Select Case type
            Case "QR"
                encodeType = Aspose.BarCode.Generation.EncodeTypes.QR
            Case "CODE128"
                encodeType = Aspose.BarCode.Generation.EncodeTypes.Code128
            Case "CODE39"
                encodeType = Aspose.BarCode.Generation.EncodeTypes.Code39Standard
            Case "EAN8"
                encodeType = Aspose.BarCode.Generation.EncodeTypes.EAN8
            Case "EAN13"
                encodeType = Aspose.BarCode.Generation.EncodeTypes.EAN13
            Case "UPCA"
                encodeType = Aspose.BarCode.Generation.EncodeTypes.UPCA
            Case "UPCE"
                encodeType = Aspose.BarCode.Generation.EncodeTypes.UPCE
            Case "ITF14"
                encodeType = Aspose.BarCode.Generation.EncodeTypes.ITF14
            Case "DATAMATRIX"
                encodeType = Aspose.BarCode.Generation.EncodeTypes.DataMatrix
            Case "CASE"
                encodeType = Aspose.BarCode.Generation.EncodeTypes.None
        End Select

        If encodeType.Equals(Aspose.BarCode.Generation.EncodeTypes.None) Then Return Nothing

        Dim generator As New Aspose.BarCode.Generation.BarcodeGenerator(encodeType)

        generator.CodeText = parameters.BarcodeValue

        If encodeType.Equals(Aspose.BarCode.Generation.EncodeTypes.QR) Then generator.Parameters.Barcode.CodeTextParameters.TwoDDisplayText = parameters.BarcodeValue

        If parameters.ForegroundColor IsNot Nothing Then generator.Parameters.Barcode.BarColor = ConvertColor(parameters.ForegroundColor)

        If parameters.BackgroundColor IsNot Nothing Then generator.Parameters.BackColor = ConvertColor(parameters.BackgroundColor)

        generator.Parameters.Barcode.CodeTextParameters.Location = Aspose.BarCode.Generation.CodeLocation.None
        generator.Parameters.Barcode.QR.QrVersion = Aspose.BarCode.QRVersion.Version01
        generator.Parameters.AutoSizeMode = Aspose.BarCode.Generation.AutoSizeMode.None '.Interpolation
        generator.Parameters.Barcode.Padding.Left.Point = 3
        generator.Parameters.Barcode.Padding.Top.Point = 3
        generator.Parameters.Barcode.Padding.Right.Point = 3
        generator.Parameters.Barcode.Padding.Bottom.Point = 3
        generator.Parameters.ImageWidth.Point = CInt(parameters.ScalingFactor) - 6
        generator.Parameters.ImageHeight.Point = CInt(parameters.ScalingFactor) - 6

        Return generator.GenerateBarCodeImage()


    End Function


    Private Function IBarcodeGenerator_GetOldBarcodeImage(parameters As Aspose.Words.Fields.BarcodeParameters) As System.Drawing.Image Implements Aspose.Words.Fields.IBarcodeGenerator.GetOldBarcodeImage
        Throw New NotImplementedException()
    End Function
End Class


@Paga16 There is a mistake in your code:

But since the problem occurs with Aspose.Barcode, I will move your topic to Aspose.Barcode category. My colleagues will help you shortly.

Yes, thank you so much even if I don’t need Aspose.PDf in my case.

@Paga16,

You are using both Aspose.Words and Aspose.BarCode to generate and render barcode on the fly. I am not sure if the issue is with Aspose.BarCode for .NET API or something else. To evaluate your issue precisely regarding Aspose.BarCode, could you please create a sample console application using only Aspose.BarCode for .NET API in which you set the license for Aspose.BarCode and generate barcode image if you still find the issue (evaluation watermark on the Datamatrix barcode)? Please zip the VS.NET project (with all the resource files but please do not include your license file in the archive) and provide us to reproduce the issue regarding Aspose.BarCode, we will check it soon.

Hello,

When I only use barecode licence to generate a Datamatrix, I have no evaluation watermark. So the problem come from Aspose.Words ?

Regards

datamatrix.png (319 Bytes)

    Dim LicBC As New Aspose.BarCode.License
    LicBC.SetLicense("C:\OPM\DLL\licence.lic")

    Dim gen As New Aspose.BarCode.Generation.BarcodeGenerator(Aspose.BarCode.Generation.EncodeTypes.DataMatrix, "ASPOSE")
    gen.Parameters.AutoSizeMode = Aspose.BarCode.Generation.AutoSizeMode.None
    gen.Parameters.ImageWidth.Pixels = 300
    gen.Parameters.ImageHeight.Pixels = 300
    gen.Parameters.Barcode.XDimension.Pixels = 3
    gen.Save("X:\datamatrix.png", Aspose.BarCode.BarCodeImageFormat.Png)

@Paga16,

So, it issue of evaluation watermark on the barcode (image) is not related to Aspose.BarCode. The best approach for you is to post your issue in the Aspose.Words forum, providing all the necessary details and resource files. Additionally, it is recommended to create a separate console project/app using the Aspose.Words API only, set the license for Aspose.Words, and render/manipulate the (barcode) image to reproduce the issue. This will allow the Aspose.Words team to evaluate your issue precisely and provide appropriate assistance.