In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

TPrinter:nCopies

Xailer professional forum in English
User avatar
emeasoft
Posts: 1062
Joined: Wed Apr 01, 2009 4:12 pm
Location: emeasoft
Contact:

TPrinter:nCopies

Postby emeasoft » Wed Jul 24, 2019 4:49 pm

Hi,

When I try to print more than 1 copy of a document, changing "TPrinter:nCopies" property, as you can see below, doesn't work.

What I'm doing wrong?

Code: Select all

WITH OBJECT TPrinter():New()
  :Create()
  :nCopies:=2
  :lPreview:=.F.
  :nPrinterIndex:=myPrinterIndex
  :StartDoc()
  :WriteData(myText)
  :EndDoc()
  :Destroy()
END
 
User avatar
ignacio
Site Admin
Posts: 8573
Joined: Mon Apr 06, 2015 8:00 pm
Location: Madrid, Spain
Contact:

Re: TPrinter:nCopies

Postby ignacio » Wed Jul 24, 2019 5:50 pm

Hi,

You do not need to create a TPrinter object. There is already one. Try this:

WITH Printer
:nPrinterIndex:=myPrinterIndex
:nCopies:=2
:lPreview:=.F.
// :StartDoc()
// :StartPage()
:WriteData(myText) // This method does not need StartDoc(), StartPage(), EndPage() and EndDoc()
// :EndPage()
// :EndDoc()
END

You must SET everything after the printer is selected

BTW, if still does not work, I'm afraid the problem in not on our side. Check the sample PrinterInfo and you will that setting the nCopies property on code is reflected perfectly on the executable afterwards.

Regards,
Ignacio Ortiz de Zúñiga
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info

Return to “English”