Public Sub GetPrinterResolution()
  Dim sResultPath, sResultRow As String
  Dim iPosition As Integer

  Shell "locate -b *.ppd | grep " & myPrinter.Name To sResultPath
  Shell "grep '*DefaultResolution:' " & sResultPath To sResultRow

  iPosition = InStr(sResultRow, Chr(58))
  iPrinterDPI = Mid(sResultRow, iPosition + 2, -4) ' FS-1030D = 600 dpi

End


Well...

Printer.Resolution ?

http://gambasdoc.org/help/comp/gb.qt4/printer/resolution?v3

This example can use Paint.width and paint.height to get the size of the support

Nevertheless:

I can do :

Public Sub Main()

  Dim hReportImage As New ReportImage(Report)

  Dialog.Path = User.Home
  If Not Dialog.OpenFile() Then
    Try hReportImage.Image = Image.Load(Dialog.Path)
    If Error Then
      Message.Error("Cannot Load Image: " & Dialog.Path)
      Return
    Endif
  Else
    Return
  Endif

  'The picture have it's good proportions
  hReportImage.Stretch = Report.Proportional
  'The Picture take all the space on the page
  hReportImage.Expand = True
  'a margin arround the page
  Report.Padding = ReportPadding["1 cm"]

  'Preview ? ... and printing
  Report.Preview()

End


It's less line of code for the same thing

If someone want to help me to document gambas reports...


And you can add this too :

if hReportImage.Image.Height < hreportImage.Image.Width then
Report.Orientation = printer.Landscape

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to