.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

problem when converting html to pdf using ItextSharp

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net

 hi all

i have using itextsharp to convert html to pdf and its worked very good in english letters (A-Z) but when i trying to do it with arabic letters i have got empty pdf , can any one help me? what i should do ?

View Complete Post

More Related Resource Links

ItextSharp Help: converting html to pdf


'Create Document class object and set its size to letter and give space left, right, Top, Bottom Margin



Dim doc As New Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35)Try



Dim wri As PdfWriter = PdfWriter.GetInstance(doc, New FileStream(Server.MapPath("~\Documents\Quotation.pdf"), FileMode.Create))'Open Document to write


Embed Youtube inside Ajax Html Editor- problem



When inserting a simple embed of youtube inside the ajax editor, on firefox and chrome problems occur. On the other hand on internet explorer 8 everything works fine. I found this solution http://www.nopcommerce.com/boards/t/4228/bug-in-ajax-html-editor.aspx . 

My question is where do I find the DesignPanel.pre.js ?


Roderick Vella

System.Net.Mail HTML Template Problem


What do I need here ?????? To make this work??

Dim MassMail As New MailMessage()

        Dim Template As ??????????????

        MassMail.To.Add(New MailAddress(TextBox_massemailto.Text))
        MassMail.From = New MailAddress("You@me.com")

        ' MassMail.CC.Add()
        MassMail.Subject = TextBox_massemailsubject.Text
        MassMail.Body = TextBox_massemailBody.Text
        ' MassMail.Body = Template.BodyFileName = "EmailTemplates/BusinessAdBrochure.htm"
        MassMail.Priority = MailPriority.High

        Dim smtpclient As New SmtpClient("relay-hosting.secureserver.net")
        smtpclient.Credentials = New System.Net.NetworkCredential(""You@me.com"", "pasword")
        smtpclient.Port = 25
        smtpclient.EnableSsl = False

Convert html to pdf using iTextSharp


can anyone provide me a sample code who have used iTextsharp(chapter 0707) to convert HTML to PDF.... Please help.... urgent...!!!

POST from html form viewstate problem

<p> Hi all, I have a website where people need to pay for a specific download (.pdf file). After they payed they get the download(A). My payment-provider can do a HTML-Postback to the site i want, for each succesfull payment. So the idea is that if someone payed, they do a postback to my server with a couple of parameters, so i can know that that specific email address has payed, and they get the download. I tested localy with a .html file on my desktop to postback a set of parameters to my local asp.net website. But in ONLY works if i include the __VIEWSTATE in my html file. And i cant get rid of the viewstate in my HTML of the aspx page. >test.html: <html><head></head><body> <h1>Dit is een test</h1> <form id="form1" action="http://localhost:25659/WebForm1.aspx" method="POST"> <input id="Button1" type="submit" value="submit!"/> 'IT ONLY WORKS IF I INCLUDE THE NEXT LINE: <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMjA0OTM4MTAwNGRk" /> </form></body></html> Has anybody an idea to acomplish my goal? Maybe i can get some info about the postback in my global.asax? or create a HttpHandler for .html files? Anyone?   Thanks in advance, Vincent   </p>

Html editor word wrap problem

I created an html editor which uses an iframe for designing. The iframe doesnt wraps the text within it.... but the text keeps on extending in the same row towards the right. i tried setting scrolling='no' but it didnt work... tried word-wrap:break-word but thats also of no use........ please help! 

urlrewritingnet problem with html

Hi All, I have set up url rewriting in my web.config with regex rules and it works correct for all html files. Problem: When I have a html file that is not a rule, there is an error. How can I keep using not rewrited html files?   So.. I only want to rewrite if the file does not exist. < urlrewritingnet rewriteOnlyVirtualUrls="true" does not seem to work Thanks  

problem in converting a flowdocument in a xps document



I have a flow document that contains different paragraphs.

Each paragraph contains an inlineuielement.

The flowdocument looks fine but when i try to convert it in a xps  i get a document

where all the inliuielemnts elements are not displayed one after the other down the column

but they overlap partially.



 any idea why i have  this behaviour?



MVC 3.0 preview 1, Html.RenderAction Problem


Hi all,

I'm trying to use Html.RenderAction with MVC 3.0 preview 1 and i'm getting an error. i have the following controller:

	public class HelpController : Controller
