Solved

using iTextSharp to create PDF

Posted on 2014-01-15
5
635 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
  • 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 500 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can I build my own IDE using ASP.NET MVC? 2 45
ASP.net Javascript use multiple sliders 2 29
Web site error 3 41
Reading the Web.Config using IIS 7.5? 4 36
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 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