Click here to Skip to main content
15,887,411 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi everyone,
I have one aspx page for generation pdf file from html using winnovative software.
It was working fine since 8 months..Dont know suddenly it is generating slowly and unable to take image from images folder..Can anyone who knows please help soon..Code something like this...
C#
PdfConverter pdfConverter = new PdfConverter();
pdfConverter.PdfDocumentOptions.ShowHeader = false;
 pdfConverter.PdfDocumentOptions.ShowFooter = false;
pdfConverter.ActiveXEnabled = true;
pdfConverter.AvoidImageBreak = true;
 pdfConverter.NavigationTimeout = 2147483647;
 pdfConverter.ScriptsEnabled = true;
 byte[] pdfBytes = pdfConverter.GetPdfBytesFromHtmlString(strBody);
Posted
Updated 3-Sep-13 2:29am
v3
Comments
[no name] 3-Sep-13 8:36am    
And what did the winnovative customer support people tell you when you asked them?
Radhika Vyas 4-Sep-13 0:52am    
They said 'You have to pass a baseURL parameter to GetPdfBytesFromHtmlString method.'
where as I am using strBody with strings being concatenated.like
string strBody = "<html><head><link href='http://www.ifso.com/css/style-pdf.css' rel='stylesheet' type='text/css' /><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head>" + "<body><div id='Main_div'> <div id='Main_div1'><div id='Main_div2'>";
strBody += "<table width='980' height='730' border='0' cellspacing='0' cellpadding='0'>";
strBody += "<tr><td colspan='2' class='Heading'>";
strBody += "INTERNATIONAL FEDERATION FOR THE SURGERY </td></tr>";
strBody += "<tr><td colspan='2' class='Heading1'>";
strBody += "The purposes of the International Federation for the Surgery of Obesity <br /> encourage research and the exchange of scientific information";
strBody += "in the field of obesity and surgery of obesity and metabolic disorders.</td></tr>";
strBody += "<tr><td height='130' colspan='2' align='center'><img src='http://www.ifso.com/images/membership-certificate-abi-chahine-logo.jpg' width='136' height='124' /></td></tr>";
strBody += "<tr><td colspan='2' class='certificate'>";
strBody += "This certifies that</td></tr>";
strBody += "<tr><td colspan='2' class='logo_header'>";
strBody += "</table>";
strBody += "</div></div></div></body></html>";
Its fine in local system...Its generating fine..but unable to get images and logos from server..
[no name] 4-Sep-13 10:10am    
Okay.... so why are you unable to follow their directions? Why are you asking here at all? Don't you think you would get a better response if you asked people that actually know about this product and then try what they said to do?

1 solution

This is the best i had ever used till now


[from google]

Here is some code(vb.net)
‘url of the page to be printed
fileToPrintURL = “www.somesite.com/pagename”
‘this will be the name of the file “.pdf” generated one
Dim filename As String = "Page" + TimeOfDay.Ticks.ToString() + ".pdf"
‘shared folder with write permissions and file name to be generated at which place
Dim filenameWithSharedPAth As String = Common.PDFSharedFolder + filename
‘create an object of process
Dim process As New Process
‘set some initails
process.StartInfo.UseShellExecute = False
process.StartInfo.CreateNoWindow = True
‘now the path of the exe downloaded from the link above
process.StartInfo.FileName = Server.MapPath("~/bin/PrintPDF/") + "wkhtmltopdf.exe"
‘and some arguments (based on req) as I need to pass it from authentication so user name and password
process.StartInfo.Arguments = "--username " + username + " --password " + password + " """ + fileToPrintURL + """ " + """" + filenameWithSharedPAth + """"
‘again some setting
process.StartInfo.RedirectStandardOutput = True
process.StartInfo.RedirectStandardError = True
‘start the process
process.Start()
‘end the process
process.WaitForExit()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900