` Printed Icetips Article

Icetips Article



Icetips Products: Setting Reports Landscape
2004-12-14 -- Arnor Baldvinsson
 
If you use the Printer Selection Extension template on the Previewer procedure, it will not work properly if you have landscape reports and print them to a different printer than the default selected printer. THe reason is that the code in the Previewer doesn't detect if the original report is landscape and simply creates it using whatever setting is on the printer.

First make sure that you check the "Generate SetTarget" on the Previewer report extension.

Then follow these instructions that Jane Flemming sent me some months ago after having been through the same. I will get this into the next version of the previewer to make sure that this behaves properly without needing this modification:)

---- QUOTE BEGINS ----
Problem was that if I changed the printer, a print job that was landscape became portrait unless I remembered to set it to landscape in the printer properties screen. And the name of the print job reverted to JOB_CWDEFAULT.

A bit of head scratching led to the following resolution:

In Previewer procedure data:

LOC:LANDSCAPE     BYTE
In ThisWindow.Init, after you declare the reference:
  LOC:Landscape = ReportRef{prop:landscape}
In both ITPPrintToSelectedPrinter and ITPPrintCurrentPageToSelectedPrinter, after opening the report:
 ITPReport{PROP:Text} = clip(LOC:ReportJobName)
 ITPReport{Prop:Landscape} = LOC:Landscape
Of course, without your foresight of having generated the SetTarget reference, this wouldn't be possible. And from your having created the LOC:ReportJobName variable, I think the template may have intended to do something like what I inserted.

---- QUOTE ENDS ----

Please note that ANY references or use of the ReportRef reference variable can only be used if the SetTarget option is used on the report and any references to ReportRef must be done BEFORE the previewer window is opened. The reference is set at priority around 5800 and only if the "Select Printer" template is added to the previewer procedure. The generated code will look something like this:

  SELF.Errors &= GlobalErrors
  ! [Priority 5800]

  ! Initialize the procedure
   ReportRef  &= 0   ! Reference to the original report.
   Loc:ReportJobName = ReportRef{Prop:Text}
  CLEAR(GlobalRequest)
  CLEAR(GlobalResponse)

  SELF.AddItem(Toolbar)
  ! [Priority 6500]

  ! Procedure setup standard formulas
      Loc:OriginalPrinter = Printer{PropPrint:Device}
  ! [Priority 7300]

  ! Open the window
  OPEN(ITPreviewWindow)
Arnor Baldvinsson
Icetips Software



Printed November 23, 2024, 2:25 am
This article has been viewed/printed 35275 times.
Google search has resulted in 19 hits on this article since January 25, 2004.