I am getting illegal characters in the path by using the below codes:
string fileNameExisting = Application.StartupPath + "\\CodesLocation\\Template.pdf";
PdfReader templateFile = new PdfReader(fileNameExisting);
I tested a few variations:
string fileNameExisting = @Application.StartupPath + "\CodesLocation\Template.pdf";
PdfReader templateFile = new PdfReader(fileNameExisting);
But it is still getting the same illegal error.
Can anyone help me see if my code if wrong?
Thanks.
I suggest using the appropriate way to join paths in .net: Path.Combine
So
Path.Combine(Application.StartupPath, "CodesLocation","Template.pdf");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With