• Welcome to PlanetSquires Forums.
 

Xprint render

Started by Petrus Vorster, June 18, 2016, 05:12:35 PM

Previous topic - Next topic

Petrus Vorster

I have included an image in my barcode label tool.

The image (BMP) opens in any image tool quite large, but if i render it into the xprint functions it is minute small.
I assume there has to be some scaling calculations to get it to real size?

I dont follow the Xprint stretch indications or else i would have used an image in a picturebox or a resource file, but i have no idea how to do that.

For now i have scaled by guesswork, but the image doesnt appear as crisp in my previews as the original, therefore I guess my scaling must be way off.
-Regards
Peter

Chris Maher

Hi Petrus,

I think you will need to start by looking at the resolution differences between the screen display that you are looking at (GRAPHIC GET PPI) and the printer/s that you intend to print on (XPRINT GET PPI).

Resolution is usually referred to as Points Per Inch or Dots Per Inch. If screen and printer don't match then it will look different (or fuzzy because the underlying smaller picture data has been stretched out to fit the larger size).

When you print a bitmap image it is best to get the source image to exactly the right size at the target output resolution (and this often looks big on screen). 150 dpi is usually the basic size for the print industry, depending on the purpose, but it can go up much, much higher.

Ordinary office laser printers are usually at 300/600/1200 dpi. This means that copying a logo (legally) from a website will often not be good enough as it is too low-res and designed to look OK on screen but not take too long for the page to load. Also, depending on the background of the original web page, it may contain an anti-alias halo trick that looks really odd when printed on white paper.

In general I always print barcodes and label contents at the exact resolution of the laser printer. Barcodes can not be even slightly fuzzy or scaled as they will likely not scan somewhere down an ancient sorting conveyor half-way around the world on their way to the destination.

I tend to use a completely separate (but very similar) routine for the screen preview of the label and I treat the screen as the secondary target.

Once you have all the relevant sizes of the target clients (screen/printers) then using GRAPHIC SCALE and XPRINT SCALE can really help get the preview and output looking right as you can then just use exactly the same size and position numbers for both targets and the scaling/zooming is taken care of.

You'll need to play with this a bit. I can't give you live code but this is where I would start converting each target printer client to millimetre units. Obviously the screen doesn't use margins!

    XPRINT ATTACH DEFAULT, "My Test Labels"                              'Attach printer with the queue job title
        XPRINT SET ORIENTATION 1                                         'Set paper orientation

        LOCAL CLM, CTM, CRM, CBM, CX, CY, PPIx, PPIy AS LONG
                                                                        'Printer metrics
        XPRINT GET CLIENT TO CX, CY                                     'Client (printable area) in pixels
        XPRINT GET MARGIN TO CLM, CTM, CRM, CBM                         'Page margins in pixels
        XPRINT GET PPI TO PPIx, PPIy                                    'Dots/pixels per inch

        PW=(XPRINT(SIZE.X)*25.4)/PPIx                                   'Paper Width
        PH=(XPRINT(SIZE.Y)*25.4)/PPIy                                   'Paper Height

        LM=(CLM*25.4)/PPIx                                              'Left margin width in mm
        RM=(CRM*25.4)/PPIx                                              'Right margin width in mm
        TM=(CTM*25.4)/PPIy                                              'Top margin width in mm
        BM=(CBM*25.4)/PPIy                                              'Bottom margin width in mm
        CX=(CX*25.4)/PPIx                                               'Client width in mm
        CY=(CY*25.4)/PPIy                                               'Client height in mm

        XPRINT SCALE (LM,TM)-(CX+LM,CY+TM)                              'set mm scaling across sheet from top left

'YOUR CODE GOES HERE>>>



Sorry it wasn't a one line answer..

Chris.

Petrus Vorster

Thanks Chris

Yes, I figured the DPi issue out too.
Perhaps I must not get too carried away. We use thermal label printers and their quality isnt really that good.
If I print to a laser the images isn't really that important.

I want to create an external, third-party project that someone can use to compliment the system for bulk users where software is insanely expensive.
Software cost here is US Dollar Multiplied by 20, so any tool that can provide the functionality free or cheap will probably be very welcome.

From here on its just address book, mailing lists, and e-postage (Which we dont even have in this country yet.)
-Thanks for the advice. Have a great week!
-Regards
Peter