Herter,
don't sea your exact problem but please find the correct way to print in
Basic
oDocument.setModified(false)
Dim mPrinter(1) As New com.sun.star.beans.PropertyValue
mPrinter(0).Name="wait"
mPrinter(0).value=true
mPrinter(1).Name = "IsBusy"
dim bIsBusy as boolean
bIsBusy = True
While bIsBusy
dim aPrintConditions as object
aPrintConditions = oDocument.getPrinter()
dim i as integer
For i = LBound( aPrintConditions ) To UBound( aPrintConditions )
If aPrintConditions(i).Name = "IsBusy" Then
bIsBusy = aPrintConditions(i).Value
EndIf
Next
Wait 10 ' Wait is a built in Basic statement
WEnd
oDocument.Print(mPrinter(0))
hope it helps
Fernand
I tried changing my Java code to use the XDispatchHelper to make the
.uno:Printer and .uno:Print calls, but that just resulted in nothing printing
with no errors coming out of the API. Looks like I am going to have to figure
out how to call a macro and pass in the values and hope that works.
-----Original Message-----
From: Herter, Scott [mailto:scott.her...@napersoft.com]
Sent: Sunday, December 19, 2010 9:44 AM
To: dev@api.openoffice.org
Subject: RE: [api-dev] OpenOffice 3.2.1 not printing on Windows Servers through
the API
I got the macro working at least similarly to what we are trying to do in the
java code. It seems to be working correctly on the Server. Kudos for the
record macro working to record the choices on the print dialog, in the 2.x
versions it did not (or at least I don't remember it recording anything).
In our code we create an XPrintable interface and call setPrinter and Print.
The macros use the dispatcher and dispatches to .uno:Printer to set the printer
and .uno:Print to do the print. Running the macro through the UI of OpenOffice
works on the server, I haven't worked out a way to call the macro from our Java
code and pass in the values we need to set the printing options and the printer
name. I just need to look up the documentation for that (at least I am
assuming a way exists and I just have to find it).
-----Original Message-----
From: Herter, Scott [mailto:scott.her...@napersoft.com]
Sent: Sunday, December 19, 2010 8:53 AM
To: dev@api.openoffice.org; and...@pitonyak.org
Subject: RE: [api-dev] OpenOffice 3.2.1 not printing on Windows Servers through
the API
Yes, you did because I didn't provide the information. Sorry about that.
1. The macro I ran was the "executeDispatch() for uno:PrintDefault" call, not
the xprintable.print call. That was because I simply did a record of pressing the print
button on the tool bar. I still find the way the API is used in macros very confusing
and very different then calling it from my Java program.
2. I ran the macro interactively through the menus on OpenOffice, I did not
call the macro from my Java program (don't know if that makes a difference yet).
-----Original Message-----
From: Andrew Douglas Pitonyak [mailto:and...@pitonyak.org]
Sent: Saturday, December 18, 2010 10:57 PM
To: dev@api.openoffice.org
Subject: Re: [api-dev] OpenOffice 3.2.1 not printing on Windows Servers through
the API
I really do not understand this. Let me restate the part the confuses me:
(1) I can print using a macro with no problem.
(2) I cannot print using the API
When you use a macro, you use the API; or did I miss something?
On 12/18/2010 12:05 PM, Herter, Scott wrote:
We have encountered a strange problem that involves OpenOffice 3.2.1 (also
reproduced with OpenOffice 2.4 but does not reproduce with OpenOffice 2.1) on
Windows Server 2003 R2, 2008, and 2008 R2. The basic problem is that it does
not print through the API. The interesting thing is that the same program with
the same version of OpenOffice works on Windows XP and Vista.
If we run OpenOffice interactively on the Windows Server box and print through
the menus or through a Macro it works, but when we try to do it through the API
nothing happens. No exception and nothing shows up in the Windows print queue.
We are using a Java program to talk to OpenOffice through the UNO API and we
have tried both Java 5 and Java 6 with the same results.
Convert to PDF, load and close work through the API, just not print. The call
to xprintable.print simply returns (type void so there is no return code to
check) as if it worked. I changed the code to not close the document after
printing and I can press the print button and the document that just failed to
print through the API would show up in the print queue.
Our current thought is that Microsoft changed something in the security model
and maybe we need to do something different with permissions or with the print
API under the newer servers. I have done a number of Google searches and
checked the API doc to see if something changed with regard to printing, but it
looks like we are doing everything correctly and it does work on XP and Vista.
If anyone knows of anything we would appreciate some help.
On the assumption that no-one has heard of this before these are the steps I
will be taking over the next several days to try and isolate the problem
further.
1. Create a small stand alone program that reproduces the problem with a
test document.
2. Currently the servers are all running as Microsoft HyperV virtual
machines whereas the XP and Vista boxes were running native on the hardware.
After creating the test program I will run it on a server that is not a virtual
machine and see if it still re-creates.
3. Since Macros seem to work I will try and find an API call that lets me
run a macro and pass it in parameters to fill in the properties for the print.
Thanks.
--
I used to think I wasn't a morning person, but things never got better after
lunch.
-- Wally from Dilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org