Swaroop
Swaroop

Reputation: 21

To convert xml to pdf using itexthandler using Asp.Net?

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();

Upvotes: 0

Views: 1355

Answers (1)

Răzvan Flavius Panda
Răzvan Flavius Panda

Reputation: 22116

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

Upvotes: 0

Related Questions