Click here to Skip to main content
15,903,841 members
Home / Discussions / C#
   

C#

 
GeneralRe: Listbox colours. Pin
Septimus Hedgehog27-Feb-13 5:39
Septimus Hedgehog27-Feb-13 5:39 
Questioncan floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 6:01
notahack26-Feb-13 6:01 
AnswerRe: can floats be multiplied and come up with a fraction? Pin
Richard Deeming26-Feb-13 6:15
mveRichard Deeming26-Feb-13 6:15 
AnswerRe: can floats be multiplied and come up with a fraction? Pin
Richard MacCutchan26-Feb-13 6:26
mveRichard MacCutchan26-Feb-13 6:26 
AnswerRe: can floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 6:35
notahack26-Feb-13 6:35 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Richard Deeming26-Feb-13 7:39
mveRichard Deeming26-Feb-13 7:39 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 7:44
notahack26-Feb-13 7:44 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Richard Deeming26-Feb-13 8:03
mveRichard Deeming26-Feb-13 8:03 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 8:13
notahack26-Feb-13 8:13 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Dave Kreskowiak26-Feb-13 9:03
mveDave Kreskowiak26-Feb-13 9:03 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Dave Kreskowiak26-Feb-13 8:58
mveDave Kreskowiak26-Feb-13 8:58 
QuestionC# EF5 List<ENum> Persisting ? Pin
Khorne26-Feb-13 4:01
Khorne26-Feb-13 4:01 
AnswerRe: C# EF5 List<ENum> Persisting ? Pin
Ssyxz26-Feb-13 15:14
Ssyxz26-Feb-13 15:14 
GeneralRe: C# EF5 List<ENum> Persisting ? Pin
Khorne26-Feb-13 20:41
Khorne26-Feb-13 20:41 
AnswerRe: C# EF5 List<ENum> Persisting ? Pin
Jegan Thiyagesan27-Feb-13 6:42
Jegan Thiyagesan27-Feb-13 6:42 
QuestionNeed code Pin
jelintaric25-Feb-13 22:41
jelintaric25-Feb-13 22:41 
AnswerRe: Need code Pin
Manfred Rudolf Bihy25-Feb-13 23:06
professionalManfred Rudolf Bihy25-Feb-13 23:06 
AnswerRe: Need code Pin
Mycroft Holmes25-Feb-13 23:43
professionalMycroft Holmes25-Feb-13 23:43 
AnswerRe: Need code Pin
Amir Mohammad Nasrollahi29-Jul-13 21:33
professionalAmir Mohammad Nasrollahi29-Jul-13 21:33 
Questionformatting issue with iTextSharp Pin
krishnapnv25-Feb-13 19:10
krishnapnv25-Feb-13 19:10 
Hello

I have a requirement to write pdfdocument using html contents in an ASP.NET MVC Project. I am writing the HTML code inside a string variable and then I am giving that string for rendering it as pdf bytes using the below code. The returned bytes I am saving it as pdf on the server. However I am getting too many formatting issues in the pdf generated.

When I saved the html contents which I passed to the string, formattings are good but somehow when I am trying to create a pdf out of those contents I am getting issues. Any help will be greatly appreciated.
public byte[] Render(string htmlText)
{
byte[] renderedBuffer;


using (var outputMemoryStream = new MemoryStream())
{
using (var pdfDocument = new Document())
{
PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDocument, outputMemoryStream);
pdfWriter.CloseStream = false;
//pdfWriter.PageEvent = new PrintHeaderFooter { Title = pageTitle };
pdfDocument.Open();
using (var htmlViewReader = new StringReader(htmlText))
{
using (var htmlWorker = new HTMLWorker(pdfDocument))
{
htmlWorker.Parse(htmlViewReader);
}
}
}

renderedBuffer = new byte[outputMemoryStream.Position];
outputMemoryStream.Position = 0;
outputMemoryStream.Read(renderedBuffer, 0, renderedBuffer.Length);
}

return renderedBuffer;
}
QuestionRe: formatting issue with iTextSharp Pin
Richard MacCutchan25-Feb-13 21:55
mveRichard MacCutchan25-Feb-13 21:55 
AnswerRe: formatting issue with iTextSharp Pin
krishnapnv28-Feb-13 18:03
krishnapnv28-Feb-13 18:03 
Questionexport or save as pdf format Pin
abhishek91111925-Feb-13 17:50
abhishek91111925-Feb-13 17:50 
AnswerRe: export or save as pdf format Pin
Pete O'Hanlon25-Feb-13 20:02
mvePete O'Hanlon25-Feb-13 20:02 
AnswerRe: export or save as pdf format Pin
Abhinav S25-Feb-13 20:22
Abhinav S25-Feb-13 20:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.