Saturday, June 6, 2026

itext pdf technology in unity andriod failed


I’m utilizing itext libaray to create pdf in unity andriod. The script working tremendous within the editor however failing in anrdoid construct. right here is the a part of the log

pdf technology code

    Debug.Log("=====PDF GENERATION STARTED=====");
        // 1. Initialize PDF author and PDF doc
    PdfWriter author = new PdfWriter(savePath);
    Debug.Log("PDF Author initialized at: " + savePath);
    System.Runtime.CompilerServices.RuntimeHelpers
        .RunClassConstructor(typeof(iText.Commons.Utils.DIContainer).TypeHandle);
    Debug.Log("DIContainer cctor pressured");

    PdfDocument pdfDoc = new PdfDocument(author);
    Debug.Log("PDF Doc created efficiently.");

    // 2. Initialize structure Doc (Defaults to A4)
    Doc doc = new Doc(pdfDoc, PageSize.A4);
    Debug.Log("Format Doc initialized with A4 web page dimension.");

right here is the logouput. If you happen to can see that pdfdocument class is failing internally.
itext pdf technology in unity andriod failed

The errro is

2026/06/01 12:45:41.669 29785 29810 Error Unity
NullReferenceException: Object reference not set to an occasion of an
object. 2026/06/01 12:45:41.669 29785 29810 Error Unity at
iText.Commons.Utils.DIContainer.GetInstance[T] () [0x00000] in
<00000000000000000000000000000000>:0 2026/06/01 12:45:41.669 29785
29810 Error Unity at iText.Kernel.Pdf.PdfPagesTree..ctor
(iText.Kernel.Pdf.PdfCatalog pdfCatalog) [0x00000] in
<00000000000000000000000000000000>:0 2026/06/01 12:45:41.669 29785
29810 Error Unity at iText.Kernel.Pdf.PdfCatalog..ctor
(iText.Kernel.Pdf.PdfDictionary pdfObject) [0x00000] in
<00000000000000000000000000000000>:0 2026/06/01 12:45:41.669 29785
29810 Error Unity at iText.Kernel.Pdf.PdfDocument.Open
(iText.Kernel.Pdf.PdfVersion newPdfVersion) [0x00000] in
<00000000000000000000000000000000>:0 2026/06/01 12:45:41.669 29785
29810 Error Unity at iText.Kernel.Pdf.PdfDocument..ctor
(iText.Kernel.Pdf.PdfWriter author) [0x00000] in
<00000000000000000000000000000000>:0 2026/06/01 12:45:41.669 29785
29810 Error Unity at PdfGenerator.CreatePdfFromImages
(System.Collections.Generic.Checklist`1[T] imagePaths, System.String
pdfFileName, System.String ouputPath) [0x00000] in
<00000000000000000000000000000000>:0

i’ve explicitly added the meeting reference in linker. nonetheless the identical concern.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest Articles