Printing


CanDB purpose is to capture “digital” content, and hope is most printing will be to PNG or PDF digital file, not paper. However, both are supported. All major tabs, dialogs or viewers now present a standard set of printing options.

 

 

Important Note: CanDB is NOT a desktop publishing application!!!

Regardless of what/how content is printed, you will NOT be able to produce a high quality, high resolution document you could print on a high quality 1200 DPI printer and get something as clear as the USBC physical book pages.

·         Most computer monitors are 72 DPI resolution. CanDB for printing gets a GC (Graphics Context) from the Display which will be at the monitor’s resolution. All drawing of text/images will thus be at 72 DPI, and that is the resolution of the pixels written to PNG file. Very good for computer display, very reasonable file size.

·         The starting images cataloged within CanDB are JPG. While CanDB does maintain four sizes of Full, Large, Medium and Small for each Item, Full size is only 1200 pixels tall which displays very well on computer, prints fair on 300 or 600 DPI paper printers. Simply impossible to scale 1200 pixels @ 72 DPI into a high resolution 1200 DPI image. Those pixels DO NOT EXIST and would result in much CPU to get a blurry/pixelated image.

To get high quality printed pages as with the USBC, one would need to work with very high resolution TIFF images, major amounts of disk space, CPU power, and GB’s of RAM to operate on a single TIFF file, let alone trying to dynamically scale many images N columns, R rows.

All that said, I believe the new CanDB printing does a damn good job!!!!

 

Menu Item

Description

Print…

Presents a standard Print dialog, allowing choice of printer, preferences and page range. CanDB does not implement the “Number of copies” but there is no coding option to defeat this display. Your printer may still honor this.

(What To Print)

What will be printed. Since there are as number of tabs such as “Project”, “Brewery”, “Item” etc, this is a helper label to be clear what will be printed. The left CanNavigator is not a tab, so to print the navigator tree use the right-click popup menu. Also, will only print expanded nodes, so you have “Expand Below” or “Collapse Below” to quickly affect the expanded tree nodes to be printed.

Print Preview…

Standard dialog window, fully scrollable, that presents a fair idea of what the printed content will look like. This is often NOT exact look of the given tab/window.

Print To File…

Hopefully this will be used for most printing. CanDB supports printing to PNG or PDF, presenting a file chooser where you may choose the format and file name. All printable objects attempt to provide a useful default file name. The folder in which to write files is kept persistent, so subsequent print defaults to the same previously chosen folder.

 

Printing Large Images

Printing used to be easy, the SWT widget toolkit allows all widgets to “print themselves”. Some years back a Windows update broke something in a DLL and this option went away (well still there but everyhing printed was simply a solid black page). I solved this with BMV by using a Graphics Context, programatically drawing to an SWT Image, and then printing the Image. Not easy coding, but for BMV all windows are designed to fit nicely on a single page/PNG.

With CanDB most of the tabs still fit nicely on single page/PNG. However, the “Versions” may be unbounded height. The CanNavigator (use the Expand Below or Collapse Below to control the print rows) with all nodes fully expanded takes eight pages for my CSS project. And then there is the “CanViewer” window, where unbounded number of columns, rows and item pixel height. For example, viewing 500 cans, 6 images per row, each image scaled to 400 pixels height will take many “logical” pages. However, what is a “page”, and what is the purpose you are printing the content? If a given set of content pixels won’t fit nicely on a single page/PNG, you will be presented with the following popup dialog:

 

 

The “Print Large Image” will inform you that attempting to print a large quanity, with generated Image pixel width and height, as well as the “Best If Pages” count.

But how should CanDB proceed? Again this comes down to your preference and what is your intended output purpose.

 

 

 

 

 

 

 

Menu Item

Description

Squeeze Into

Continue forward with the generated Image “squeezed” into a single page/file. While the output might look reasonable when viewed on computer, the large content may likely be scaled down to very small, very unreadable pixels. Probably best not to use.

Split Into N

Split the large Image into multiple PNG files, each with reasonably good pixel sizes. If you choose to save to file “Randy”, this may produce Randy000, Randy001, Randy002

Create PDF

