Hallo
Sinds 3.3 (windows) all PrinterSettings except the Printer Name are no
longer persistent and not stored anywhere not in the profile, not in
the document. Within the settings we have the "options" who are not
Printer specific and we have "Settings" who are bound to a specific
printer. Both are all lost after reloading the document, but we can only
use the Printer specific settings during the printing itself.
So PageSizes set "PrinterSettings" must been redone while actualy printing.
Setting the PageSizes using the API is also broken, please trye the
included code with a printer who accept to changes the PaperSizes
PLease can someone confirm this, so i can fill a issue
Greetz
Fernand
REM ***** BASIC *****
Sub printdocument
Dim Doc As Object
doc = thiscomponent
Dim PrinterProperties(0) As New com.sun.star.beans.PropertyValue
Dim PaperSize As New com.sun.star.awt.Size
PaperSize.Width = 20000 ' corresponds to 20 cm
PaperSize.Height = 20000 ' corresponds to 20 cm
'PrinterProperties (0).Name= "Name"
'PrinterProperties (0).Value= "Adobe PDF"
PrinterProperties (0).Name="PaperFormat"
PrinterProperties (0).Value= 8
'PrinterProperties (1).Name="PaperSize"
'PrinterProperties (1).Value= PaperSize
Doc.setPrinter(PrinterProperties())
'xray Doc.getPrinter
Doc.print(PrinterProperties())
Dim PrinterProps(1) As New com.sun.star.beans.PropertyValue
PrinterProps(0).Name="wait"
PrinterProps(0).value=true
PrinterProps(1).Name = "IsBusy"
dim bIsBusy as boolean
bIsBusy = True
While bIsBusy
'dim aPrintConditions as object
aPrintConditions = thiscomponent.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
wend
DisplayPrinterProperties
end sub
Sub DisplayPrinterProperties
Dim Props 'Array of com.sun.star.beans.PropertyValue
Dim i% 'Index variable of type Integer
Dim s$ 'Display string
Dim v '
Dim sName$ '
On Error Resume Next
Props = ThisComponent.getPrinter()
For i = 0 To UBound(Props)
sName = props(i).Name
v = props(i).Value
s = s & sName & " = "
If sName = "PaperOrientation" Then
REM com.sun.star.view.PaperOrientation.LANDSCAPE also supported
s = s & IIf(v=com.sun.star.view.PaperOrientation.PORTRAIT,_
"Portrait", "Landscape") & " = " & CStr(v)
ElseIf sName = "PaperFormat" Then
Select Case v
Case com.sun.star.view.PaperFormat.A3
s = s & "A3"
Case com.sun.star.view.PaperFormat.A4
s = s & "A4"
Case com.sun.star.view.PaperFormat.A5
s = s & "A5"
Case com.sun.star.view.PaperFormat.B4
s = s & "B4"
Case com.sun.star.view.PaperFormat.B5
s = s & "B5"
Case com.sun.star.view.PaperFormat.LETTER
s = s & "LETTER"
Case com.sun.star.view.PaperFormat.LEGAL
s = s & "LEGAL"
Case com.sun.star.view.PaperFormat.TABLOID
s = s & "TABLOID"
Case com.sun.star.view.PaperFormat.USER
s = s & "USER"
Case Else
s = s & "Unknown value"
End Select
s = s & " = " & CStr(v)
ElseIf sName = "PaperSize" Then
REM type is com.sun.star.awt.Size
REM The size is in TWIPS and there are 1440 twips per inch
s=s & CDbl(v.Width)/1000 & "x" & CDbl(v.Height)/1000 & " (cm)"
Else
s = s & CStr(v)
End If
s = s & CHR$(10)
Next
s= "Sometimes the PrinterName is correct but never the wanted
papersize
of 20x20 cm " &CHR(10) & s
MsgBox s, 0, "Printer Properties"
End Sub
--
-----------------------------------------------------------------
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help