How to convert PDF file to XML - c#

Can any body tell me how to convert pdf file to xml file.
I want to store resume in xml file, i.e. if any user upload the resume in pdf file then it will convert in xml file and in xml file only store some basic detail like name, address, education detail, etc.
please give me answer

you have to read the PDF file using itextsharp
after that filter your required information and then create a xml file using XML

Related

How Can I convert a uploaded pptx/ppt file to XML format in C# using OpenXML?

I have an application which allows uploading a ppt/pptx file. I want to convert the presentation file to equivalent XML format.
A pptx file is essentially a zip file, renamed to pptx. If you rename and extract the content you can find the xml document.
With ppt you have more problem as it is proprietary to Microsoft and may not even be publicly documented. Office automation would most probably work, but rather complicated.

How to acces the author name and other docx metadata

I want to use C# to get the metadata of a file, for example a docx.
In the screenshot below you see the auteur and other metadata of a file.
How do I write this metadata to the console?
A word file in DOCX is packaged as a zip file. The metadata is in an XML file within that zip file.
As a very simple way to think about it, this is what you would need to do programmatically through C#:
Unzip the DOCX file into it's folder structure.
Open the core.xml file located in the docProps folder of that structure.
Pull out and store the relevant XML elements that you are looking for, such as
title, subject or whatever.
Write those elements with Console.WriteLine().
Image Showing Structure and XML file
Info on Office Open XML format

Embbed an image in xml file

I am exporting some data from my database in xml format.
The file exported has an extension as .xml and it is viewed as Excel file.
I want to insert an image in this xml file so that when we view it as Excel we will be able to see the image along with the data.
Whatever I have found from the internet is that there is no straight forward way to insert an image in xml file as xml file were designed for handling the data.
Can any one tell me what is the approach I will have to follow in order to obtain the desired functionality.
xml files are text files, and you can embedd binary data if you encode it with Base64 algorithm.
But to view the image you will need to decode the Base64-string and pass the result binary data to an image viewer implementation.
It cannot be done in MS Excel. You will need to implement your own viewer.
You won't be able to view an image inside of an XML file unless you write a dedicated application for it that knows about your particular requirement.
The reason is that XML is character-based, but images are not - they are binary data. A way to embed your image nevertheless is to transform it to something character-based first. For example, you could Base64-encode your image first and embed the resulting string in your XML. But I suppose there is no way to tell Excel to interpret this data as an image right away.
Because embedding binary files into XML using Base64 is such a common idiom, XML Schema even has its own data type for this: base64Binary.

Using C# to display an XML file transformed by XSLT

I don't know if this is possible or if I am thinking about this in the wrong way, but this is what I want to do:
I have an XML file linked to an XSLT file and I want to use C# to get the output of the transformed XML file and Response.Write() that wherever I want on the page.
I have found questions on stackoverflow about saving the transformed output to a new file etc, but I don't want to save it to a file, I just want to display it with Response.Write() anywhere on my aspx page.
Is there any way to do this in C#?
Any help is appreciated.
Yes, save the transformed file to a MemoryStream (so in memory not the hard disk). You can then output that to a string using a filestrem reader.
Another way of doing it is by using the XML control, it has XML and XSLT properties.
You could save yourself the effort and simply serve up the XML to the browser. As long as the XML document references the URL of the corresponding XSLT document, the browser will render the page for you.
Use HttpResponse.OutputStream as output stream to save transformed file.

Convert .doc and .txt format file into pdf file for for .aspnet?

I really try to find on google how can we convert .doc and .txt file into pdf file but
not getting required answer or code.
I want any command line software of converter code which will provide code that convert above to format file into pdf file.
if any user upload upload .txt and .doc file then it will be convert into .pdf file in my application.
so need coversion code.
and after coverting into pdf when i clicked on it. it will be open into pdf in browser.
Need help and code and explanation to do it.
This topic (actually both topics - PDF generation and sending a PDF stream or file in the response) have been discussed quite a lot on SO. Just do a quick search for "asp net pdf generation".
Take a look at this article on code project, http://www.codeproject.com/KB/cs/convertdocintootherformat.aspx it shows how to convert a doc to rtf using C# you should be able to adapt this to convert to text

Categories