Just realised that all the PDFs that I got an error on have a space before the extension like "TestDocument .pdf".
That means when I create a directory of the name of the file, Windows trims any trailing spaces on the directory name but I still try to write to the directory name with a space in the end which does not actually exist and gives me this error. Apparently, it has nothing to do with Magick.NET and is a problem with my code.
That means when I create a directory of the name of the file, Windows trims any trailing spaces on the directory name but I still try to write to the directory name with a space in the end which does not actually exist and gives me this error. Apparently, it has nothing to do with Magick.NET and is a problem with my code.