I'm trying to print multiple PDF files using a multi-threaded service, using this code :
- Code: Select all
using (PdfDocument doc = new PdfDocument())
{
doc.LoadFromFile(pdf_file_name);
doc.PrintDocument.Print();
}
But it keeps giving me an error on doc.PrintDocument.Print(). The error is System.ArgumentException in mscorlib.dll "An element with the same key already exists".
If I do it one thread at a time, it works just fine. Does it means that this part (pdf file printing) isn't thread-safe?