tag:blogger.com,1999:blog-1986647153550030911.post7844051389028182273..comments2024-03-03T14:44:28.965+01:00Comments on LiveCycle Blog: Formulare in bestimmte Verzeichnisse speichern und nach Inhalt aus Formularfeld benennen //Save forms to specific directories and named after form field dataradzmarhttp://www.blogger.com/profile/16208021869177153799noreply@blogger.comBlogger26125tag:blogger.com,1999:blog-1986647153550030911.post-13742575305747733342016-03-22T05:00:02.404+01:002016-03-22T05:00:02.404+01:00Really cool post, highly informative and professio...Really cool post, highly informative and professionally written and I am glad to be a visitor of this perfect blog, thank you for this rare info! <br />Regards <a href="http://www.traininghyderabad.in/2015/08/adobe-cq5-training-in-hyderabad.html" rel="nofollow">adobe cq5 training in hyderabad</a> <br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-89909745126862635352013-09-16T10:59:06.049+02:002013-09-16T10:59:06.049+02:00Sorry Subash, but I don't understand your requ...Sorry Subash, but I don't understand your request. Please provide more details of what you're trying to do.radzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-89381655725371890902013-09-16T10:57:01.706+02:002013-09-16T10:57:01.706+02:00Hi,
you can add the toUpperCase() method to the f...Hi,<br /><br />you can add the toUpperCase() method to the fields script in the layout:ready event.<br /><br />For the field TargetCurrentDirectory replace the current script with the following script:<br /><br />// Variables we use in the filename taken from fields somewhere in the form<br />var Var1 = xfa.resolveNode("form1.#subform.cDepartment").rawValue;<br />var Var2 = xfa.resolveNode("form1.#subform.cName").rawValue;<br /><br />// Create a time stamp for the new file<br />var TimeStamp = util.printd("ddmmyyyy", new Date());<br /><br />// This functions checks the current file name. If it is not the correct file name we don't save the file under a new file name<br />if (event.target.documentFileName === "LCB_SaveAs_V2.pdf") {<br /> // Concatenate the variables to a file name<br /> var NewFileName = "LCB_SaveAs_V2" + "_";<br /> NewFileName += Var1 + "_";<br /> NewFileName += Var2 + "_";<br /> NewFileName += TimeStamp;<br /> NewFileName += ".pdf";<br /> // Replace all characters that are not allowed to be used in a save path – this it to avoid an raise error<br /> NewFileName = NewFileName.replace(/[\s\!\?\<\>\'\"\*\/\\\=\?\^\`\{\}\|\~]+/g, "_").toUpperCase();<br /> // Concatenate save path with new file name for this form and show it into this field<br /> this.rawValue = event.target.path.replace(event.target.documentFileName, "").toUpperCase() + NewFileName;<br />} else {<br /> this.rawValue = event.target.path.toUpperCase();<br />}<br /><br />The field now will display all paths in uppercase.radzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-63840445438230686282013-09-16T03:29:24.449+02:002013-09-16T03:29:24.449+02:00dear Radzmar,
how can i create on uppercase on the...dear Radzmar,<br />how can i create on uppercase on the names field and all file.<br /><br />thx<br /><br />sivaneshAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-89227006311241398722013-09-15T00:58:49.455+02:002013-09-15T00:58:49.455+02:00Hi radzmar,
Some pdf files i can edit but after on...Hi radzmar,<br />Some pdf files i can edit but after only saved.<br />Because i want to read<br /><br />Thanks<br />SubashAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-881030002612043932012-11-12T18:00:57.058+01:002012-11-12T18:00:57.058+01:00Hi Martin,
I've updated the link, so is now w...Hi Martin,<br /><br />I've updated the link, so is now working again.radzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-22557933988573426842012-11-12T15:00:29.420+01:002012-11-12T15:00:29.420+01:00Dear Radzmar,
I found this very helpful. The link...Dear Radzmar,<br /><br />I found this very helpful. The link to the sample ZIP file does not sem to work. Is there anotherlocation where I could download it?<br /><br />Kind Regards<br />MartinAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-62867692987751764642012-09-18T21:19:18.142+02:002012-09-18T21:19:18.142+02:00Hi Ebnul,
I found the root of all evil in my samp...Hi Ebnul,<br /><br />I found the root of all evil in my sample.<br /><br />Firstly the script in the field "SaveAsMyDocuments" needs an additional line of code.<br /><br />...<br />if (event.target.documentFileName === "LCB_SaveAs_V2.pdf") {<br /> var newPath = MyDocumentsPath.rawValue.replace(event.target.documentFileName, "");<br /> newPath += "/" // this is the added code line<br /> newPath += "LCB_SaveAs_V2"<br />...<br /><br /><br />Secondly, the related save button checks the file name "LCB_SaveAs.pdf" instead of "LCB_SaveAs_V2.pdf", so you need to change that script too.<br /><br />Best,<br />Radzmarradzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-48088183527478921562012-09-16T12:45:29.221+02:002012-09-16T12:45:29.221+02:00Dear Radzmar,
Thanks for your great sample.
All ...Dear Radzmar,<br /><br />Thanks for your great sample.<br /><br />All save location works perfect in my PC except "My Documents"<br />When I click on Save button Save as window open with current file name "LCB_SaveAs_V2.pdf". file name does not generate from cName & cDepartment.<br />I'm using windows.<br /><br />Please can you help me to fix this problem.<br /><br />Regards,<br />EbnulAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-11998981406982945932012-04-25T19:47:28.083+02:002012-04-25T19:47:28.083+02:00Hi,
sorry for the delay, I've been away a cou...Hi,<br /><br />sorry for the delay, I've been away a couple of days!<br /><br />To use exportXFAData() with Reader, the form needs the so called exports form rights.<br />The usage rights you can apply through Acrobat do not enable the neccessary export rights, this can only be done with LiveCycle Reader Extensions products.radzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-34584952840757775882012-04-20T07:27:11.852+02:002012-04-20T07:27:11.852+02:00Hi radzmar,
I have got a problem. Following scrip...Hi radzmar,<br /><br />I have got a problem. Following script is working fine in Acrobat pro but not work for reader.<br /><br />var mySaveDoc = app.trustedFunction(function(doc) <br />{ <br />app.beginPriv(); <br />var myPath = this.path.replace(this.documentFileName, "");<br />var fm_SaveAsTarget = SaveAsTarget;<br />var myPath = myPath + fm_SaveAsTarget + ".xml"; <br />this.exportXFAData({<br />cPath: myPath,<br />bXDP: false,<br />aPackets: ["*"]<br />}<br />) <br />app.endPriv(); <br />}<br />);<br /><br /><br />var pdf_SaveAs = app.trustedFunction(function(doc) <br />{ <br /> app.beginPriv();<br /> var myPath = this.path.replace(this.documentFileName, "");<br /> var pdf_SaveAsTarget = PDFSaveAsTarget;<br /> var myPath = myPath + pdf_SaveAsTarget + ".pdf"; <br /> doc.saveAs({cPath: myPath});<br /> app.endPriv();<br />});<br /><br />Would you tell me what I should do? I have enabled reader right extension with acrobat pro.<br /><br />Thanks for your time.tear seahttps://www.blogger.com/profile/00113420652569657048noreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-42345959180598112592012-03-15T11:36:29.529+01:002012-03-15T11:36:29.529+01:00When you open the sample form in a browser window,...When you open the sample form in a browser window, and all fields get populated with the path or file names, then you already have access to the folder level script and can use it also to save forms.<br /><br />The problem now is that the paths are displayed in the URI format such as "file:///D:/FORMS/" instead of "/D/FORMS/".<br /><br />When you try to use save paths in this format the saveAs script will fail with an exception "UnsupportedValueError: Value is unsupported. ===> Parameter cPath" because the saveAs function doesn't support path in the URI format.<br /><br />To get rid of this you can use a regular expression to reformat the path in the scheme you need.<br /><br />Here an example to save in the current directory:<br /><br />var Var1 = xfa.resolveNode("form1.#subform.cDepartment").rawValue;<br />var Var2 = xfa.resolveNode("form1.#subform.cName").rawValue;<br />var TimeStamp = util.printd("ddmmyyyy", new Date());<br /><br />if (event.target.documentFileName === "LCB_SaveAs_V2.pdf") {<br /> var NewFileName = "LCB_SaveAs_V2" + "_";<br /> NewFileName += Var1 + "_";<br /> NewFileName += Var2 + "_";<br /> NewFileName += TimeStamp;<br /> NewFileName += ".pdf";<br /> NewFileName = NewFileName.replace(/[\s\!\?\<\>\'\"\*\/\\\=\?\^\`\{\}\|\~]+/g, "_");<br /> <br /> var newSavePath = event.target.path.replace(event.target.documentFileName, "") + NewFileName;<br /> this.rawValue = newSavePath.replace(/(file)|\:|\||\/{2}/gi ,"");<br />} else {<br /> this.rawValue = event.target.path;<br />}radzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-33439740113445253232012-03-15T00:26:51.665+01:002012-03-15T00:26:51.665+01:00I am trying to save just the xdp data from a form ...I am trying to save just the xdp data from a form in the browser. Do folder level scripts work when the pdf is displayed using reader in the browser?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-34962559287461691182012-02-20T19:46:30.455+01:002012-02-20T19:46:30.455+01:00Oh great!!!
Thanks a lot.Oh great!!!<br /><br />Thanks a lot.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-69321631424995801392012-02-20T19:17:55.430+01:002012-02-20T19:17:55.430+01:00Hi,
the exportXFAData function requieres a few mo...Hi,<br /><br />the exportXFAData function requieres a few more parameters.<br />This sample will export the currents file Data as XML file into the same directory.<br />Other directories will also work, but Acrobat will restrict access to system critical folders by default and will return an Not allowed exception in the JS Console (can be opened with ctrl + J).<br /><br />function myDateString() { <br />return util.printd("mmddyy_HHMMss", new Date()); <br />} <br />// SaveAs Function <br />var mySaveDoc = app.trustedFunction(function(doc) { <br />app.beginPriv(); <br />var myPath = this.path.replace(this.documentFileName, "");<br />var myPath = myPath + "TEST_" + myDateString() + ".xml"; <br />this.exportXFAData({<br /> cPath: myPath,<br /> bXDP: false,<br /> aPackets: ["*"]<br /> }) <br />app.endPriv(); <br />});radzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-56618191764432040932012-02-19T15:34:42.861+01:002012-02-19T15:34:42.861+01:00Hi radzmar,
I am glad to see elaborated and clear ...Hi radzmar,<br />I am glad to see elaborated and clear discussion on this topics. I was trying export as xml in specific folder on acrobat X pro 10. following script was being used:<br /><br />function myDateString()<br />{<br /> <br />return util.printd("mmddyy_HHMMss", new Date());<br /> <br />}<br /> <br />// SaveAs Function<br />var mySaveDoc = app.trustedFunction(function(doc) {<br /> <br />app.beginPriv();<br />var myPath = "/C/Users/Dream_peak/Desktop/test"+"/"+ myDateString() + ".xml";<br /> <br />doc.exportXFAData(myPath);<br />app.endPriv();<br /> <br />});<br /><br />Nothing happen. What should I do?<br /><br />Your sample is working fine but when I change .pdf to .xml and doc.saveAs to doc.exportXFAData, it is shoeing security error.<br /><br />Would you help me?<br /><br />ThanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-43435350077383489812011-05-18T21:00:33.042+02:002011-05-18T21:00:33.042+02:00@JPM
Sorry for the late response.
It's hard t...@JPM<br /><br />Sorry for the late response.<br />It's hard to determine, why your subforms are still hidden.<br />I need the form to have a clue whats going on.<br /><br />And yes, the best method to flatten your forms is to print them via PDF Printer (Distiller).<br />Any way, I don't know a method how to deliver a value from the form over to Distiller to generate a different file name for each print.<br /><br />Alternatively you could use a loop to lock down all your form fields before saving them through the folder level script.<br /><br />JavaScript to lock all fields:<br />for (var p = 0; p < xfa.host.numPages; p++) <br /> {<br /> var oFields = xfa.layout.pageContent(p, "field"); <br /> for (var f = 0; f < oFields.length; f++) <br /> {<br /> var field = oFields.item(f);<br /> // Protect field against changes<br /> field.access = "readOnly";<br /> } <br /> }<br /><br />Hope this helpsradzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-36595314788917154832011-05-04T09:19:52.413+02:002011-05-04T09:19:52.413+02:00Hi Radzmar
First of all, please let me say you Co...Hi Radzmar<br /><br />First of all, please let me say you Congratulations: I know (because i've been reading<br />several posts at acrobatusers) that this is the result of a long and great job.<br /><br />I'm working with LC Designer (Acrobat 8.1) on a form which is composed of several subfomrs. Each of them becomes<br />"visible" or "hidden" depending on the (raw)value of a dropdown-list.<br /><br />When the user finishes filling, the goal is to print the form, changing the name of printed doc depending on the content, in a specific directory, without pop-up confirmation.<br /><br />For that reason, when I first saw your script, I though "Hey guy, this is just what I need !"<br /><br />I used your folder level script and I put a simplified code inside a buton that calls that script.<br /><br />From a "saving as" point of view (after correcting a couple of things), everything works fine.<br /><br /><br />But, two issues are still giving me headache:<br /><br /><br />The first problem appears with the hidden subforms: they keep hidden at the saved document...Do you have any idea about what is happening? I have been changing the presence of each subform in LC....but nothing new.<br /><br />The other issue is that the saved document allows another user to modifing the entire form....I supose that this is because we are saving the document instead of printing it in pdf format.<br /><br />In fact, having a printed pdf would be the best way sending the info to our suppliers. Do you think that would it be possible to modify the script to generate a printed pdf (in the same way: no pop-ups, no confimations) instead of saving the form?<br /><br />Of course, any suggestion is welcome.<br />I look forward to your comments...And I hope you are able to help me.<br /><br />JPMJPMnoreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-11020106980991093692011-02-23T16:54:59.871+01:002011-02-23T16:54:59.871+01:00@egutie6970
If this is unknown territory for you ...@egutie6970<br /><br />If this is unknown territory for you I suggest you start with some tutorials on AcrobatUsers.com to get more in touch with JavaScript.<br /><br /><a href="http://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript" rel="nofollow">How to save a PDF with Acrobat JavaScript</a>radzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-89293364607806597732011-02-11T09:31:00.685+01:002011-02-11T09:31:00.685+01:00Hi Radzmar,
I'm trying to create this for a f...Hi Radzmar,<br /><br />I'm trying to create this for a form on adobe. I'v never written script before. Any chance you can help me with my file ? I would be more then happy to email it to you.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-29977338569577412812010-09-24T12:39:32.751+02:002010-09-24T12:39:32.751+02:00@Jotha
Tschuldigung, da habe ich wohl Ihren Komm...@Jotha <br /><br />Tschuldigung, da habe ich wohl Ihren Kommentar übersehen.<br />Besteht Ihre Anfrage noch?radzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-48816681994533744682010-08-10T19:34:42.009+02:002010-08-10T19:34:42.009+02:00I´m a pretty old man without any Java knowledge, b...I´m a pretty old man without any Java knowledge, but nevertheless I have to amend three pdf forms which have been created in Acrobat 9 with exactly such a "save as" button. Your scripts are giving me a faint idea of what to do, but I don´t know how to let the contents show up in the fields, where to put the field scripts etc.<br />You are German, I think, and I´m living in Berlin. Could I pay you for adding "save" buttons to my three (quite primitive) pdf forms?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-4216057927660096342010-07-13T09:01:28.258+02:002010-07-13T09:01:28.258+02:00There is a subform "FileParameters" on t...There is a subform "FileParameters" on the masterpage that surrounds those fields. Set its visibility to hidden.radzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-84019899435473818552010-07-12T23:35:02.127+02:002010-07-12T23:35:02.127+02:00Thanks! Adding usage rights for Reader in Acrobat...Thanks! Adding usage rights for Reader in Acrobat 9 fixed the issue!<br /><br />Now need to figure out how to hide the path field so its not viewable in the form output (ideally)Joshhttp://twitter.com/3rdpartynoreply@blogger.comtag:blogger.com,1999:blog-1986647153550030911.post-46833313213513653352010-07-12T21:30:24.698+02:002010-07-12T21:30:24.698+02:00Did you close your Reader after you put the script...Did you close your Reader after you put the script into the javascript folder?<br />It's neccessary to restart Reader.radzmarhttps://www.blogger.com/profile/16208021869177153799noreply@blogger.com