Let me make a few guesses, they may be off base.
You have the following:
System.out.println(strOutput)
But, strOutput is actually comprised of strItem & strSpacer & strPrice (The name of the item, blank spaces or dots, then the price of the item).
Also, you know how wide the receipt is. That is, you know how many characters will fit nicely on each line. That number is your arbitrary maximum. It is arbitrary because if you find that it isn't big enough, there isn't a problem making it larger. When I refer to "number of characters per line" this is the value which I mean.
Now. The item's name should be left-aligned, the price right aligned. Is that correct?
If so, you need to compare the length of the two strings combined to the number of characters per line.
If there is room to spare, you need find out how many more characters will fit, then add that many characters to strSpacer, insert strSpacer in between the two strings and check again. If the length of the combined strings is the same as the number of characters per line, the line can be printed.
You will have to use an If block somewhere in this code.
+ how will i do this since the items inputted are unlimited until user inputs "done"
Youneed to limit that. Don't leave it up to the user to input a string which isn't longer than the line will accept. Write your program in such a way that it tells the user if they try to input a string which is too long. You can do this by changing your If block to an If-Else block. The If section check to see if the input is too long, and if it is the program tells the user and asks for a different input. The Else section performs the width check and adds characters to strSpacer if needs be (as above).
one more thing, say if i want 15 (char wise) but i get 20, how do i make the 20 into 15..
You shouldn't be doing that. If someone enters a string which is longer than your program is expecting it should either give out an error message, or you should modify your program to accept longer strings. In this case, I'd go with the error message as the maximum length acceptable should already be as long as will fit on the receipt.
Have a go at the If block and post that if you can't get it to work. If you do, make sure to tell us what the type and expected values for each variable are (unless it is obvious from the code). You'll also need to tell us how many characters you want the receipt to accept.