Friday 2 November 2012

How to add bookmark on pdf file using itextsharp


 Document document = new Document(PageSize.A4, 50, 50, 25, 25);

            // Create a new PdfWriter object, specifying the output stream
         
            PdfWriter.GetInstance(document, new FileStream(Server.MapPath(“MyFirstPDF.pdf”), FileMode.Create));

            Chapter chapter1 = new Chapter(new Paragraph(“This is Chapter 1″), 1);
            Section section1 = chapter1.AddSection(20f, “Section 1.1″, 2);
            Section section2 = chapter1.AddSection(20f, “Section 1.2″, 2);
            Section subsection1 = section2.AddSection(20f, “Subsection 1.2.1″, 3);
            Section subsection2 = section2.AddSection(20f, “Subsection 1.2.2″, 3);
            Section subsubsection = subsection2.AddSection(20f, “Sub Subsection 1.2.2.1″, 4);
            Chapter chapter2 = new Chapter(new Paragraph(“This is Chapter 2″), 1);
            Section section3 = chapter2.AddSection(“Section 2.1″, 2);
            Section subsection3 = section3.AddSection(“Subsection 2.1.1″, 3);
            Section section4 = chapter2.AddSection(“Section 2.2″, 2);
            chapter1.BookmarkTitle = “Changed Title”;
            chapter1.BookmarkOpen = true;
            chapter2.BookmarkOpen = true;
            document.Add(chapter1);
            document.Add(chapter2);
            // Add the Paragraph object to the doc

How to Share a Link on Twitter


Please click on image and check

please use this code

<img id="ctl00_ctl00_ShareLink1_imgTwitter" border="0" onclick="ShareName('twitter')" src="images/icons/Twitter.png" alt="Twitter" style="border-width:0px;">
:
<script type="text/javascript"> var path = ""; var text = ""; function ShareName(title) { if (title == "twitter") { path = "http://twitter.com/share?url="; text = "&text="; ShareLink(path, text); } } function ShareLink(path, text) { var title = document.title; title = encodeString(title); var url = document.location; url = encodeString(url); var link = url + text + title; link = path + link; window.open(link); return false; } function encodeString(text) { var output = escape(text); output = output.replace("+", "%2B"); output = output.replace("/", "%2F"); return output; } </script>