InfoPath Form URL TO PDF using C# - c#

I want to convert inforpath to pdf.
I have the url and have an access to the hosted place like :
http://hostserver/PWA/_layouts/15/FormServer.aspx?XmlLocation=/PWA/InfoPath%20Title.xml
Is there a way to read the InfoPath form as xml and converting it to pdf ?

You have to download and parse content of the URL to an object via: XElement, HtmlAgilityPack then create PDF file e.g. using TextWriter.

Depends on how and where you want to deal with it, ABCPdf,ItextSharp along with many other third party tools available let you handle the conversion on server side.
You can use jspdf or equivalent to do it on client side, analyse what you need and choose your tool.

Related

Download contents of html text area tag as word or pdf file in c#

I am working on a ASP .NET project where the requirement is to download a text area content as a file like .doc, .pdf and .txt.
I know we can download the plain text of text area as .txt using java script but the thing I want to know is,
How can I achieve the same for .doc and .pdf
is there any java script/jquery way to achieve this if not then what is the right way to do this in native C#.
examples or links would be great.
PDF and Word Documents are complex file types. If you want to generate these files client side, you'll need a javascript library that can generate files in these formats. I don't think these exist (as this is an uncommon request), but you can google it.
If I would be faced with a problem like this, I would post the value of the textbox back to the server and generate the files on the server. This SO post discusses how to create a pdf file in C#: How to generate a PDF?
Once you have created the file server side, you can then send it back to the client.

.NET PDF Library that can wait for javascript to execute before generatign a PDF file

I am looking for an alternative to ABC PDF. We currently use ABC PDF in a way I haven't seen in other libraries.
would like to create a pdf file from a url that has client side javascript to retrieve data. I need to wait for this data to load before I create the PDF file. ABC.PDF does this by applying a client side handle and waits until this is set to true before processing the html.
It would also be a plus if we were able to inject some javascript into the url source to run, this is less important though.
are there any other .NET libraries out there that has functionality similar to this.
I have investigated ITextSharp and found that does not offer what I am looking for.
I have also looked into Essential Objects PDF and although this comes close, again does not achieve what I am looking for.
Aspose PDF is another I have looked into and see I cant do as I describe.

editable word document attachment

Its a general scenario when we provide an option of attaching a file (MS .doc) to end user. This file is stored in DB as binary. When user try to access this attachment next time, we allow them to download it. Now, here I want to give a feature to user where he should be able to open this doc file on click, edit it and save it without downloading.
.doc is a binary format and not easy to work with - a library such as Aspose, as mentioned by Christian, is definitely the way to go.
However, if .DOCX is acceptable (and that's Office 2007 and higher), then you can achieve what you want in three steps:
Convert .docx to HTML
Convert Word to HTML then render HTML on webpage
Display the HTML using any rich text control of your choice
What is the best rich textarea editor for jQuery?
Finally, convert HTML back to .docx:
Convert Html to Docx in c#
You would have to "reinvent" Microsoft Office Online (look into your skydrive account). I am unsure if there are any "out of the box" libraries for that, but you could build a simple editing app by leveraging Aspose word (or some other library). But that would be far from simple.
Link to aspose: http://www.aspose.com/.net/word-component.aspx
Word will only open files that are locally stored. What you are looking for is something similar to editing items that SharePoint provides using the WebDAV interface.
You may be able to use this approach to support your requirement. You should be cautious about the security aspects of the solution unless you have fully authenticated access to the shared folder on the server.
I am not sure if a standalone MS Word Document editor exists. However, this can be done with using a combination of rich text formatting / converting tool (for example, the DevExpress ASPxHtmlEditor + Document Server):
Load binary data from a DB;
Import loaded data (MS Word content) as HTML content into the ASPxHtmlEditor;
Edit imported data via the WYSIWYG ASPxHtmlEditor;
Convert the edited HTML back to MS Word content;
Save the converted / edited MS Word content back to the DB.
I believe, it is possible to do something like this if you have such products (free or commercial analogs) in your project.

Read CSV file selected at client side in C# through AJAX?

I have a requirement in which user will select a CSV file locally, I have to read the file contents and dump them on a JQGrid. Yes, the browser is IE :)..What should I do in order to achieve this?
Actually you can do that with the all new HTML5 features, so if you are going for IE9+
http://www.html5rocks.com/en/tutorials/file/dndfiles/
Check this out.
Basically, you need the FileReader component (FileReader.readAsText(Blob|File, opt_encoding)) and then just parse everything with regexps or whatever floats your goat.
If, you definetely need to do this in client side AND in older IE, maybe ActiveX is a solution:
ActiveX' FileSystemObject
I would do it server side.
http://www.codeproject.com/Articles/9258/A-Fast-CSV-Reader
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx
(FileUploadControl.OpenFile)
Barring that you are not capable of using HTML 5 (lower version of ie etc.):
Javascript can't access the file system directly, so you are going to have to use the file upload tag and parse it on the server: http://webdesign.about.com/od/htmltags/p/input-file-tag.htm
You can then use AJAX to query the contents and pull it back down into the grid.

C# create pdf documents with no need of High permissions on the server

I have a C# proyect where I need to create a pdf document. I did it using the iTextSharp dll but when I ran it on the server it didn't work. It seems that the dll needs higher permissions than the one I have on my shared server.
Is there any other free way to do this? I'm trying to create the pdf from a grid I have, I don't care how I create the document (from html, code behind, etc) as long as it works.
does anybody know how to do this?
regards!
iTextSharp is just an assembly the contains an API for generating PDF's. It does not require any more privileges than your ASP.NET application.
Are you by chance trying to write the PDF to disk? Your ASP.NET process may not have write access to the location you are writing to.
I would suggest a better way is to output the PDF directly to the Response stream, assuming you are returning the PDF to the web user.

Categories