3

When I'm trying to create a pdf file on a specific file path, this exception is thrown.

N.B. I'm using iTextSharp 1.3.2 and .net Core 1.0

var physicalDocPath = "C:\\Users\\rajdeep\\Desktop\\testing.pdf";
var document = new Document(PageSize.A4, 50, 50, 50, 50);
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(physicalDocPath, FileMode.OpenOrCreate));
document.Open();
var parser = new XmlParser();
parser.Go(document, pdfContent);
document.Close();

The exception is thrown when I'm executing parser.Go() method.

poke
  • 369,085
  • 72
  • 557
  • 602
Raj
  • 417
  • 1
  • 3
  • 17
  • Have a look at this question: https://stackoverflow.com/q/24856821/2881450 This might give you a hint. – jHilscher Sep 11 '17 at 10:59
  • I have gone through it. As it says, "NotSupportedException will be thrown if the index of the : in your path is at the third position or later. (One would expect : to be the second character)". But I can not replace/remove ":" when I'm trying to access a particular drive "C: or D:". This is the part where I'm stuck.. – Raj Sep 11 '17 at 11:04
  • Why don't you go to the drive and try to give file name directly. It will avoid specifying : as part of the path. – Venkataraman R Sep 11 '17 at 22:36

0 Answers0