0
votes

I am using iTextHandler to convert xml to pdf it creates pdf but does not open it and gives error pdf cannot be opened because it is already opened

Here is my code

string pdfFile = "PeerReview5" + ".pdf";

string strPath = Server.MapPath(Request.ApplicationPath.ToString() + "\12\") + pdfFile;

Document document = new Document();

PdfWriter.GetInstance(document, new FileStream(strPath, FileMode.Create));

document.Open();

ITextHandler xmlHandler = new ITextHandler(document);

xmlHandler.Parse(Server.MapPath("12\Peer_Review_Referral_Form_Template.xml"));

document.Close();

1

1 Answers

0
votes

From what I read in this post:

iTextSharp How include GenericTag using XML Parsing

You should get the latest version of iTextSharp:

http://sourceforge.net/projects/itextsharp/

Here is a post on of how to open the pdf in the browser:

opening PDF document from memory