Html To Pdf C Itextsharp

Active7 years, 2 months ago

i have to read pdf and create html document.. for uploaded cv in my site.. i can not use any shareware.please can anybody suggest me the best solution for converting pdf to html..or read pdf content using C#

Basic PDF Creation Using iTextSharp - Part I. To create a PDF document, create an instance of the class Document and pass the page size and the page margins to the constructor. Then use that object and the file stream to create the PdfWriter instance enabling us to output text and other elements to the PDF file. Apr 23, 2013  Searches related to create pdf file c# create doc file c# create pdf file java create html c# c# itextsharp create pdf create pdf asp.net c# using itextsharp itextsharp tutorial c# itextsharp text. Nov 02, 2016  HTMLWorker is deprecated and not supported anymore. Since you use the latest version, you'll find its replacement, XMLWorker. – Alexis Pigeon Aug 22 '13 at 11:30. ASP.NET – Convert PDF to TXT (Plain-Text) or HTML in C# with iTextSharp An useful C# code snippet to convert PDF files into TXT plain-text or HTML in C# with iTextSharp, an open-source PDF management library for ASP.NET. Converting PDF layout to HTML layout is very hard because the PDF design philosophy is very different from how HTML layouting works. Google has some sort of solution for it but it will usually break layout. Regarding your CV concept: As CV layout is highly important for customers using a site I would not want to auto-convert PDF CVs to HTML CVs.

site is developed in C#, asp.net 3.5

RadhiRadhi
3,49912 gold badges36 silver badges57 bronze badges

closed as not a real question by WillOct 28 '12 at 20:44

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

4 Answers

i got one code from here

and downlaoded itextsharp dll

and this code worked fine.. only one problem i faced.. that my most of files are converted into text or html or whatever frmat i want.. but only 1 file i am not able to convert.. if anybody can use this code and help me to find out what is the proble.. i'll be thankful to him/her.

/up6-15c-125-manual.html. you can see code here..

i am getting error 'Index out of range' in function

CheckToken

Community
RadhiRadhi
3,49912 gold badges36 silver badges57 bronze badges

Html To Doc

You could use something like pdftotext as outlined in the following article: How To Convert Pdf file to text in asp.net

GalwegianGalwegian
38.1k14 gold badges102 silver badges155 bronze badges

Depends on what you want to do. Converting pdfs to plain text without formatting can be done with pdftotext or similar solutions. Converting PDF layout to HTML layout is very hard because the PDF design philosophy is very different from how HTML layouting works. Google has some sort of solution for it but it will usually break layout.

Regarding your CV concept: As CV layout is highly important for customers using a site I would not want to auto-convert PDF CVs to HTML CVs. What pdftotext can offer you is a plain text where a CV search engine can find parts of the CV.

Thorsten79Thorsten79
8,8645 gold badges31 silver badges51 bronze badges

you may convert pdf to image with ghostscript and c# and then publish image on site. for details see this article

necrostaznecrostaz

Not the answer you're looking for? Browse other questions tagged c#asp.netpdf or ask your own question.

Active1 year, 6 months ago

I am working in asp.net with C# website. I want to convert a HTML DIV which contains various html elements like divs,label, tables and images with css styles(background color, cssClass etc) and I want its whole content to be converted into PDF using iTextSharp DLL but here I am facing a issue that css is not getting applied.Can any one help me by providing any example or code snippet.

SupermanSuperman

2 Answers

Install 2 NuGet packages iTextSharp and itextsharp.xmlworker and use the following code:

Sergey MalyutinSergey Malyutin
8681 gold badge13 silver badges33 bronze badges

Check out Pechkin, a C# wrapper for wkhtmltopdf.

Specifically at this point in time (considering a pending pull request) I'd check out this fork that addresses a couple of bugs (particularly helpful in IIS based on my experience).

If you don't go with the fork / get other stability issues you may want to look at having some kind of 'render queue' (e.g. in a database) and have a background process (e.g. Windows service) periodically run over the queue and render then store the binary content somewhere (either in database as well, or on file system). This depends entirely on your use-case though.

Alternatively the similar solution @DaveDev has comment linked to.

Community

C# Convert Html To Pdf Itextsharp

Matt MitchellMatt Mitchell
25.3k34 gold badges106 silver badges175 bronze badges

Convert Html To Pdf

Not the answer you're looking for? Browse other questions tagged c#htmlasp.netcssitextsharp or ask your own question.