Can not get proper font , alignment while generation pDF using Itextsharp

  
 I am developing a winform in which i m taking html data from  which have in line css so when i m genrating pdf it is 
not properly aligned.
 private void HtmlToPdfConvert()
            try
                string ClientID;
                string AssociateID;
                string DocumentType;
                //styles.LoadTagStyle(HtmlTags.H1, HtmlTags.FONTSIZE, "16");
                //styles.LoadTagStyle(HtmlTags.P, HtmlTags.FONTSIZE, "20");
                //styles.LoadTagStyle(HtmlTags.P, HtmlTags.COLOR, "Green");
               // styles.LoadTagStyle(HtmlTags.DIV, HtmlTags.COLOR, "Green");
                string file1 = ConfigurationManager.AppSettings["Pdffilename"].ToString();
                HtmltoPdfBusinessLogic htmlpdf = new HtmltoPdfBusinessLogic();
                ds = htmlpdf.GetContent();
                if (ds != null)
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        file2 = file1;
                        label2.Text = ds.Tables[0].Rows[i]["PdfFileName"].ToString();
                        string fname = label2.Text.ToString();
                        string[] words = fname.Split('_');
                        for (int j = 0; j < words.Length - 2; j++)
                            ClientID = words[0];
                            file2 = file2 + ClientID;
                            AssociateID = words[1];
                            file2 = file2 + "\\" + AssociateID;
                            DocumentType = words[2];
                            file2 = file2 + "\\" + DocumentType;
                        //Directory.CreateDirectory(file2);    
                        pdffname = file2 + "\\" + label2.Text + ".pdf";
                        if (System.IO.Directory.Exists(file2))
                            string[] files = System.IO.Directory.GetFiles(file2);
                            if (files.Length > 0)
                                foreach (string file in files)
                                File.Delete(file);
                                ConvertHtmlToPdf(i);
                            else
                                ConvertHtmlToPdf(i);
                        else
                            ConvertHtmlToPdf(i);
                    this.Close();
                    //if (ds.Tables[0].Rows.Count < 1)
                    //    MessageBox.Show("Documents Are Not Exist");
                    //    this.Close();
                /*  System.IO.Directory.CreateDirectory((file2));
                  outputFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), pdffname);
                  label1.Text = ds.Tables[0].Rows[0]["TM_Content"].ToString();
                  string htmltxt = label1.Text.ToString() + imgpath;
                  // HtmlStream = label1.Text;
                  Document document = new Document(PageSize.A4, 5, 5, 15, 5);
                  FileStream fs = new FileStream(outputFile, FileMode.Create, FileAccess.Write, FileShare.None);
                  PdfWriter w = PdfWriter.GetInstance(document, fs);
                  document.Open();
                  List<IElement> objects = HTMLWorker.ParseToList(new StringReader(htmltxt), styles);
                  foreach (IElement element in objects)
                      document.Add(element);
                  document.Close();
                  file2 = string.Empty;
            catch (Exception exp)
                MessageBox.Show(exp.Message);

iText is a third party library to create PDF originally written for java. iTextSharp is the C# adaptation of that library.
Question regarding iText are better asked on the iText forum, rather then the Microsoft Forum:
http://itextpdf.com/support
They mostly use StackOverflow and SourceForge for the free support, so either of those might be a good place to start.
Let's talk about MVVM: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b1a8bf14-4acd-4d77-9df8-bdb95b02dbe2 Please mark post as helpfull and answers respectively.

Similar Messages

  • Can not get my voice mail while in canada

    Hello i can not get my voice mail while in canada.. help   call forwarding is off.. when i dial my 10 digit number and hit send it says call ended.... but as soon as i cross back into the us it works just fine .. all was good till approx 6 weeks ago..  i have not added any thing or removed any thing either.

    While in Montreal PQ I don't receive voice mail notifications and *VM does not work. However if I dial my ten digit phone number I can retrieve my voice mail.
    Also when I get to my hotel I can dial my phone and retrieve that way.
    Another way is to use the backdoor Verizon voicemail number then follow the prompts to enter your cell number and password code.
    It is not toll free but I have never been charged for using it.
    Of course I don't know if it even is still available.

  • Am using PS Elements 11 and can not get the font to stop typing in all caps

    I am using PSE 11 to create scrapbook pages.  The font will only type in all caps.  How can I get it to type in lower case as well?

    Found the answer..finally!
    Getting Text Back From All Caps In Photoshop Elements (Not CAPS LOCK!) | morehawes
    Mac :
    Command ('Apple Key') + Shift + Y
    Windows :
    Ctrl + Shift + Y
    This will put the text back to sentence case or lower case (whatever it should be

  • Why my function can not get proper varaible value

    Hi.
    I write a MXML file like this.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="
    http://www.adobe.com/2006/mxml"
    invoke="setint()"
    creationComplete="getint()">
    <mx:Script>
    <![CDATA[
    import mx.utils.StringUtil;
    import mx.controls.Alert;
    public var number:int = 100;
    private function setint():void{
    number = 200;
    Alert.show("" + number);
    private function getint():void{
    Alert.show("" + number);
    ]]>
    </mx:Script>
    </mx:WindowedApplication>
    I define a varaible in ActionScrip. one function is to set
    its value, another is to get its value. why function getint()
    always get value 100. this varaible can not be set. the two
    function are trigger in invoke event and creationComplete.

    "crystalChen" <[email protected]> wrote in
    message
    news:ghska7$31a$[email protected]..
    > Hi.
    > I write a MXML file like this.
    > <?xml version="1.0" encoding="utf-8"?>
    > <mx:WindowedApplication xmlns:mx="
    http://www.adobe.com/2006/mxml"
    > invoke="setint()"
    > creationComplete="getint()">
    >
    > <mx:Script>
    > <![CDATA[
    > import mx.utils.StringUtil;
    > import mx.controls.Alert;
    >
    > public var number:int = 100;
    > private function setint():void{
    > number = 200;
    > Alert.show("" + number);
    > }
    >
    > private function getint():void{
    > Alert.show("" + number);
    > }
    > ]]>
    > </mx:Script>
    >
    > </mx:WindowedApplication>
    >
    > I define a varaible in ActionScrip. one function is to
    set its value,
    > another
    > is to get its value. why function getint() always get
    value 100. this
    > varaible
    > can not be set. the two function are trigger in invoke
    event and
    > creationComplete.
    Check out "Defining Public properties by using getter and
    setter methods"
    http://www.adobe.com/livedocs/flex/3/html/help.html?content=ascomponents_3.html

  • I can not get my playbook to open some PDF files

    I try to open PDF files from my schools online sources and they will download but all i get is a white screen. It will have the correct number of pages loaded but as I scroll there is nothing but white. How do I fix this???

    If only some of them can't show up, this might because of two reasons, the first is your PDF file i really huge and it stuck when trying to load, and the second one is this file is broken, you should find another place with better wifi signal and download it again

  • My computer was stolen and now my wife and i are sharing her laptop.  we have separate apple ID accounts, i upgraded to iphone 4 since the robbery.  all of her apps are on my phone and i can not get my apps or upgrade exisiting apps using my apple account

    my wife and I are now sharing the same laptop, mine was stolen, we have separate apple ID accounts.  i upgraded to iphone 4 after the robbery and activated my phone on her laptop.  when i try to download or upgrade apps her apple ID keeps popping up.  can we have separate accounts using the same laptop with different phones?  if so, how can i fix this?

    It sounds as if you're using the same Mac OS X login account on that computer. If you create a separate login account for yourself, it will be as if you have two computers (other than the fact you can't both use it at the same time, of course).
    Go to System Preferences->Users & Groups to create a new user account for yourself. Log out of your wife's account, then log in to your own account. You can now set up this user environment any way you like. When you launch iTunes the first time, enter your Apple ID and log in to the iTunes Store. Redownload all of your content. Then connect your iPhone to the computer using the USB cable - it will treat it as a new phone, let iTunes wipe the phone and set it up as new.
    You might then want to set up Fast User Switching within System Preferences->Users & Groups which will allow you and your wife to swap the laptop between the two of you easily without even having to log out one account in order to log in to the other.
    http://docs.info.apple.com/article.html?path=Mac/10.6/en/8672.html

  • I can not get my mouse to work correctly when using firefox. Works fine on IE

    When I try to use the search bar on home page, my mouse will not click on it. Have same problem with facebook when I try to go back to homepage-it will not click. I do not have this problem when using IE so I know my mouse is working correctly.

    Quit the Mail app.
    Go to the Home screen and double click the Home button. That will reveal the row of recently used apps at the bottom of the screen. Tap and hold on the app in question until it wiggles and displays a minus sign. Tap the minus sign to actually quit the app. Then tap anywhere on the screen above that bottom row to return the screen to normal. Then restart the app and see if it works normally.

  • I can not get link-value  from af:tree.

    Hello.
    I use jdeveloper 10g.
    I can not get link-value from tree.
    I use following code:
    <f:facet name="nodeStamp">
    <h:panelGroup binding="#{backing_dialogDic_dic_ETS.panelGroup1}"
    id="panelGroup1">
    <h:outputText value="#{item.vidNum} #{item.vidName}"
    binding="#{backing_dialogDic_dic_ETS.outputText1}"
    id="outputText1"/>
    <af:commandLink
    binding="#{backing_dialogDic_dic_ETS.commandLink2}"
    id="commandLink2"
    action="#{backing_dialogDic_dic_ETS.returnObject}">
    <af:setActionListener from="#{item.idVid}"
    to="#{processScope.ETSId}"/>
    <af:objectImage source="/images/icons/10.gif"
    shortDesc="Выбрать"
    binding="#{backing_dialogDic_dic_ETS.objectImage2}"
    id="objectImage2"/>
    </af:commandLink>
    </h:panelGroup>
    </f:facet>
    </af:tree>
    //in java bean:
    public String return_Object() {
    Object ob = JSFUtils.getManagedBeanValue("processScope.ETSId");
    System.out.println(o);
    return null;
    In console I see null.
    How I get this value???
    I can get this value if i use treeTable instead of tree.
    Thx, Dema.

    Hi,
    not that I think it matters, but the processScope is not a managed bean but a memory scope. So if
    JSFUtils.getManagedBeanValue("processScope.ETSId");
    assumes a managed bean then this may be incorrect as most likely there exist no managed bean with this name. You should be able to access the process scope from AdfFacesContext.getProcessScope(), which then returns a Map, which you call get("ETSId") on
    Frank

  • HT5484 Hi, I am using "Avenir Heavy" font in my iOS 6 app but when I run it on iOS5 the label on which I am placing Avenir fonts changes lot and I am not getting proper look n feel. How can I solve this issue ?

    Hi, I am using "Avenir Heavy" font in my iOS 6 app but when I run it on iOS5 the label on which I am placing Avenir fonts changes lot and I am not getting proper look n feel. How can I solve this issue ?

    Post your question on the Developer forums:  http://devforums.apple..com

  • HT4910 i save my photos to camera roll. then back up but can't see it on icloud. why? we just lost 300 photos on my other iphone because we do not get proper help. that's why i need to learn now.

    i save my photos to camera roll. then back up but can't see it on icloud. why? we just lost 300 photos on my other iphone because we do not get proper help. that's why i need to learn now.

    You can't view your back up files at icloud.com.
    You can't view your camera roll and you can't view your Photo Stream files at icloud.com.
    The icloud back up plan allows you to "restore" your iOS device from the files you backed up at icloud.com.

  • I have an ipod nano 7th generation and can not get it recognised by my Windows 8.1 laptop (it appears briefly on My computer, then disappears). This happened after I updated iTunes to the latest version. Does that have something to do with it?

    I have an ipod nano 7th generation and can not get it recognised by my Windows 8.1 laptop (it appears briefly on My computer, then disappears). This happened after I updated iTunes to the latest version. Does that have something to do with it?

    Hello there, kiwilucea.
    The following Knowledge Base article offers up some in-depth steps for troubleshooting your issue:
    iPod not recognized in My Computer and in iTunes for Windows
    http://support.apple.com/kb/ts1369
    Keep in mind if you get to Step 12 Reinstall iTunes, those steps need to be followed exactly as outlined for the reinstall to be effective.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Can't do online banking. Get error message. "The requested URL /Summary.cgi was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    I can't do online banking. When I try to open the page I get error "The requested URL /Summary.cgi was not found on this server.
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    Hi,
    These blog posts might help debug problem
    Oracle APEX: Got a 404 Not Found? | Inside Oracle APEX by Patrick Wolf
    daust_de :: Oracle XE / APEX: Troubleshooting the 404-not found error on XE
    Regards,
    Jari

  • Lost newly purchased Iphone5, Reported complain in police station but not getting proper responce. Can apple help me out for this?

    Lost newly purchased Iphone5, Reported complain in police station but not getting proper responce. Can apple help me out for this?

    Oh, don't worry. I know exactly. I'm a retired law enforcement officer after 30 years. I didn't mean for them to allow you to use the Internet, I meant for them to assign an officer to try and track the device for the victim. Again, that would require the victim to provide their Apple ID and password, which most would not want to provide.
    Pinging the phone as you mention is only when there is probable cause and that is done through the carrier.
    I'm glad to see someone also understand that a stolen cell phone is not as important to law enforcement as it is to the victim. It is unfortunate as smartphones get more expensive. Hopefully as iOS 7 makes it debut later this year, the work Apple has done will have some impact on smartphone theft. Other manufactures and carriers are starting to improve here in the states. It never was something carriers worryed about with blacklisting. This is where they were a step ahead in Europe.

  • I can not connect to the internet while using my ipad I get a message saying Safari could not open the page because the server stopped responding need help thank you

    I CAN NOT CONNECT TO THE INTERNET WHILE USING MY IPAD I KEEP GETTING A MESSAGE SAYING SAFARI COULD NOT OPEN THE PAGE BECAUSE THE SERVER STOPPED RESPONDING PLEASE HELP THANK YOU

    Try the following:
    1. Turn router off for 30 seconds and on again
    2. Settings>General>Reset>Reset Network Settings
    3. Reset iPad; hold the Sleep and Home button down until you see the Apple Logo

  • I have an ipod shuffle 1st generation it will work if i connect it to my usb port in car or on computer but i can not get it to work using just headphones what coud be the reason for this

    I have an ipod shuffle 1st generation. it will work ousing usb port in car or on computer but i can not get it to play using headphones. what would be the reason for this.

    Sorry for  the typos, I hope my message still gets across!

Maybe you are looking for