Quantcast
Channel: Recent Discussions on pdfforge Forums
Viewing all articles
Browse latest Browse all 10270

cOutputFilename always empty on Windows Server 2012 R2

$
0
0
Hi everybody, 
I need some help: I use COM reference in Access 97 to create PDF from reports. In particular, this is the code I use actually:


Public Function PrintRep(RepName As String, Optional FILE_SAVE As String = "", Optional DIR_SAVE As String = "", Optional S_EZIONE As String = "") As String
 Dim PDFCreator1 As Object, DefaultPrinter As String, c As Long, _
  OutputFilename As String

 Set PDFCreator1 = CreateObject("PDFCreator.clsPDFCreator")
 
 With PDFCreator1
  .cStart "/NoProcessingAtStartup"
  .cOption("UseAutosave") = 1
  .cOption("UseAutosaveDirectory") = 1
  .cOption("AutosaveDirectory") = NZN(DIR_SAVE, na("CONFIG_FILE_PDF", D_A & "_DOCUMENTI\"))
  .cOption("AutosaveFilename") = NZN(FILE_SAVE, RepName)
  .cOption("AutosaveFormat") = 0                            ' 0 = PDF
  DefaultPrinter = .cDefaultPrinter
  .cDefaultPrinter = "PDFCreator"
  .cClearCache
  DoCmd.OpenReport RepName, acViewNormal
  .cPrinterStop = False
 End With

 c = 0
 Do While (PDFCreator1.cOutputFilename = "") And (c < (maxTime * 1000 / sleepTime))
  c = c + 1
  Sleep 200
 Loop

 OutputFilename = PDFCreator1.cOutputFilename

 With PDFCreator1
  .cDefaultPrinter = DefaultPrinter
  Sleep 200
  .cClose
 End With

 Sleep 2000 ' Wait until PDFCreator is removed from memory

......

End Function

The function allow me to generate and autosave a PDF starting from an Access' report, naming it with some ingoing data (i.e. the customer of the invoice).
This is perfectly working on Windows Xp, 7, 8, 8.1 and also Windows Server 2003-2008, but with Windows Server 2012 (R2), I can get PDFs only if I use the administrator's account; otherwise, it also works but it seems to skip the Autosave option, and ask me to manually save the file. The problem is that I need to generate various files, so I really need the autosave option but with a variable output filename. And in this case, the parameter .cOutputFilename is ALWAYS empty...
Any suggestions?

Viewing all articles
Browse latest Browse all 10270

Trending Articles