Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Printing to printer - Linux - LPRINT alternative?
#21
(05-30-2023, 02:34 AM)desA Wrote: 2.  SHELL - rm old files. SHELL cat file1.txt file2.txt >> file_summary.txt etc

This is a step that could be bettered and it's possible to save slow calls to the command processor. Did you take a look at what I proposed in post #14? It's possible to put text files together, which have to be loaded from disk, to create a big temporary text file that is then exported to PDF. Only you need to be organized about it according to the series numbers used for the small text files generated by your project.
Reply
#22
Progress update

Thus far (working well):
1.  Capture text in lumps - per major print subroutine (8 off them) - write to txt. Some display/print depending on menu choices in the design.
2.  SHELL - rm old files. SHELL cat file1.txt file2.txt >> file_summary.txt etc
3.  SHELL linux convert txt->ps
4.  SHELL linux convert ps->pdf
5.  Launch pdf readers

*************
Limit/memory bleed in excessive use of SHELL command - scrambles output. 
Suspect SHELL buffer limit was exceeded.
Wrote external BASH routine and called that from SHELL instead.
Reply
#23
(05-30-2023, 07:20 AM)mnrvovrfc Wrote:
(05-30-2023, 02:34 AM)desA Wrote: 2.  SHELL - rm old files. SHELL cat file1.txt file2.txt >> file_summary.txt etc

This is a step that could be bettered and it's possible to save slow calls to the command processor. Did you take a look at what I proposed in post #14? It's possible to put text files together, which have to be loaded from disk, to create a big temporary text file that is then exported to PDF. Only you need to be organized about it according to the series numbers used for the small text files generated by your project.

At the moment, I'm working towards a functional version. Due to nature of the program - there are many different blocks that either have content, or not. Some may be combined into a larger summary - the others not.

Presently it's a bit of a rough and ready approach.

Will finesse once functional. Thanks so much for your wise advice.  Smile
Reply
#24
(05-26-2023, 06:17 AM)desA Wrote: Hi everyone.

I see that LPRINT is not operational in the Linux version.

Is there an alternative way to print? Happy to print straight to a pdf, or image.

Many thanks.   Smile

Probably not ideal, but what about a virtual machine running windows and installing qb64 there? I know that VBox works with connected devices that are USB. Not sure in Linux.

The VM would let you not have to worry about Wine or molesting your Linux OS.

I use this pattern a lot. I use VirtualBox, and it's easy. Find an ISO of Windows (not hard at all) then install to VM. Done.
grymmjack (gj!)
GitHubYouTube | Soundcloud | 16colo.rs
Reply
#25
Overview of my approach to getting past the missing LPRINT command in Linux.

1.  Within QB64
1.1  Convert LPRINT statements to print to file.
1.2  Launch external BASH script from QB64.

2. External BASH script 
2.1  Convert text file to postscript. 
2.2  Convert postscript to pdf.
3.4  Display pdf files.

In the end, the pdf files are printed out (if necessary) and retained for design records.

This turns out to be a far more elegant solution, in my view,  Smile
Reply
#26
Wow. Makes me wish that Kevin's my solution hadn't been expunged from the Wiki. The one that works in Linux. The one that allows for printing to a printer. With opening a TCP/IP connection to the printer on port 9100 and sending raw data. The one that goes something like this:

Code: (Select All)
c = _OPENCLIENT("TCP/IP:9100:XXX.XXX.XXX") 'replace Xs with the IP address
DIM AS STRING formFeed: formFeed = CHR$(12)
IF c THEN
PUT c, , yourData$
PUT c, , formFeed
CLOSE c
END IF
'DISCLAIMER: I quickly rewrote this using the forum text editor. Edit for your own needs. You might have to also use CHR$(13) + CHR$(10). It depends on printer model. Good luck
Schuwatch!
Yes, it's me. Now shut up.
Reply
#27
(06-06-2023, 06:13 AM)Ultraman Wrote: Wow. Makes me wish that Kevin's my solution hadn't been expunged from the Wiki. The one that works in Linux. The one that allows for printing to a printer. With opening a TCP/IP connection to the printer on port 9100 and sending raw data. The one that goes something like this:

Code: (Select All)
c = _OPENCLIENT("TCP/IP:9100:XXX.XXX.XXX") 'replace Xs with the IP address
DIM AS STRING formFeed: formFeed = CHR$(12)
IF c THEN
PUT c, , yourData$
PUT c, , formFeed
CLOSE c
END IF
'DISCLAIMER: I quickly rewrote this using the forum text editor. Edit for your own needs. You might have to also use CHR$(13) + CHR$(10). It depends on printer model. Good luck
@Ultraman

Awesome approach. Thank you.  Smile
Reply




Users browsing this thread: 12 Guest(s)