0

I'm attempting to use the solution outlined here for generating a pdf document from a view, but keep getting the "Illegal character in path" error when I get to this line:

var parsed = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(htmlRdr, null);

The view I am returning contains multiple partial views and uses a master page, if it helps. Any thoughts on how to protect the html during parsing?

Community
  • 1
  • 1
acullen72
  • 817
  • 2
  • 9
  • 19
  • @SLaks: ` at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str) at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath) ` – acullen72 Nov 04 '11 at 20:34

1 Answers1

0

Sometimes it need add an image provider:

pdfDoc.Open();
Dictionary<string, object> providers = new Dictionary<string, object> {};
providers.Add("img_baseurl", Request.Url.Scheme + "://" + 
Request.Url.Authority);
htmlparser.SetProviders(providers);
htmlparser.Parse(sr);
pdfDoc.Close();