The use of javascript to save a pdf file in a different directory and generating a new file based on the form fields in the document name.

I built the following script to create a submit button that will automatically save the document in a different directory on my computer. It will also use data form 'customer' field and 'date' to generate the file name. I printed the myPath variable, and it seems that he printed the correct string. I get the following error:

TypeError: redeclaration of const path

any help would be appreciated.

var customer = this.getField("Customer").value;

var date = this.getField("Date").value;

var path = "C:/users/lead/My Documents/Test / '.

Reg = date.match(/(\d+)\/(\d+)\/(\d+)/ var);

var myPath = "C:/users/lead/My Documents/Test /" client + '_' + reg [1] + "." + reg [2] + "." +

Reg [3] + ".pdf";

this.saveAs (myPath);

Thank you. It turns out that simply remove this additional path variable does the job. I used that in an earlier version of my code and I forgot that this is. My syntax also seems to be right.

Tags: Acrobat

Similar Questions

  • When you use Internet Explorer, cannot save a PDF file.  Adobe Acrobat message "the document could not be saved.  Access denied"may be logged when you use the Google browser.

    When you use the browser Internet Explorer, PDF files saved cannont.  Message from Adobe Acrobat: "document not saved County. Access denied.  Same PDF can be saved when you use Google.

    Hello

    I use Adobe Acrobat 11.0.10 - Windows 7 - Office 2013 - Internet Explorer 11.  Compatibility according to the link is OK.

    Thank you

  • What version of Acrobat should I buy if I want to edit a pdf file, so it has form fields

    I need to be able to change/credit a pdf document so there form fields.

    Do I need to buy Acrobat Pro DC or DC Standard Acrobat?

    Either you are allowed to do.

    Fri, 16 Sep 2016-17:27, lloydl9661889 [email protected]>

  • Whenever I try to save a PDF file using Adobe Acrobat DC (Version 15.1), I get the error "the document could not be saved. There was a problem reading this document (21). »

    Whenever I try to save a PDF file using Adobe Acrobat DC (Version 15.1), I get the error "the document could not be saved. There was a problem reading this document (21). "When I click ok, an error message appears saying:"insufficient data for an image. "I tried to do a repair on Acrobat, but it has not changed anything. I also tried some updates, but nothing that is. I did hours of research on the Internet and have found nothing so far. Does anyone know why this error keeps appearing?

    Thank you!

    Hi all

    This problem has been corrected and is implemented to come or update.

    Kind regards

    Rave

  • Is there anyway to save a PDF file as an Excel workbook? I use Vista Home Premium.

    I tried to copy/paste, except as - can only save as PDF file.  I tried to use Adobe, but it doesn't allow me to do unless I purchase the program.  I have only about 6 or 8 documents to convert, so I don't want to spend the $$ that Adobe wants.   Is it possible through the window or Microsoft Office?

    Hello

    Check the following link to convert a PDF file to Excel file.

    http://blogs.Adobe.com/acrobatforlifesciences/2009/03/converting_a_pdf_file_to_excel/

    http://www.Adobe.com/products/acrobatpro/PDF-to-Word-Excel-converter.html

    Also check out the following link to convert Office in PDF files.

    http://www.Microsoft.com/en-US/Download/details.aspx?ID=9943

    http://Office.Microsoft.com/en-us/Excel-help/save-as-PDF-HA010064992.aspx

  • Save a PDF file cannot be modified, losing the file HAVE changed.

    It's great that illustrator can edit PDF files and it's great that Illustrator can record on a non editable PDF. But why, for the love of sanity, I would like to save a PDF file cannot be modified, but then have the original file, currently open HAVE disappear leaving only this little pointless PDF file? I STILL want the file HAVE to remain the main current job file original. But it doesn't work.

    Or if, for some reason I can't understand, this behavior is necessary, and right, then at least it should show unequivocally that I am to modify a PDF file cannot be modified and strongly suggest to me that I might want to save an editable PDF or HAVE a file, or even do it automatically until I close the file (or Illustrator crashes as it is wont to do).

    I'm working on a file HAVE and I need to save a small file of WIP not editable for the customer display. I go to file - save as-> PDF / smaller file size / uncheck "preserve Illustrator editing capabilities". I send the PDF file to the client and continue to work and save, assuming that I'm working on the original. The file looks and behaves exactly as it did until I taped that, intuitively, I guess that is the file HAVE same, original, with the PDF file in a copy. However, when I come back the next morning, after having closed the file, only the low resolution not editable PDF file remains. The file doesn't help, and I have to redo all the work all the way back to the last time, I saved the file I saved the PDF.

    Much trouble, loss of hair, the time wasted, face Palm trees, etc.

    The thing is, I now /know/ does and I'm going out of my way to avoid it happening, but in the race at the end of the work and send commands to the client and manage multiple versions of files, it still happens. Now clearly this is my fault, but heck, Illustrator could behave much more usefully in this regard!

    Well, I must be missing something, I guess.

    I asked how "save a copy...". "is the way lasts, and you replied that you were referring to not using Save a Copy... So I re - submit that by using Save a Copy is the solution to your original problem.

    • Work in Illustrator; number of objects; several layers, live effects, etc.
    • Want a copy of WIP for the customer as you have described originally...
    • Choose file > save a copy... Format is not question could make no editable PDF, raster format, whatever...
    • Continue to work in Illustrator... under a State record which is absolutely no different than if I had never done the Save a Copy... There is no "silent dump' edit-ability or any such similar event. If I record, I save it HAVE original, or a new if the State was not saved.
  • Save a PDF file as a shortcut the need for PostScript files

    My workflow requires me to save a PDF file as PostScript files. Can I put up of preferences or create a keyboard shortcut in Acrobat that will allow me to bypass the dialog box "Save as"? I was not able to find a way to do this and it would save me tons of time and aggravation. I use Acrobat X on Mac OS x Lion.

    If you have the Pro. Acrobat X version, you can create an Action to be performed by the steps you want to automate.

  • How to save a PDF file in Adobe so it appears correctly in the Firefox default drive?

    I have seen discussions on how to change your own settings of Firefox for poster correctly PDF files (documents to look at a PDF in Firefox 19 +) However, I'm looking for a solution on how to save a PDF file so that they display correctly in the new default Firefox reader. Our files PDF is bad looking and I can not go in the browser of each clients and difficulty settings (http://www.cherrybekaertbenefits.com/wp-content/uploads/2014/07/ACA_Infographic_072114.pdf). Meet them all parameters within the Acrobat Distiller is going to fix this without the Viewer to enter their own arrangements?

    Hmm, not a subtle difference.

    We did not have many experts PDF or Adobe Illustrator users post advice here; those who might be sprinkled around on other forums, blogs or support sites.

    I noticed when you view the properties of the PDF in Adobe Reader that the PDF has been created with optimization for active fast Web view. This is a feature that allows the progressive rendering of PDF files over a slow connection (http://helpx.adobe.com/illustrator/kb/optimize-native-pdf-file-sizes.html#...). You can try to re - generate the PDF file with this feature turned off to see if that makes a difference?

  • Unable to save a PDF file to the desktop or the Paticular folder

    Hi all.

    I had problems for the last two days trying to save my PDF invoices, etc. When I download the PDF and select, "save under" another window will open that displays usually my files I have, but now it appears white. No idea why this is happening and how I can fix this problem?

    I want to save my PDF files on certain folders on my desktop and in the Cloud Drive.

    Thanks in advance.

    Try the following: open Acrobat Preferences (Edit > Preferences), then go to the category "General" and disable the two options 'display... online storage '. ». Which solves your problem?

  • Save a PDF file: can I NOT the window 'Save As PDF' come?

    When I save a pdf file, I would just have the pop-up window which allows me to record on my computer... whenever I choose.

    Currently, when I go on ' file > save under "a window opens which is called,"Save as PDF ". It is relatively new, and I find it tiresome. Is there a preference which have me just save like any other document?

    I'm on a Mac under Acrobat Pro DC. Thank you!

    Julie

    Hi Julia,

    Please try this:

    Go to Acrobat > Preferences > General

    Uncheck the option: view the online storage when you save files

    Click OK

    I would like to know if it works.

    Thank you

    Abhishek

  • How to save a pdf file so that the tool pane is not displayed

    How to save a pdf file so that the tool pane does not appear when the file is opened?

    Ah!  Thank you.  You are a star.

  • I have updated to DC (about a month) and cannot save my PDF files more.  What is the cause of the dialog box "Save as" do not open?

    I have updated to DC (about a month) and cannot save my PDF files more.  What is the cause of the dialog box "Save as" do not open?

    Hi mwebsterdps-sc,.

    Try this: -.

    The default "Save as" dialog Acrobat DC is different from the dialogue box you had in earlier versions of Acrobat, it also allows you to record in the clouds and previous locations that you saved the files. It is possible that when Acrobat tries to connect to the 'cloud', it runs into problems. You can try to disable this feature to see if this brings your backup in the back of the box: open Acrobat Edit menu access-> Preferences, then go to the "General" category and uncheck "show the online storage when you save files:

    I would like to know if it works.

    Kind regards
    Nicos

  • How to save a PDF file in order to open them up to the 100% instead of 177% zoom?

    Currently all of the PDF files I record 177% still open. It is not very legible and requires users to zoom in to 100% in order to see the entire document. I would like to save my PDF files so they automatically open to 100% (AKA Fit to Page) whenever a customer opens to them. Is this possible? I tried several methods, but even check adjust to Page in the menu print and then to print a PostScript does not. Any help is greatly appreciated!

    Open the file in Acrobat Pro, set the initial view, and then save the file.

  • How to save a PDF file as an XML using Adobe Acrobat Pro XI?

    Each save because is has encountered an error "PDF files that contain XFA forms can be saved in the specified format.".  This error prevents save the PDF to another type of file.  Please send your suggestions.  Thank you

    The message is pretty clear, right? You cannot export forms XFA (those created in LiveCycle Designer) to other formats.

  • additional window opens each time I want to save a pdf file

    Hello

    I use adobe acrobat reader on a windows 7 Professional laptop (lenovo) dc.

    It's really annoying that every time I wanto to save a pdf file, it opens this additional window where I am asked to choose a carpet for the file. Then, there are 4 different mats, I have used it before and then opens the normal window where I can actually save the file. I just want to cancel the first step, because it takes so long if there's always a step more before the Save.

    can someone help me with this problem?

    welcomes kevin

    Hi kevinh57662472,

    You could uncheck 'Show online storage to save files' under ' Edit > Preferences > general.

    Click OK, and then restart your application.

    Hope that helps.

    Kind regards

    Ana Maria

Maybe you are looking for