Results 1 to 6 of 6

Thread: VBscript save PDF-file

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2021
    Posts
    3

    VBscript save PDF-file

    Hello,

    I'm looking for some kind of script that automatically saves a PDF-file when printing.

    Example:
    I open a PDF-file in my browser. I print this file and then automatically the script saves the PDF-file somewhere.

    Is this possible?

    Thanks in advance,

    Schiavoni

  2. #2
    Frenzied Member jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,838

    Re: VBscript save PDF-file

    Possible, probably, but why?

    You already have a copy of a .pdf file. You open it in a web browser and then print another copy, then you want to copy that copy.

    Why not just copy the file to where you want it in the first place? A better explanation of exactly what you are trying to achieve would help us suggest a method for doing what you really want.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2021
    Posts
    3

    Re: VBscript save PDF-file

    The PDF-file is uploaded in our portal. I have to print this PDF-file. After a few days, the PDF-file is automatically deleted from our portal.

    What I want, is that the PDF-file is automatically saved somewhere on the harddisk when I click on the file. Otherwise I have to save it manually each time I open it and print the file.

  4. #4
    Frenzied Member jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,838

    Re: VBscript save PDF-file

    OK, that explanation of what you are wanting to do makes more sense.

    A vbScript that prints the file and then copies to to an archive folder might be what you are looking for.

    The script at the link below will print the .pdf file. Note that it needs to be printed from Adobe Acrobat Reader, and Adobe Acrobat Reader must be the default application for opening .pdf files. I do not recommend using a web browser for opening and printing .pdf files for a wide variety of reasons.

    https://www.robvanderwoude.com/sourc...c=printpdf_vbs

    You can then add some code to the end of this script to copy the file to an archive folder. I assume that you will always be copying the file to the same archive folder, and that the source folder will always be the same. That should simplify the process, since you can hard-code the folder paths in the script.

    Example file copy script:

    https://stackoverflow.com/questions/...ng-vbscripting

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2021
    Posts
    3

    Re: VBscript save PDF-file

    Thanks for the answer. I have installed Adobe Acrobat Reader DC and set it as default application for opening .pdf files. When I start the the script, I get this message:
    Attachment 180893

    I've placed the PDF-file in the same directory, but it's not printing the file. I haven't edited the script.

    A copy of the file must be made in some folder, when printing the PDF-file.
    Last edited by Schiavoni; Apr 1st, 2021 at 04:50 AM.

  6. #6
    Frenzied Member jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,838

    Re: VBscript save PDF-file

    That attachment did not upload correctly, unfortunately. The forums are currently having issues with the attachments.

    What did the message say? Post the exact message text here. I am guessing that you need to alter the script to make sure that the correct .pdf folder path is being used, but that is just a guess without knowing what the error message was.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width