[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

using iTextSharp to create PDF

Posted on 2014-01-15
5
Medium Priority
?
669 Views
Last Modified: 2014-01-16
I'm using ItextSharp to create pdf documents. At the end of the document it adds this text.

{"appName":"Unknown","requestId":"38675e673dc54c2682dec4f3e6c0bfb4"}

What is this and how can I get ride of it??
0
Comment
Question by:NickMalloy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 23

Expert Comment

by:wdosanjos
ID: 39785212
It looks like JSON, most likely your own application is writing it to the PDF file.  Can you share part of your code?
0
 

Author Comment

by:NickMalloy
ID: 39785989
Here is my code for generating the pdf.

using (MemoryStream myMemoryStream = new MemoryStream())
                {

                    Document myDocument = new Document(PageSize.A1, 10f, 10f, 10f, 0f);
                    PdfWriter myPDFWriter = PdfWriter.GetInstance(myDocument, myMemoryStream);
                    myDocument.Open();
                    WebClient wc = new WebClient();
                    string htmlText = wc.DownloadString("http://localhost:59392/GeneratePDF/CreatePDF.aspx?pid=" + bb);
                    Response.Write(htmlText.Replace("\r", "").Replace("\n", "").Replace("  ", ""));
                    List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StringReader(htmlText), null);
                    for (int k = 0; k < htmlarraylist.Count; k++)
                    {
                        myDocument.Add((IElement)htmlarraylist[k]);
                    }
                    myDocument.Close();
                    byte[] content = myMemoryStream.ToArray();
                    using (FileStream fs = File.Create("PayEval" + bb + ".pdf"))
                    {

                        fs.Write(content, 0, (int)content.Length);
                        var p5 = new tblAttachment();
                        p5.ApplicationID = RecID;
                        p5.DocName = "Eval" + bb + ".pdf";
                        p5.DocType = "pdf";
                        p5.DocByteSize = Convert.ToInt32(fs.Length);
                        p5.DocBinary = content;
                        ctx1.tblAttachments.Add(p5);
                        ctx1.SaveChanges();
                        Int32 Attach = p5.AttachmentID;

                    }
					
					}

Open in new window

0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 39786211
What's the content of htmlText?  Does it happen to include the string "{"appName":"Unknown","requestId":"38675e673dc54c2682dec4f3e6c0bfb4"}"?
0
 

Author Comment

by:NickMalloy
ID: 39786425
it contains this. It isn't something I added to the page. How can I get ride of this???

<!</div>\r\n\r\n-- Visual Studio Browser Link -->\r\n<script type=\"application/json\" id=\"__browserLink_initializationData\">\r\n    {\"appName\":\"Unknown\",\"requestId\":\"84aee9b329d54004969ddcdae2b993c9\"}\r\n</script>\r\n<script type=\"text/javascript\" src=\"http://localhost:54202/6e500d6e2c2e40b19d14bdc8bb202bb4/browserLink\" async=\"async\"></script>\r\n<!-- End Browser Link -->\r\n\r\n</body>\r\n</html>"
0
 
LVL 23

Accepted Solution

by:
wdosanjos earned 2000 total points
ID: 39786538
That code is injected on the page by the VS2013 debugger to support the Browser Link feature.  Please follow the instructions on the link below to disable it.

Using Browser Link in Visual Studio 2013: Disabling Browser Link
http://www.asp.net/visual-studio/overview/2013/using-browser-link#disabling

I hope this helps.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question