Skip to main content
Skip table of contents

Option to disable AGPL-usage warning messages

When using iText 7 Core in AGPL mode (without loading an iText license) a message will occasionally be printed to the standard output.

You are using iText under the AGPL.

If this is your intention, you have published your own source code as AGPL software too.
Please let us know where to find your source code by sending a mail to agpl@itextpdf.com
We'd be honored to add it to our list of AGPL projects built on top of iText 7
and we'll explain how to remove this message from your error logs.

If this wasn't your intention, you are probably using iText in a non-free environment.
In this case, please contact us by filling out this form: http://itextpdf.com/sales
If you are a customer, we'll explain how to install your license key to avoid this message.
If you're not a customer, we'll explain the benefits of becoming a customer.


We added the option to disable these messages as demonstrated in the following code example.

Java

JAVA
import com.itextpdf.commons.actions.EventManager;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.element.Paragraph;

import java.io.ByteArrayOutputStream;

public class Main {
    public static void main(String[] args)  {
        //These two lines of code allow us to disable the AGPL warning messages
        EventManager eventManager = EventManager.getInstance();
        //Note that you acknowledge and agree with the AGPL license requirements when you call this method
        eventManager.acknowledgeAgplUsageDisableWarningMessage();

        // We are creating PDFs in a loop so that we can trigger the AGPL message
        for (int x = 0; x < 100000; x++) {
            PdfDocument pdfDocument = new PdfDocument(new PdfWriter(new ByteArrayOutputStream()));
            Document document = new Document(pdfDocument);
            document.add(new Paragraph("Hello world"));
            pdfDocument.close();
        }
    }
}


C#

C#
using iText.IO.Source;
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Layout.Element;

namespace Example
{
    class Program
    {
        static void Main(string[] args)
        {
            //These two lines of code allow us to disable the AGPL warning messages
            EventManager eventManager = EventManager.GetInstance();
            //Note that you acknowledge and agree with the AGPL license requirements when you call this method
            eventManager.AcknowledgeAgplUsageDisableWarningMessage();

            // We are creating PDFs in a loop so that we can trigger the AGPL message
            for (int x = 0; x < 100000; x++)
            {
                PdfDocument pdfDocument = new PdfDocument(new PdfWriter(new ByteArrayOutputStream()));
                Document document = new Document(pdfDocument);
                document.Add(new Paragraph("Hello world"));
                pdfDocument.Close();
            }
        }
    }
}


Note that disabling this message does not mean the AGPL requirements are also disabled! You are still running iText in AGPL mode, and as such you are still obliged to follow the AGPL license requirements.



#itext7 #7_2_3_example #agpl

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.