PNG and JPG formats are “single page”. All pixels are squeezed into single file. Using this option will split a large Image into N pages, and creates an N page PDF document. Much better for viewing large content external from CanDB, as well as allows printer to print N physical pages with each scaled to a good pixel resolution.

 

Randy comment: My decision to implement splitting sounded so simple, just take N pixel height and divide by single page height. However, initial testing often a row of text could get split across pages, or much worse, when printing from the CanViewer, portion of a row/can on one page, rest on the next, just didn’t look good. It literally took two weeks, trial and error, failed attempts, and hours of background thinking of “how to control logical splitting” so nothing spans pages. I finally came up with an algorithm that was reasonable to code, and I am pretty happy with the results. The CanViewer can now generate pages that feel so much like custom USBC printed book format with good white space margins.

 

Tools -> Options : Printing

As with most of CanDB, there are default values for everything, but those defaults may not be best for everyone. With respect to printing, there is a “Tool -> Options : Printing” section with the following controls.

Menu Item

Description

Default PDF

The CanDB default is PNG format. When using the “Print To File” option the file chooser will have a “Save as type” combo selector of which will contain both “png” and “pdf”. This option simply controls which of those formats to display by default so you don’t need to keep manually selecting your preference every time.

Prompt before

When using “Print To File” if the selected file name already exists, should there be a popup dialog to confirm overwrite of the file is allowed, or should CanDB just silently overwrite. Since the output is generated, likely no issue just always overwriting.

Page Numbers

If more than one page is printed, should there be a “Page: NNN” added at the bottom left? I prefer the numbers, if you don’t, uncheck this option. No effect for single pages.

Quality

This is “pixel compression”. The smaller the value, fewer pixels will be used, larger value, more pixels. Of course, the higher the value, more processing. The CanDB default for PNG is 92 which provides a very good image size for later use. Why such a strange number? When the quality is 90 or greater, the chroma channels are not down sampled for PNG format. Important trivia fact for beer can collectors…

 

 

Tools -> Preferences : Print

To provide absolute user conrol, use the “Tools -> Preferences : Print” configuration. CanDB has built in defaults, a quick “Larger Defaults” theme to make everything some pixels larger, and then three configurable “User Configurable A/B/C” themes. For printing the “Print” colors and fonts are used. If you really must have “Standout” labels in blue, 16 point, Bookman Ole Style font, go for it!!! Feel free to experiment, there are both “Reset” and “Restore Group Defaults”, or just simply switch back to the “Program Defaults” theme if you don’t like your chosen font family, style or size.

 

Performance / Cancelling

A smaller Image, fewer pixels, will always be faster to process. Regrardless of Quality, CanDB is very efficient in manipulating PNG pixels, as well as read/write to local disk. All actions with direct PNG can be done fast on the GUI thread without any significant impact to the GUI “feel”.

However, when printing N PNG files for merging into a multi-page PDF document, the PNG images must first be scaled to 300 DPI resolution, and once all larger PNG created, a final action of merging them into a single PDF (and then automatic removal of the temporary generated PNG files). While this is still fairly efficient, it can’t be done easily in pure Java, so CanDB reaches out to use “ImageMagick”. As such, for printing to PDF, a background Runnable is started, control back to the GUI, and a “Print Status” dialog to show progress. Once all files completed, the Print Status dialog will automatically close.

Caveat. The “Cancel Print” is just an *attempt* to cancel the action. CanDB does not have full control over print jobs and/or file I/O, and even though the background thread told to “stop”, all actions may not be stoppable.

 

Print to paper printer

My preference would be to not provide this. However, there are exceptions where printing to paper may be desired. CanDB uses the SWT – Standard Widget Toolkit, which is Java API but uses JNI to map to the native platform. Thus, the print dialog will look different if Windows, MacOS or Linux. Here is what it looks like on my Windows 11 system:

Little documentation here since depends on your computer. However, all should allow you to select which printer, a “Print to file” button, optional Preferences, and then a “Page Range” and “Number of Copies”.

 

I do attempt to set “Page Range : All” by default, and I believe support simple “Pages” range. I have no idea how to code Selection or Current Page, since CanDB does not have pages, just pixeled images, split into “logical” pages” .

 

I intentionally do NOTHING for Number of copies, though your printer may automatically process this setting.