Out-Print multiple sheets

Hi, I’m trying to send custom text to a printer, the text is just the name and surname of someone in a specific location, but something isn’t right.

I’m using a particular printer wich prints on cards, I have to write a text like:

NAME

SURNAME

in the bottom left corner, but something isn’t right. This is my code so far

$Nome = "NAME"
$Cognome = "SURNAME"

$str = " " + "`n " + "`n " + "`n " + $Nome + "`n " + $Cognome

Write-Output $str
$str | Out-Printer

If I just print a line of text it goes in the middle (kinda), so I tried to put line breaks, doing so the text on write-output is correct, but when it gets to the printing queque it creates multiple sheets and I don’t want that (I need to insert the card multiple times for every sheet).

With a single line of text it says printing sheet 1/1, but with my current code it says printing sheet 1/3

Any suggestion?

Ty in advance

if you want a single line centered, try using TABs versus new lines. Not sure how this will print, did not test that as I dont have access to a “real” printer right now.

$str = " " + "`t " + "`t " + "`t " + $Nome + "`t " + $Cognome
1 Like

Sounds like you want to fill in a preprinted formular … I’d try it with a here string like this:

$Nome = "NAME"
$Cognome = "SURNAME"

$HereString = @"

    $Nome

    $Cognome
"@

Write-Output $HereString
$HereString | Out-Printer

Of course you have to adjust the position of the variables inside the here string according to your formular.

2 Likes