I'm am trying to create a PDF with IText7 for C# and everything works fine, there is only this bug where sometimes 2 PDF's are created instead of one. It doesn't happen every time so my guess is it isn't a problem with my code but rather with IText7. I didn't really find anything about this issue online. Anybody know why this happens?
Just to be sure, a snippet of my code:
private const String Dest = "c://pdfs/";
public static void CreateFirstPaymentReminderPdf(FirstPaymentReminder values)
{
String location = Dest + "FirstPaymentReminder_"+ DateTime.Now.ToString("dMyyhhmmss")+".pdf";
FileInfo file = new FileInfo(location);
if (file.Directory != null && !file.Directory.Exists) file.Directory.Create();
//Initialize PDF writer
PdfWriter writer = new PdfWriter(location);
//Initialize PDF document
PdfDocument pdf = new PdfDocument(writer);
// Initialize document
Document document = new Document(pdf);
document.SetMargins(100f,75f,100f,75f);
//create text
//-- leaving this out for privacy reasons --
//Close document
document.Close();
}