Re: Custom Page Size

Написал wOxxOm в 23/03/2010 10:26:02

нужно будет писать через winapi, иначе никак. Кури гуглы, должны быть примеры, я пользовал только чтение отступов:

Sub GetPrinterMargins(Optional L#, Optional t#, Optional r#, Optional b#)
    Const PhysicalOffsetX& = 112, PhysicalOffsetY& = 113, PhysicalWidth& = 110, PhysicalHeight& = 111, _
                HorzRES& = 8, VertRES& = 10, HorzSIZE& = 4, VertSIZE& = 6, _
                LogPixelsX& = 88, LogPixelsY& = 90
    Dim dpiX#, dpiY#, W#, H#, hDC&, s$
    s = Printers.Default.Name
    hDC = CreateDCW(StrPtr("WINSPOOL"), StrPtr(s), 0, ByVal 0&)
    If hDC = 0 Then Exit Sub
    dpiX = GetDeviceCaps(hDC, LogPixelsX): If dpiX = 0 Then Exit Sub
    dpiY = GetDeviceCaps(hDC, LogPixelsY): If dpiY = 0 Then Exit Sub
    L = ConvertUnits(GetDeviceCaps(hDC, PhysicalOffsetX) / dpiX, cdrInch, p_impUnit)
    t = ConvertUnits(GetDeviceCaps(hDC, PhysicalOffsetY) / dpiY, cdrInch, p_impUnit)
    W = ConvertUnits(GetDeviceCaps(hDC, PhysicalWidth) / dpiX, cdrInch, p_impUnit)
    H = ConvertUnits(GetDeviceCaps(hDC, PhysicalHeight) / dpiY, cdrInch, p_impUnit)
    r = W - ConvertUnits(GetDeviceCaps(hDC, HorzRES) / dpiX, cdrInch, p_impUnit) - L
    b = H - ConvertUnits(GetDeviceCaps(hDC, VertRES) / dpiY, cdrInch, p_impUnit) - t
    DeleteDC hDC
    marginTop = t: marginBottom = b: marginLeft = L: marginRight = r
    With chMargins
        hDC = InStr(.Caption, "(")
        .Caption = RTrim$(Left$(.Caption, IIf(hDC = 0, 99, hDC - 1))) & " (" & s & ")"
        .ControlTipText = "Top: " & RoundUnit(t, p_impUnit) & "; Left: " & RoundUnit(L, p_impUnit) & _
                                     "; Right: " & RoundUnit(r, p_impUnit) & "; Bottom: " & RoundUnit(b, p_impUnit) & _
                                     " — using default system printer: " & s
    End With
End Sub

Источник: https://powerclip.ru/modules/newbb/viewtopic.php?post_id=103318

Rambler's Top100