+ Reply to Thread
Results 1 to 7 of 7

PDF Printing of sheets from task scheduler when client is logged off is not working..Help!

  1. #1
    Registered User
    Join Date
    08-30-2012
    Location
    Pune
    MS-Off Ver
    Excel 2007
    Posts
    13

    PDF Printing of sheets from task scheduler when client is logged off is not working..Help!

    Hi, I have below code which works perfectly when i run the code manually. But now i am trying to run this code in task scheduler when i am logged off from client. Task scheduler is already running other codes successfully. Task scheduler starts this code but then do not complete the run and gets stuck somewhere which i cant see as i am client and it runs on server. I am wondering if something is wrong with Acrobat Distiller or AcrobatPDFMakerX references which do not allow "FiletoPDF" when user is logged off. Your help will be much appreciated.thanks.

    Code to Print to pdf is

    "
    Private appDist As cAcroDist
    Sub Printer()
    Dim ReportPath As String, FName As String
    ReportPath = DNU.Cells(1, 2)
    sPDFVersionAndPort = "CutePDF Writer on CPW2:"
    Set appDist = New cAcroDist
    FName = "Data Report"
    PSName = ReportPath & FName & ".ps"
    PDFName = ReportPath & FName & ".pdf"
    PrintPDF sPDFVersionAndPort, PSName, PDFName
    ThisWorkbook.Close True
    End Sub

    Sub PrintPDF(ByVal sPDFVersionAndPort As String, ByVal sPSFileName As String, ByVal sPDfFileName As String, _
    Optional ByVal sJobOptions As String)

    Dim LogName As String
    If Dir(sPSFileName) <> "" Then Kill sPSFileName
    Debug.Print sPDfFileName
    If Dir(sPDfFileName) <> "" Then Kill sPDfFileName
    ALL_BONDS.Select
    ActiveWindow.SelectedSheets.PrintOut ActivePrinter:=sPDFVersionAndPort, _
    PrintToFile:=True, PrToFileName:=sPSFileName 'Prints to PS

    Call appDist.odist.FileToPDF(sPSFileName, sPDfFileName, sJobOptions)

    Kill sPSFileName 'Removes PS

    LogName = Left(sPSFileName, Len(sPSFileName) - 2) & "log"
    If Dir(LogName) <> "" Then Kill LogName
    End Sub

    "

    Also there is a class module which has below code

    ''requires references:Acrobat Distiller; AcrobatPDFMakerX
    Option Explicit

    Public WithEvents odist As PdfDistiller

    Private Sub Class_Initialize()
    Set odist = New PdfDistiller
    End Sub

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: PDF Printing of sheets from task scheduler when client is logged off is not working..H

    Are you sure the server has Adobe installed?

  3. #3
    Registered User
    Join Date
    08-30-2012
    Location
    Pune
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: PDF Printing of sheets from task scheduler when client is logged off is not working..H

    Yes its installed, in fact its cloud computing so whatever i see on my desktop is actually from server only, i dont have seperate cpu.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: PDF Printing of sheets from task scheduler when client is logged off is not working..H

    What's the path you're saving to? Generally mapped drives won't work when you're running a command when logged off. You'd need to use the full path and run with the highest privileges.

  5. #5
    Registered User
    Join Date
    08-30-2012
    Location
    Pune
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: PDF Printing of sheets from task scheduler when client is logged off is not working..H

    Thanks Kyle123. I am looking into it if that is the problem. will get back to you soon.

  6. #6
    Registered User
    Join Date
    08-30-2012
    Location
    Pune
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: PDF Printing of sheets from task scheduler when client is logged off is not working..H

    Hi Kyle, I found out what is the problem. EULA does not permit the use of Acrobat (and it's components such as Distiller) in a server/service environment. If one need a server product, Adobe offer the Adobe LiveCycle ES family - in my case, the PDF Generator product! and that i cant afford
    BTW i am still checking for other workarounds....

  7. #7
    Registered User
    Join Date
    08-30-2012
    Location
    Pune
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: PDF Printing of sheets from task scheduler when client is logged off is not working..H

    HI Kyle,

    Problem solved! Now i am using freedist.exe program to convert .ps to .pdf and it wroks perfectly with task scheduler. thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1