PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Insert multiple line into PDF https://forum.pdfsharp.net/viewtopic.php?f=2&t=3293 |
Page 1 of 1 |
Author: | whoops1122 [ Wed Feb 10, 2016 9:34 pm ] |
Post subject: | Insert multiple line into PDF |
Hi all, I m trying to embed the following javascript to for my pdf. var myURL = "http://localhost:60494/Service1.svc?wsdl"; var myProxy = SOAP.connect(myURL); var filename = documentFileName; var testString = { soapType: "xsd:string", testString: filename }; var result = myProxy.updateDB(testString); now my problem is that when i tried to add them into pdfdictionary dict.Elements["/S"] = new PdfName("/JavaScript"); dict.Elements["/JS"] = new PdfName("/var myURL = \"http://localhost:60494/Service1.svc?wsdl\"; var myProxy = SOAP.connect(myURL); var filename = documentFileName; var testString = {soapType: \"xsd:string\", testString: filename}; var result = myProxy.updateDB(testString);"); it doesnt make into the pdf document. However, if i remove the line -->var testString = {soapType: \"xsd:string\", testString: filename}; <-- and only do dict.Elements["/JS"] = new PdfName("/var myURL = \"http://localhost:60494/Service1.svc?wsdl\"; var myProxy = SOAP.connect(myURL); var filename = documentFileName; var result = myProxy.updateDB(testString);"); then everything is fine... so.. am i missing something? Thanks all! update: after a bit more testing the issue is this character { and }. remove them, will make it work, but at this point, javascript wont work.... sigh.. looks like problem should trace to how the stream is being write to the file... one of those write function in PDFSharp.Pdf.IO.PdfWriter is prolly not handling the special char { and } correctly. |
Author: | whoops1122 [ Thu Feb 11, 2016 4:50 pm ] |
Post subject: | Re: Insert multiple line into PDF |
ok i resolved the issue myself, the problem is that I used PDFName, while i should have use PDFString instead. here is the final working code. dict.Elements["/JS"] = new PdfString("var myURL = \"http://localhost:60494/Service1.svc?wsdl\";\r"+ "var myProxy = SOAP.connect(myURL);\r"+ "var filename = documentFileName;\r"+ "var testString = { soapType: \"xsd:string\", testString: filename};\r"+ "var result = myProxy.updateDB(testString);"); |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |