Doc Save As and Trusted Function

I have been reading over the forum and the adobe help files regarding this. I think I am close but since I need to get my IT department to assist in placing the js files where they have to go, I thought I might ask the forum if I am on the right track
I still have to make sure the field values will not include an illegal characters. They wont be empty as the forms will be coming directly from our system -prefilled
Currently these forms automatically email (although staff still have to hit the actual send button) when staff go to print the document.  The people who get these forms are just finding it a bit hard to keep up with the emails and have asked to just have the files save to a folder so they can look at when they have time
This is what I have for my trust propagator function.  I assume this is the only js file I will need as it incoporates the trusted function?
mySaveAs = app.trustPropagatorFunction(function(doc,path)
  app.beginPriv();
   doc.saveAs(path);
  app.endPriv(); })
myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path)
  // Privileged and/or non-privileged code above
  app.beginPriv();
   mySaveAs(doc,path);
  app.endPriv();
  // Privileged and/or non-privileged code below });
I got this code from the Adobe Help
then I want to have this code in the Document Did Print area
var name = this.getField("FormValues.accountNames_0").value
var folio =this.getField("FormValues.folioNumber_0").value
myTrustedSpecialTaskFunc(this, "/w/Public/AccountOpening/" + name + " " + folio,pdf);
I have to read where to put the js file as I have seen some comments on the forum that where you place the js file has changed for those with Adobe X and Windows 7
Would anyone be be able to let me know if I am on the right path before I get IT involved.  I suppose I could test the code on my own laptop to see if it would allow me to save the form.....
Thank you

Read this: The Acrobat Ninja: Acrobat 10.1.1 JavaScript changes
You have to manually create the folders that aren't present, and they must be named correctly.
It's a good idea to use the valueAsString property instead of the value property to get the field values, since you're using the results as strings. It probably won't make a difference here, but it's a good habit to get into. You also have a typo in that last line of code. It should be:
myTrustedSpecialTaskFunc(this, "/w/Public/AccountOpening/" + name + " " + folio + ".pdf");
It would be a good idea to make sure those field value aren't blank if there's a chance that they could be.
Also, consider using a try/catch block for the doc.saveAs call, and look at the return value so you can give the users a more helpful error message than what the default will be if something goes wrong.
If you need help with any of this, post again.

Similar Messages

  • Why do the "SAVE", "SAVE AS" and "UNDO" functions of InDesign CS6 stop working after a short time?

    Why do the "SAVE", "SAVE AS" and "UNDO" functions of InDesign CS6 stop working after a short time?

    Normally they don't. You might have some sort of problem on your system, possibly a conflict with other software, or corrupt ID prefs or application. Trashing the prefs is easy, and good place to start: Replace Your Preferences
    It will help if you tell us the OS version, whther you've installed the 8.0.1 patch, and how you are trying to access the commands, and what happens when you do. Is this isolated to one file, or does it happen with all files?

  • How to save xml and xsl function to a data grid column

    hi. wondering, i have a xml and a xsl file, and have the transform class, and so need to save the xml and the xsl file, and display the results on a particular data grid column and to loop through the data grid columns. so, how do i use the xml save function
    class, any examples or point me to articles, where i can read how to do this. need to display a file, with a different colour and font. any ideas. thanks. marvin.hi. need to save a xml and xsl file and display the results on data grid. how do i do this. any
    sample code or articles i can read about thanks. marvin.
    http://startrekcafe.stevesdomain.net http://groups.yahoo.com/groups/JawsOz

    
    Hi.
    Okay, well, did ask on the msdn forums, and some one replied, and so, will paste the code he suggested.
    But getting a lot of errors.
    Can you help me out.
    Where am I going wrong.
    So, I can then get this to work, then it shows the colours and the fonts on the specified data grid.
    Can you help.
    Want to get this working and passed today if possible.
    Will pasate the code and the errors below.
    Can you help.
    Where am I going wrong.
    Marvin.
    // Set up the data set.
    DataSet ds =
    new
    DataSet();
    // Set up the data table.
    DataTable dt =
    new
    DataTable();
    // Ad the data table to the data set.
        ds.Tables.Add(dt);
    // Write the xml document to the data grid column.
        ds.WriteXML(@"c:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\CurrentCount.xml");
        ds.WriteXML(@"c:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\OnOrder.xml");
        ds.ReadXML(@"c:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\CurrentCount.xml");
        ds.ReadXML(@"c:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\OnOrder.xml");
    // Set up the data table and the data set and set to 0.
        dgvDisplayData.DataSource = ds.Tables[0];
    Error      1              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                215        
    18           WoodStocks
    Error      2              Invalid token ')' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                215        
    21           WoodStocks
    Error      3              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                219        
    16           WoodStocks
    Error      4              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                221        
    16           WoodStocks
    Error      5              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                222        
    15           WoodStocks
    Error      6              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                223        
    15           WoodStocks
    Error      7              Invalid token '=' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                227        
    31           WoodStocks
    Error      8              Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                227        
    43           WoodStocks
    Error      9              Invalid token ';' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                227        
    45           WoodStocks
    Can you help me out.
    Thanks.
    http://startrekcafe.stevesdomain.net http://groups.yahoo.com/groups/JawsOz

  • In the new Firefox 4, what happned to the save tabs and quit feature, is there a way i can still use this function?

    ''Duplicate post, continue here - [https://support.mozilla.com/en-US/questions/815571]''
    I just downloaded Firefox 4 and i had a problem about my Norton spy-ware toolbar not being compatible, but anyway the most important thing that makes me pick Firefox over any other web browser is that i am able to save tabs and then exit. I think this was the greatest things because i could leave turn my laptop off and save power and when i got back i cold resume what i as doing. My question is just will you ever have this save tabs and exit function again or at least a way people would turn the function on by will.

    ''Duplicate post, continue here - [https://support.mozilla.com/en-US/questions/815571]''
    I just downloaded Firefox 4 and i had a problem about my Norton spy-ware toolbar not being compatible, but anyway the most important thing that makes me pick Firefox over any other web browser is that i am able to save tabs and then exit. I think this was the greatest things because i could leave turn my laptop off and save power and when i got back i cold resume what i as doing. My question is just will you ever have this save tabs and exit function again or at least a way people would turn the function on by will.

  • How to get an Adobe trusted function javascript to save a pdf form even if fields are empty?

    I have a form I have created in Livecycle designer which I want to save to a specific location using a combination of specific fields in the form. I have been able to do this by writing a trusted function and putting it in the adobe javascript file and then putting some code on a save button in the form. However, it may be that some of the fields (vfirstname and vsecondname) may be blank and i still want the form to save. Ideally i want to write an if statement to substitute those fields for other fields if they are blank but cant get the code to  work.
    Working code in trusted function file
    // SaveAs Function1 var mySaveDoc = app.trustedFunction(function(doc) { app.beginPriv(); var vDate1 = event.target.xfa.resolveNode("form1.page1.Table1.Row1.leftsideofform.Timeanddate.Dateofca ll").rawValue.toString(); var vfirstname = event.target.xfa.resolveNode(" form1.page1.Table1.Row1.rightsideofform.Prospectiveclient.ClientFirstname").rawValue.toSt ring(); var vsecondname = event.target.xfa.resolveNode("form1.page1.Table1.Row1.rightsideofform.Prospectiveclient.C lientsurname").rawValue.toString(); var myPath = "/MGLCC01-SV/MGPdata/Mihomecare/testce/" + vDate1 +"_" + vfirstname + "-" + vsecondname + ".pdf"; // saveAs is the only privileged code that needs to be enclosed doc.saveAs({cPath: myPath, bCopy: true, bPromptToOverwrite: true}); app.endPriv(); }); 
    Working code on save button in form
    form1.#pageSet[0].Newenquirymasterpage.Button1::mouseUp - (JavaScript, client) var txt = form1.execValidate(); //This script will validate all required fields event.target.mySaveDoc(event.target) xfa.host.messageBox("Document has been saved to shared drive", "File Saved", 3, 1); 
    IF code for trusted function file that I cant get to work
    // SaveAs Function1 var mySaveDoc = app.trustedFunction(function(doc) { app.beginPriv(); var vDate1 = event.target.xfa.resolveNode("form1.page1.Table1.Row1.leftsideofform.Timeanddate.Dateofca ll").rawValue.toString(); if (event.target.xfa.resolveNode("form1.page1.Table1.Row1.rightsideofform.Prospectiveclient. ClientFirstname").rawValue == " ")      {          var vfirstname = event.target.xfa.resolveNode("form1.page1.Table1.Row1.rightsideofform.Enquirer.EnquFirstn ame").rawValue.toString();      }      else      {          var vfirstname = event.target.xfa.resolveNode("form1.page1.Table1.Row1.rightsideofform.Prospectiveclient.C lientFirstname").rawValue.toString();      }     if (event.target.xfa.resolveNode("form1.page1.Table1.Row1.rightsideofform.Prospectiveclient. Clientsurname").rawValue == " ")      {          var vsecondname = event.target.xfa.resolveNode("form1.page1.Table1.Row1.rightsideofform.Enquirer.Enqsurname ").rawValue.toString();      }      else      {          var vsecondname = event.target.xfa.resolveNode("form1.page1.Table1.Row1.rightsideofform.Prospectiveclient.C lientsurname").rawValue.toString();      } var myPath = "/MGLCC01-SV/MGPdata/Mihomecare/testce/" + vDate1 +"_" + vfirstname + "-" + vsecondname + ".pdf"; // saveAs is the only privileged code that needs to be enclosed doc.saveAs({cPath: myPath, bCopy: true, bPromptToOverwrite: true}); app.endPriv(); }); 
    Can anyone suggest why the If code above doesn't work? or how i could get the form to submit even if the fields are blank?

    It can also work if you certify the document and each user chooses to trust it to execute privileged JavaScript, which may be feasible in this setting. The method you'd use is doc.saveAs: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.524.html
    Also, read the following tutorial: http://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript

  • Save As Trusted Function: Part II

    Continuing my previous thread:  http://forums.adobe.com/thread/509314?tstart=0
    I'm now working on another form requiring this same type of function, but there's a new wrinkle.
    How can I substitute fields if one of the fields to be used is blank or is a certain selection of a drop down ...
    i.e.      If fieldA = "other" use fieldB in place of fieldA in save as title.
    Thanks for any help / suggestions!

    I'm running into a problem here.
    The js file from my first thread works fine for that form.
    However, I've created a second folder js file for this form.  When the click event "event.target.myTrustFunct(event.target);" fires it attempts to use the first js file and thus does not work seeing as content and field names are different.
    How can I distiguish between what js file I'm trying to pull from for each trusted function?
    Any help is appreciated.
    Thanks.

  • Doc.saveAs() and filenames with commas

    Using Acrobat 9,  I have convinced myself that commas confuse the innards of the doc.saveAs() function. For example, from the console, the following throws an error:
    this.saveAs("john, jimmy.pdf");
    the error: "UnsupportedValueError: Value is unsupported. ===> Parameter cPath."
    I am more than a little stunned. It's been more than 10 years since the major operating systems allowed commas in the path.
    Am I overlooking something trivially obvious?

    Thanks for that link to the "wish forum".
    I have reported failure to accept commas in the path as a bug.
    I'll keep this question open for just a little longer.
    Does anybody know of any tricky escape character sequences that might solve the problem? I have failed with "\," and various ideas for nested quotes.

  • I'm having a problem sending a word doc via email. I have Mac for Office 08, when I save the document as a .doc or .docx, and send it to someone, they receive it as a blank document. Yet, when I open it on my Mac, it has a "word" icon. How do I fix?

    I'm having a problem sending a word doc via email. I have Mac for Office 08, and I'm using Mavericks OS. When I save the document as a .doc or .docx, and send it to someone, (doesn't matter if its safari, chrome or firefox or on my yahoo or gmail accounts) they receive it as a blank document. Yet, when I open it on my Mac, it has a "word" icon and I can read it. How do I fix?

    I suggest you post on the Microsoft Mac forums since it's their software you're having issues with.
    http://answers.microsoft.com/en-us/mac

  • Is there a way to disable 'Save as' and 'Send Email' function in Acrobat XI?

    Hi,
    Is there a way to disable 'Save as' and 'Send Email' function in Acrobat XI?
    Thnx in advance.

    I would hope there would be no way to disable Save AS that would reduce the applicationss capability. What are you trying to prevent happening?

  • How do I write a javascript code to open InDesign File, import Doc, save and export to pdf?

    How do I write a javascript code to open InDesign File, import Doc, save and export to pdf?

    Hi hasvi,
    Need Template(.indt), textframes etc for the following script:
    var myFolderInd = Folder.selectDialog();
    var myFile = myFolderInd.getFiles("*indt");
    app.open(myFile)
    var myDoc = app.activeDocument;
    var myDocName = myDoc.name;
    var mySaveFile = app.activeDocument.save(myFolderInd.fsName + "/" + myDocName.split(".indt").join(".indd"));
    var myFolderDoc = Folder.selectDialog();
    var myFile1 = myFolderDoc.getFiles("*doc");
    mySaveFile.pages[0].textFrames[0].place(File(myFile1))
    //~ mySaveFile.place(File(myFile1))
    app.activeDocument.textPreferences.smartTextReflow = true;
    var myPDFFile = new File(mySaveFile.filePath + "/" + mySaveFile.name.split(".indd").join(".pdf"))
    myDoc.exportFile(ExportFormat.PDF_TYPE, File("~/Desktop/abc.pdf"));
    alert("Process Completed")
    Regards
    Siraj

  • My hard drive died last week, and I needed to install a new one.  Previously, I was able to save a .doc with text and inserted photo to .pdf and then to .jpg.  Now I can get the .pdf but can't determine what to do to convert to .jpg.  Does anyone know ?

    My hard drive died last week, and I needed to install a new one.  Previously, I was able to save a .doc with text and inserted photo to .pdf and then to .jpg.  Now I can get the .pdf but can't determine what to do to convert to .jpg.  Does anyone know ?

    Rather than do that, which means starting over from scratch, losing all your edits, organisation and so on, why not simply use iPhoto Library Manager to revert the Library to the older version? Easier, less destructive.
    The instructions on that are here
    If you really want to start over: you can access the Originals folder simply by going to your Pictures Folder and finding the iPhoto Library there. Right (or Control-) Click on the icon and select 'Show Package Contents'. A finder window will open with the Library exposed.

  • Save and Cancel Functionality in WebDynpro application with Adobe Forms

    Hi,
    I want to create an application with Adobe Interactive forms. This application will have 3 buttons: Save As Draft, Submit and Cancel.
    This application also involves Workflow.
    On Save As Draft, the form will be saved for later viewing. How can I achieve this functionality? Does UWL support Save As Draft feature.
    On Submit, workflow is triggered and form is routed for approval.
    On Cancel, the form is deleted from the system and cannot be retrieved. How can I get this functionality?
    Issue: How to achieve Save As Draft and Cancel functionality?
    Regards,
    Vibha Singhal.

    It works well en SP 21.
    Thanks.

  • .doc file edit and re-save

    Hi.
    I need to read a word doc in jsp and replace <myName> with a String name = "Badleif" and re-save the file as a word document.
    Any idears.
    Badleif

    Either help this project: http://jakarta.apache.org/poi/index.html
    or use http://j-integra.intrinsyc.com/
    or change your fileformat to a more easily readable version.

  • Acrobat JavaScript Doc.SaveAs using "CHTTP", SSL, and PKI Authentication

    I'd like to load a client PKI certifricate into a Doc.SaveAs() SSL URL.  IE and Firefox do this fairly easily.  How can Acrobat do it?
    Thanks for reading.

    HI, Irosenth,
    from the API document, it does say
    saveAs
    5.0
    S
    S
    Saves the file to the device-independent path specified by the required parameter, cPath. The file is not saved optimized for the web. Beginning with Acrobat 6.0, the document can be converted to another file type (other than PDF) and saved as specified by the value of the cConvID parameter.
    Note: This method can only be executed during a batch or console event. See Privileged versus non-privileged context for details. The event object contains a discussion of JavaScript events.
    (Adobe Reader S): This method is available in Adobe Reader for documents that have Save usage rights.
    What does the underlined sentence mean? does it mean it should work on reader as well?

  • Why do I have to run a  doc.saveAs() prior to Inserting, Deleteing, or Extracting pages?

    MY SETUP:
    I'm using folder level javascripts.   In Acrobat I have the 'enable menue items javascript execution privledge' enabled,  In my actual folder level scrips I have them wrapped in a trusted function along with app.beginPriv()/app.endPriv().    My PDF's are coming from LiveCycle Designer which I then open and run in Acrobat.
    MY QUESTION:
    Through much trial and error and banging my head on the wall I've found that if I want to use insertPages(), extractPages() or deletePages() called as a trusted fucntion  on its own it won't work unless I first run a saveAs() function to create a new document file and only then can I run the desired function on the new saveAs'd doc.   I simply can't run an insertPages() on the current open doc without a saveAs first().    
    Why is that?
    I find that very frusterating and the resulting errors aren't a help.  If I don't SaveAs first I get security error or invalid function errors.
    EXAMPLE:
    Save As Function:
    var LCB_SaveAs = app.trustedFunction(function(doc, filename) {
        app.beginPriv();
        doc.saveAs(filename);
        app.endPriv();
    Insert Page Function:
    var TEST_InsertPage = app.trustedFunction(function(doc, filename) {
        app.beginPriv();
           doc.insertPages ({
               nPage: -1,
               cPath: filename
           app.endPriv();
    Javascript code in document to call the above functions:
    if(typeof(LCB_SaveAs) == "function") {
        if(typeof(TEST_InsertPage) == "function") {
            try {
                TempFileLocation = "/C/PATH/InsertTemp.pdf"
                LCB_SaveAs(event.target, TempFileLocation);
                try {
                    PathOfInsertDoc = "/C/PATH/FileToInsertIntoSaveAs'dDoc.pdf"
                    TEST_InsertPage(event.target, PathOfInsertDoc)
                catch(e) {
                    xfa.host.messageBox(e.toString().replace("RaiseError: ","") , 0, 0); 
            catch(e) {
                xfa.host.messageBox(e.toString().replace("RaiseError: ",""), 0, 0); 

    Hi George.  Yes I'm using static XFA forms which were created with PDF's as basic 'artwork' in the background and then my custom fields and script tunning on top. 
    I've tried running  a function (below) in the console, but did nothing -- maybe a syntack error.  I don't know what that may or may not mean though.  I'm not use to running stuff through the console so I could be doing it wrong.  My console experiance is limited to calling the path where the javascripts folder resides.
    Attempt script in console:
    var MJS_HN_Delete_RevisitForm = app.trustedFunction(function(doc) {
        app.beginPriv();
        doc.deletePages(15, 15);
        app.endPriv();
    and/or this:
    app.trustedFunction(function(doc) {
        app.beginPriv();
        doc.deletePages(15, 15);
        app.endPriv();

Maybe you are looking for