This question was 
             closed Feb 11, 2020 at 12:38 PM by 
             destro22 for the following reason: 
             
 
            The question is answered, right answer was accepted
ItextSharp generates pdf file of 0 bytes in PC build. Works in editor.
I am using iTextSharp.dll to generate a pdf in PC build. Version: 2018.4.9f - OS 10 - Build:PC - C# - Visual Studio 2017 community
The pdf is being generated in editor as it should with the text I put in the script but after buiding for PC it generated a pdf with 0 Bytes. When it is opened it pops a dialog box saying file type not recognized or Damaged pdf. How do it achieve the same result in PC build? What am I missing?
In my scene I have a camera with c# script on it. Script has single method which is called when a UI button is pressed. Here is the code:
 using System.Collections.Generic;
 using System.Collections;
 using UnityEngine;
 using UnityEngine.UI;
 using System.IO;
 using iTextSharp.text;
 using iTextSharp.text.pdf;
 using System;
 
 
 
 
 
 public class Panel : MonoBehaviour
 {
 
    
   
     WaitForEndOfFrame frameEnd = new WaitForEndOfFrame();
 
    
                
     public void EnglishPdf()
     {
        
         FileStream fs = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.Desktop)+ "\\Test.pdf", FileMode.Create, FileAccess.Write, FileShare.None);
         Document doc = new Document(PageSize.A4);
         PdfWriter writer = PdfWriter.GetInstance(doc, fs);
         doc.Open();
 
         //Page0
         doc.NewPage();
        // PdfPTable page0 = new PdfPTable(2);
         Paragraph title = new Paragraph("Test PDF");
         title.Alignment = Element.ALIGN_CENTER;
        
         Chunk nameChunk = new Chunk("Name: "  + "\r\n");
         Chunk bday = new Chunk("Date of Birth: "  );
         doc.Add(title);
        // doc.Add(page0);
         doc.Add(nameChunk);
         doc.Add(bday);
        
         doc.Close();
 
     }
 
 }
 
 
              
               Comment