public ActionResult Detail(int id)
ViewModel.Title = "Help Title! " + id.ToString();
ViewModel.Content = "Help Content!" + id.ToString();

return View();

and in another controller, i'm trying to do:

@Html.RenderAction("Detail", "Help", new { id = 3 });

but i keep getting:
CS1502: The best overloaded method match for 'Microsoft.WebPages.WebPageUltimateBase.Write(Microso

Problem displaying a view correctly in MVC app using HTML.TextBoxFor() with VB



I have a test app with a form view.

I cannot get the view to display correctly instead of displaying a series to text boxes it displays quoted html.

I suspect that my problem is related to my VB syntax for my Linq

The C# equivilant works but my shop uses VB so I must convert the code.

Here is the code from the view:

      <% Using (Html.BeginForm)%>
          <p>Your name: <%: Html.TextBoxFor(Function(m) m.Name).ToString%></p>
          <p>Your email: <%: Html.TextBoxFor(Function(m) m.Email).ToString%></p>
          <p>Your phone: <%: Html.TextBoxFor(Function(m) m.Phone).ToString%></p>
          <p>Will you attend? <br />
          <%  Dim slist As New Generic.List(Of SelectListItem)
          slist.Add(New SelectListItem With {.Text = "Yes", .Value = Boolean.TrueString})
          slist.Add(New SelectListItem With {.Text = "No", .Value = Boolean.FalseString})
       <%: Html.DropDownListFor(Function(m) m.WillAttend, slist, "Choose an option")%>
       <input type="submit" value="Submit RSVP" />
       <% End Using%>

Openquery - truncation problem (converting data from Oracle 10g to SQL 2005)


I am having problems with data truncating when inserting into a SQL 2005 db from Oracle 10g- using openquery and a linked server.   For instance, if I run something like:

insert dbo.CWDocumentStaging
select * from openquery(LK_Snomass,'select RSFORM.REPRESENTATION as REPRESENTATION

The results of the blob data are only 202 hexademical characters in length.  And then when I convert it to varchar, the results are cut-off.  For instance, on a particular test record that I converted, here is what I have in the SQL database (using):

select convert(varchar(max), DOCUMENT_TEXT), DOCUMENT_TEXT from dbo.CWDocumentStaging

I get the following:

for Document_Text, I get the following:


then for convert(varchar(max), DOCUMENT_TEXT):

this old man, he played one, he played knick-knack on my thumb with a knick-knack paddy whack give a

If I insert the data running the query against the linked server directly, the data does not truncate

Converting aspx to PDF problem


protected void btnExport_Click(object sender, EventArgs e)


        string attachment = "attachment; filename=Article.pdf";


        Response.AddHeader("content-disposition", attachment);

        Response.ContentType = "application/pdf";

        StringWriter stw = new StringWriter();

        HtmlTextWriter htextw = new HtmlTextWriter(stw);


        Document document = new Document();

        PdfWriter.GetInstance(document, Response.OutputStream);


        StringReader str = new StringReader(stw.ToString());

        HTMLWorker htmlworker = new HTMLWor

Problem converting varchar values to numeric format for comparison


I've got an SQL-2008 database containing our network inventory (it's from LanSweeper - a low-end and very recommendable network management tool). In a table are all logins with the IP-address of that moment, where the IP-address is defined as VARCHAR(15).

I need to compare IP addresses with those in the table defining the IP segments, where the segment addresses are also defined as VARCHAR(15).

In order to be able to compare reliably, I need to convert the addresses to numeric format. I cooked up the following SELECT statement for that:

SELECT TOP (100) PERCENT Ipaddress, (
CAST(SUBSTRING(Ipaddress, 1, CHARINDEX('.', Ipaddress, 1) - 1) AS DEC) * 1000000000 +
CAST(SUBSTRING(Ipaddress, CHARINDEX('.', Ipaddress, 1) + 1, CHARINDEX('.', Ipaddress, CHARINDEX('.', Ipaddress, 1) + 1) - 1) AS DEC) * 1000000) +
CAST(SUBSTRING(Ipaddress, CHARINDEX('.', Ipaddress, CHARINDEX('.', Ipaddress, 1) + 1) + 1, CHARINDEX('.', Ipaddress, CHARINDEX('.', Ipaddress, CHARINDEX('.', Ipaddress, 1) + 1) + 1) - 1) AS DEC) * 1000 +
CAST(SUBSTRING(Ipaddress, CHARINDEX('.', Ipaddress, CHARINDEX('.', Ipaddress, CHARINDEX('.', Ipaddress, 1) + 1) + 1) + 1, 3) AS DEC) AS IP, Computername, logontime, Username, ADsite,
FROM dbo.tblCPlogoninfo

