InfoPath 2007 form to PDF RRS feed

  • General discussion

  • Hi All,

    We have a requirement to convert current Infopath form to PDF and send as attachment in email once user click on Submit button.


    Form is Infopath 2007 code form +Browser based+it contains code and uploaded template in Central administration in MOSS 2007 environment.

    Once user fill the all fields and when user click on submit button, in email we need to send PDF as attachment.

    Can you give suggestions on how to convert Infopath to PDF.

    Thanks in advance!!!

    Thanks & Regards, Neerubee

    Tuesday, July 10, 2012 3:09 PM

All replies

  • Hi,

    There is no easy way...

    I have already acheve this by a conversion from HTML to PDF.

    You can use a Library (free or not) that convert the HTML to PDF. There is a lot of product like this : Winnovative, Aspose,...

    It is quite simple to convert your InfoPath Form to HTML by using C# code like this:

    string strHtml = string.Empty; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.PreserveWhitespace = true; xmlDoc.LoadXml(this.MainDataSource.CreateNavigator().OuterXml);

    // Name of the view in your infopath form

    Stream sXslStream = this.Template.OpenFileFromPackage("VuePrint.xsl"); XmlUrlResolver resolver = new XmlUrlResolver(); resolver.Credentials = System.Net.CredentialCache.DefaultCredentials; // transform the personnel.xml file to html XslTransform transform = new XslTransform(); // load up the stylesheet XmlReader xlsFile = XmlReader.Create(sXslStream); transform.Load(xlsFile, resolver); // on effectue la transformation dans une stream using (MemoryStream ms = new MemoryStream()) { transform.Transform(xmlDoc, null, ms, resolver); ms.Position = 0; StreamReader sr = new StreamReader(ms, System.Text.Encoding.Default); strHtml = sr.ReadToEnd(); sr.Close(); }

    Visit my blog : http://rmatayron.blogspot.com/

    Wednesday, July 11, 2012 5:24 AM
  • Hi Neerubee,

    Have you had a look at the PDF Converter for SharePoint? It contains extensive support for InfoPath to PDF Conversion. I works from the SharePoint UI, Workflows and even via your own web service calls. It provides all kinds of other InfoPath related facilities as well including conversion of attachments and dynamic view selection.

    For more details see:

    Please note that I wrote these posts so the usual disclaimers apply.

    Wednesday, July 11, 2012 2:06 PM