Quantcast
Channel: PDFCreator - pdfforge forums
Viewing all articles
Browse latest Browse all 2633

Spool problems when printing pdf with dcom office interop

$
0
0

@mhp wrote:

Hi there,

having problems getting my code to work. Could need some advice :slight_smile:

I installed pdfcreator as local printer. Using powershell code to create an dcom instance for the queue access.

$PDFCreator = New-Object -ComObject PDFCreator.JobQueue
$PDFCreator.Initialize()

Now when i open microsoft word in the GUI, and issue a print order to my default printer the document is spooled to pdfcreator
Pdfcreator log is populated.
"$PDFCreator.counts" returns 1 and the files are located in "C:\users\%username%\AppData\Local\Temp\2\PDFCreator\Spool*" great.
Furhter processing with "$job = $PDFCreator.NextJob" works fine.

But my actual idea is to print in a headless session using dcom word automation.
Invoking basically the following:

$wordApp = New-Object -ComObject Word.Application
$wordapp.ActivePrinter # -> displays the default printer, looks good so far
$wordDocument = $wordApp.Documents.Open("C:\path\file.doc",$false,$true)
$wordDocument.PrintOut($false)
Pdfcreator log does NOT show ANY log activity(!)
"$PDFCreator.counts" returns 0 and the files are now located in "C:\users\%username%\AppData\Local\Temp\PDFCreator\Spool*"
Note the "\2\" is missing in the path.

When comparing the .PS associated .inf files, I recognized a difference in some lines

.inf from "C:\users\%username%\AppData\Local\Temp\2\PDFCreator\Spool*" -> GUI WORD created starts with:
[0]
SessionId=2
WinStation=RDP-Tcp#3

.inf from "C:\users\%username%\AppData\Local\Temp\PDFCreator\Spool*" -> DCOM WORD created starts with:
[0]
SessionId=0
WinStation=Services

Modifying the file content and moving it to the "other" directory did not cause $PDFCreator instance to find the files, as i hoped.
$PDFCreator.Count still returns 0

Any idea what i could do to solve that problem?

Best Regards,
Michael

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 2633

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>