Part 7: Publishing your drawings
Printing in Linux is very different, but not harder. In fact, scripting creates extra possibilities…
THIS ARTICLE IS UNDER CONSTRUCTION. YOUR POSITIVE INPUT IS APPRECIATED.
PDF as the base
PostScript, in .ps files, is a page describing language. You copy the file to a PostScript printer and you’re done. That is how it started early 80th, the printer did the processing.
PDF is a descendant of PostScript, lacking typical program language features, adding the possibility of embedded fonts and interactive media. Development: ~2000. For more: see Wikipedia.
PDF’s are processed in the computer itself and printed to all kinds of printers, contrary to PostScript. Raster Image Processing, RIP, is what is done to turn a PDF to a raw stream of print pixels.
There are printers that can deal directly with PDF by the way.
Linux and macOS are much more centred around PostScript and PDF printing than Windows. Centralizing PDF in the printing process is obvious, contrary to Windows printing.
PDF is never a substitution for a CAD file. As “page printing oriented”, it lacks precision and it has never been intended to be an exchange format. People sending PDF’s for use in CAD systems should think twice and consider sending proper CAD files.
Unintended scaling is a pitfall that needs you attention, in particular when using Windows. If you want proper scaling, check your process carefully.
CUPS for printing
CUPS (Common UNIX Printing System) lets a computer act as a print server, a host, for printers connected to that computer, using USB or network.
A user, a client, on the same computer or a different one, sends a print job to a CUPS host. CUPS does ripping, spooling and everything needed to get a result from the target printer.
Printer dialogues for setting up printers in modern Linux distro’s typically configure CUPS invisibly. You can find the “real” interface at http://localhost:631/printers/.
Command line: using lpr or lp
In BASH, command
lp stands for line printing. It uses CUPS.
lp are not the same thing, they more or less do the same thing.
On the CUPS site lives a clearly written document about using
lp. You should read it, what follows here is a summary of tools to get jobs done.
Getting all information
What printers do I have?
Example, issue command
lpstat -t in a terminal (
$ lpstat -t scheduler is running system default destination: EPSON_ET_4750_Series device for Epson-Stylus-Pro-11880: socket://10.105.2.159:9100 ... printer Xprinter-XP-360B is idle. enabled since zo 18 aug 2019 15:19:10 CEST
Two possibilities for example for printing on the command line:
lp -d EPSON_ET_4750_Series drawing.pdf
lpr -P Epson-Stylus-Pro-11880 drawing.pdf
What options does a specific printer have?
lpoptions -p printername -l to l(ist) options in a terminal:
$ lpoptions -p EPSON_ET_4750_Series -l PageSize/Media Size: Letter 4x6 5x7 8x10 101.6x180.6mm *A4 A5 A6 Legal B5 B6 3.5x5 Postcard Env10 EnvC6 EnvDL 5x8 FanFoldGermanLegal 195x270mm 215x345mm MediaType/Media Type: *Stationery PhotographicHighGloss Photographic PhotographicSemiGloss PhotographicGlossy PhotographicMatte StationeryLetterhead Envelope ColorModel/Output Mode: *RGB Gray Duplex/Duplex: None *DuplexNoTumble DuplexTumble cupsPrintQuality/cupsPrintQuality: Draft *Normal High
Tag1/Tag2: Option1 *Option2 Option3 ...
*values are defaults. Before starting to combine all this…
The real party starts when using large format printers – not unusual in a CAD environment. Again:
$ lpoptions -p Epson-Stylus-Pro-11880 -l InkSet/Cartridge Option: *MatteBlack MediaType/Media Type: VELVET_FINE_ART_PAPER_MK WATERCOLOR_PAPER_RADIANT_WHITE_MK TEXTURED_FINE_ART_PAPER_MK ULTRASMOOTH_FINE_ART_PAPER_MK CANVAS_MK DOUBLEWEIGHT_MATTE_PAPER_MK ENHANCED_MATTE_PAPER_MK ARCHIVAL_MATTE_PAPER_MK PLAIN_PAPER_MK *ENHANCED_MATTE_POSTER_BOARD_MK Color/Color: *Color ABWP PrintQuality/Print Quality: Draft Speed Quality *Max_Quality HighSpeed/High Speed: *Off On Mode/Mode: ChartsAndGraphs *Standard AdobeRGB InputSlot/Source: *RollPaper RollPaper_Banner Sheet PageSize/Size: *Custom.WIDTHxHEIGHT A4 A3 A3+ A2 A1 A1+ A0 A0+ Letter USB USC USD USE ARCHA ARCHB ARCHC ARCHD ARCHE B5 B4 B3 B2 B1 B1L B0 B0+ 8x10in 10x12in 11x14in 12x12in 16x20in 24x30in 30x40in 36x44in 50x64in 60x75in 64x80in 30x40cm 40x60cm 60x90cm Borderless/Borderless: *Off On AutoCut/Auto Cut: *Off SingleCut DoubleCut NormalCut Density/Color Density: 50 55 60 65 70 75 80 85 90 95 *100 105 110 115 120 125 130 135 140 145 150 DryingTimePerPrintHeadPass/Drying Time per Print Head Pass: *0 5 10 15 20 25 30 35 40 45 50 PaperFeedAdjustment/Paper Feed Adjustment: 0 5 10 15 20 25 30 35 40 45 50 55 60 65 *70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 PaperSuction/Paper Suction: *Standard 1 2 3 4 PlatenGap/Platen Gap: *Auto Wider Wide Standard Narrow
With a lot of power comes a lot of options, that was fun! And finally I understand what my printers are really able to do, information so hard to find in manuals and sales info.
What other options do we have?
Continue reading this. For example:
lp -o landscape drawing.pdf
… is an option.
Putting it all together
Based on the example before, we could do:
lp -d Epson-Stylus-Pro-11880 -o media=Custom.1059x1500mm drawing.pdf
… for a 1500mm print from a 42 inch roll.
And the configuration possibilities seem endless, and when all options (-o abc -o def -o …) are defined properly, the process is under control. No surprises any more when printing and that is the power of CUPS for macOS and Linux versus Windows printing. But wait…
And… The finishing touch!
With knowledge about Unix/Linux printing it becomes tempting to automate things. There are two things to consider:
- Look for Creating Saved Options, for creating “instances” of your printer with exactly the right settings – mostly paper sizes.
- Consider using BASH scripts for hassle free printing. Example:
Hope you liked it so far, by writing I learned a lot myself too! Now, where were we… BricsCAD and Printing!
BricsCAD and Printing
That was a long introduction with details on PDF and CUPS. What it means for BricsCAD: Forget about PC3 files, it all boils down to creating proper PDF’s.
- All printing is centred around Print as PDF.pc3
- Consider filing your print PDF’s for later reproduction purposes.
CPAGESETUP: Print as PDF.pc3 is greyed out, there are no other printers.
Setting up media sizes
CPAGESETUP results in this:
At this point something is odd:
- If you do
Preview, you get a proper PDF.
- If you do
<Enter>, you get an A0 proposition and a custom size, made with button 2, is not in the list any more.
- That problem does not occur when doing a
-plotis a workaround, just as saving the
- It is temporary, it has the attention of developers (2019-08-30)
This information screams for further automation…
How to get a Lisp list of CUPS printers?
By piping things I could transform $
lpstat output to an impressive but Q&D one liner that generates the requested list, paste this in a terminal:
echo ")" | (lpstat -p | sed 's/printer /(\"/' | cut -d ' ' -f 1 | sed 's/$/\")/' && cat) | (echo "(\"cups_printers\"" && cat) | tr '\n' ' '
This results in a list, which can be processed in Lisp:
("cups_printers" ("Epson-Stylus-Pro-11880") ("EPSON_ET_4750_Series") ("Xprinter-XP-360B") )
How to get the paper size of a layout?
Retrieving the paper size of a layout in Lisp, more paste, not working yet (2019-08-31), looks like:
(vla-get-canonicalmedianame (vla-item (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) (getvar 'ctab)))
This, combined with a table that links pc3 media sizes to CUPS media sizes and some Lisp and BASH programming might be the inspiring thought for anyone of creating a
cupsplot command 🙂
Continue with part 8: Maybe later…