
Die aktuelle Version des Codes (vom 14.06.2018 21:12) funktioniert hier offenbar einwandfrei:
PB 5.62 (x64) unter Windows 10, "gedruckt" mit PDF-XChange Lite 7.0 (Build 323.2)
=> alle 4 Spalten auf ca. 1 1/2 DIN A4 Seiten
Windows 10 (x64), standard MS-PDF Drucker funktioniert.HeX0R hat geschrieben:Ich habe nicht behauptet PDF Ausdrucke gehen nicht, ich habe gefragt, ob die o.g. Drucker bei irgendjemanden funktionieren.
Bei dir geht also der Microsoft Print to PDF oder hast Du irgendeinen anderen getestet?
Glaube ich weniger. Ich benutze diese Funktionen in meinem Modul ebenfalls, und ohne Probleme.mk-soft hat geschrieben:Liegt bei VectorTextHeight() und VectorTextWidth()
Scheint der Treiber bei PDF keine gültige Werte zu liefern...
Code: Alles auswählen
Global VectorFontID = LoadFont(#PB_Any, "Arial", 16)
...
If StartVectorDrawing(PrinterVectorOutput(#PB_Unit_Pixel))
If VectorTextHeight("X") = 0.0
VectorFont(FontID(VectorFontID))
EndIf
...
Nur Wenn man vorher keinen VectorFont gewählt hat und zu einem PDF-Drucker sendet.Micha122 hat geschrieben:Glaube ich weniger. Ich benutze diese Funktionen in meinem Modul ebenfalls, und ohne Probleme.mk-soft hat geschrieben:Liegt bei VectorTextHeight() und VectorTextWidth()
Scheint der Treiber bei PDF keine gültige Werte zu liefern...
Code: Alles auswählen
Procedure PrintListIcon(ListIcon, PageName.s = "Page {NUM}", LineThickness = 2)
Protected i, j, k, Count, Columns, NewLine, CurrentPage, LastLineReached
Protected OutputHeight.d, OutputWidth.d, SizeFactor.d, PixPos.d
Protected XSpaceBetweenTextAndTable.d, YSpaceBetweenTextAndTable.d, XSpaceBetweenEdgeAndTable.d, YSpaceBetweenEdgeAndTable.d
Protected H.d, size.d, OverallSize.d
Static DefaultFontID.i, BoldFontID.i
If Not DefaultFontID
DefaultFontID = FontID(LoadFont(#PB_Any, "Arial", 16))
BoldFontID = FontID(LoadFont(#PB_Any, "Arial", 16, #PB_Font_Bold))
EndIf
If IsGadget(ListIcon) = 0 Or GadgetType(ListIcon) <> #PB_GadgetType_ListIcon
ProcedureReturn
EndIf
Columns = GetGadgetAttribute(ListIcon, #PB_ListIcon_ColumnCount)
Dim Widths.d(Columns)
If PrintRequester() And StartPrinting("ParameterList")
OutputHeight = PrinterPageHeight()
OutputWidth = PrinterPageWidth()
Count = CountGadgetItems(ListIcon) - 1
If StartVectorDrawing(PrinterVectorOutput(#PB_Unit_Pixel))
VectorFont(DefaultFontID)
H = VectorTextHeight("P°²gT_")
YSpaceBetweenTextAndTable = H / 4 ;<-- spacing between table line and text on top and bottom, 25% of max text height
XSpaceBetweenTextAndTable = VectorTextWidth(" ") ;<-- spacing between table line and text left and right, one space here, add more if needed
YSpaceBetweenEdgeAndTable = OutputHeight / 20 ;<-- spacing of 1/20 of complete width will be used left and right of the table
XSpaceBetweenEdgeAndTable = OutputWidth / 20 ;<-- spacing of 1/20 of complete height will be used on top and bottom of the table
;find max column widths
For j = 0 To Columns - 1
Widths(j) = VectorTextWidth(GetGadgetItemText(ListIcon, -1, j))
Next j
For i = 0 To Count
For j = 0 To Columns - 1
size = VectorTextWidth(GetGadgetItemText(ListIcon, i, j))
If size > Widths(j)
Widths(j) = size
EndIf
Next j
Next i
;Add some more space for each column, in front and behind the text
size = 0
For j = 0 To Columns - 1
Widths(j) + 2 * XSpaceBetweenTextAndTable
size + Widths(j)
Next j
OverallSize = size
size + (Columns - 1) * XSpaceBetweenTextAndTable + XSpaceBetweenEdgeAndTable * 2
SizeFactor = OutputWidth / size
OutputWidth = OutputWidth / SizeFactor
OutputHeight = OutputHeight / SizeFactor
NewLine = #True
ScaleCoordinates(SizeFactor, SizeFactor)
H + YSpaceBetweenTextAndTable * 2
For i = 0 To Count
If NewLine
;print Header
PixPos = YSpaceBetweenEdgeAndTable
VectorFont(BoldFontID)
For j = 0 To Columns - 1
size = 0
For k = 0 To j - 1
size + Widths(k)
Next k
AddPathBox(XSpaceBetweenEdgeAndTable + size, PixPos, Widths(j), H)
MovePathCursor(XSpaceBetweenEdgeAndTable + XSpaceBetweenTextAndTable + size, PixPos + YSpaceBetweenTextAndTable)
DrawVectorText(GetGadgetItemText(ListIcon, -1, j))
Next j
StrokePath(LineThickness)
NewLine = #False
PixPos + H
EndIf
VectorFont(DefaultFontID)
For j = 0 To Columns - 1
...