PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Aug 21, 2024 8:22 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Feb 10, 2016 9:34 pm 
Offline

Joined: Wed Feb 10, 2016 9:26 pm
Posts: 2
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.


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 11, 2016 4:50 pm 
Offline

Joined: Wed Feb 10, 2016 9:26 pm
Posts: 2
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);");


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 92 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group