SalReportSetPrinterSettings

forum.reportbuilder (2000-2005) & forum.td.reportbuilder (2005-2010)
NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

SalReportSetPrinterSettings

Post by NewsgroupServer » 21 Apr 2010, 12:44

 Posted by:  Michael 

Hello,

i,ve got a problem with printing labels.

The labelprinter cut the label at the end of the print. But if i use the
following statement there is an mismatch with millimeter and miiliinches.

Call SalReportSetPrinterSettings( hWndReport, l_sStdDevice, RPT_Portrait ,
RPT_PaperCustom , 4000, 4000)

The report stops at 4000 milliinches and the printer cut at 4000 millimeter.
What i want is that both, the report and the printer, uses milliinches or
millimeter but not mixed.

(the labels are for packaging an the length depends on the number of goods)

We use TD5.2.

Is there any solution or a workaround?

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

SalReportSetPrinterSettings

Post by NewsgroupServer » 21 Apr 2010, 13:25

 Posted by:  Elio Boezio 

Hi Michael,

I've never seen the function "SalReportSetPrinterSettings", I can't find it in the on line help and I don't have a solution, but I'm curious: if the "4000" parameters refer to "milli-inches" (i.e. 1/1000s of an inch) then 4000 milli-inches = 157.48 inches, or just over 13 feet... that's quite a long label... is that correct?

Regards,
Elio

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

SalReportSetPrinterSettings

Post by NewsgroupServer » 21 Apr 2010, 14:36

 Posted by:  Michael 

Hello,

Wikipedia:

1 Inch = 1000 mil = 1/12 ft = 1/36 yd = 25,4 mm = 2,54 cm = 0,254 dm = 0,0254 m.

Online Help TD5.2:

SalReportSetPrinterSettings

bOk = SalReportSetPrinterSettings (hWndReport, strPrinterName, nOrientation, nPaperType, nWidth, nHeight)

Sets the printer properties at runtime. The function should be called in the message action of SAM_ReportStart message.

Parameters

In most cases, passing an invalid value in a parameter causes that parameter to be ignored, and the default printer setting is retained instead.

hWndReport Report window handle. The handle of a report window.

strPrinterName String. Friendly name of the printer. eg: "HP LasertJet 5", "\\\\machinename\\HP DeskJet 610C" (for network printers). Pass STRING_Null or an empty string if you do not want to switch the printer. If you pass an invalid name in this parameter, the function will fail. If you use a network printer name in conjunction with a call to SalReportView, your changes are ignored when the user presses Print from the report viewing window. To ensure that your changes take effect, use a network printer name in conjunction with SalReport Print instead.

nOrientation Number. Paper Orientation. This can be one of the following constants:

RPT_Portrait for portrait mode.

RPT_Landscape for landscape mode.

Use -1 if you do not want to change the orientation.

nPaperType Number. Paper type. This can be one of the following constants

RPT_PaperA3

RPT_PaperA4

RPT_PaperA5

RPT_PaperB5

RPT_PaperLegal

RPT_PaperLetter

RPT_PaperTabloid

RPT_PaperCustom

Use -1 if you do not want to change the paper type

nWidth Number. Paper width in milli-inches. This value is ignored for all paper types except for custom.

nHeight Number. Paper height in milli-inches. This value is ignored for all paper types except for custom.

Return Value:

bOk is TRUE if the function succeeds and FALSE if it fails.

Example

The following code will set the report to print on the printer "HP LaserJet 5", with orientation as Portrait, paper type as A4, first page tray as "Upper Paper tray" and other pages tray as "Lower Paper tray"

Message Actions

On SAM_ReportStart

Call SalReportSetPrinterSettings( SalNumberToWindowHandle(wParam), "HP LaserJet 5", RPT_Portrait, RPT_PaperA4, 0, 0)

Regards,

Michael

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

SalReportSetPrinterSettings

Post by NewsgroupServer » 21 Apr 2010, 14:49

 Posted by:  Michael 

Hello,

little mistake:

The report stops at 4000 milliinches (~102mm) and the printer cut at 400 millimeter.

Return to “td.reportbuilder”

Who is online

Users browsing this forum: Ccbot [Crawler] and 0 guests