Problem with security on ISS?, why can i write HTML file but not XML files


hi guys

I have a web app the manages articles, users can generate articles which we store in the database and also in a folder inside the application in html.  We also have the ability to generate real time alerts, to targetted audiences but the list of audiences was cached from an sql query on the web server and at times, the cache was cleared by the server. so i wrote an http module, and the module now runs the query using a timer, and this then wrties the audiences to an xml file within a folder in the same application (same as my html files)

Now the weird thing is im getting the system.io unauthorised access exception, when i try to delete and overwrite the xml file.  Yet this doesnt happen when i write the html files.

Now although my users do login, there credentials are maintained via an sql database table, not windows security or the asp.net security model. 

Ive checked the folder that we publish our applications up to (its a mapped folder like a virtual directory), and i cannot see the network service or asp.net machine accounts usually used in iis5 or 6.  But i dont have the ability to change this anyway. 

Why would the html file write fine, and the xml file throw this error. 

I also changed my code to used HttpRuntime.AppDom

html report printing problem


i have a 6 page long html report which i want to print, printing behaviour is different between IE and FF, i want to print ony certain number of lines per page, how do i acomplist this task without crystall report or any other propritery tool,

Note: Data of the report is dynamic.

below is the html of my report

        <table cellpadding=0 cellspacing=0 border=0 width=800px>
<img src="images/Header_FS.jpg" width="800px" />

<table cellpadding="0" cellspacing="0" border="0" width="620px">

<td align="center" style="height:40px" valign="middle">
<td align="center">

Awesome HTML minifying function but causes problem at Google Adsense ads - Very Important !


function works perfectly. everything works without any problem and source code becomes single line. but problem is about adsense ads. it is getting messed at screen.


ads are displayed but their locations are not correct. can anybody help me i appricate that alot


thank you


    protected override void Render(HtmlTextWriter writer)
        if (this.Request.Headers["X-MicrosoftAjax"] != "Delta=true")
            System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"<script[^>]*>[\w|\t|\r|\W]*?</script>");
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            System.IO.StringWriter sw = new System.IO.StringWriter(sb);
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            string html = sb.ToString();
            System.Text.RegularExpressions.MatchCollection mymatch = reg.Matches(html);
            html = reg.Replace(html, string.Empty);
            reg = new System.Text.RegularExpressions.Regex(@"(?<=[^])\t{2,}|(?<=[>])\s{2,}(?=[<])|(?<=[>])\s{2,11}(?=[<])|(?=[\n])\s{2,}|(?=[\r])\s{2,}");
            html = reg.Replace(html, string.Empty);
            reg = new System.Text.RegularExpressions

MVC3 Beta @Html.AntiForgeryToken() problem



I am getting strange error when trying to use @Html.AntiForgeryToken() in my views.

The error is:

[ArgumentNullException: Buffer cannot be null.
Parameter name: buffer]
   System.IO.MemoryStream..ctor(Byte[] buffer, Boolean writable) +9638183
   System.IO.MemoryStream..ctor(Byte[] buffer) +6
   System.Web.Mvc.AntiForgeryDataSerializer.Deserialize(String serializedToken) +97

[HttpAntiForgeryException (0x80004005): A required anti-forgery token was not supplied or was invalid.]
   System.Web.Mvc.AntiForgeryDataSerializer.Deserialize(String serializedToken) +397
   System.Web.Mvc.HtmlHelper.GetAntiForgeryTokenAndSetCookie(String salt, String domain, String path) +160
   System.Web.Mvc.HtmlHelper.AntiForgeryToken(String salt, String domain, String path) +16
   System.Web.Mvc.HtmlHelper.AntiForgeryToken() +10

Am I doing something wrong. The request till this exception is raised is GET, not POST. I thought that on GET the token is generated and than is validated on post.

Please advice.<
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend