Printer resolution won't change from 72 DPI

  1. 3 weeks ago

    This is my first Xojo project, so I'm still learning. My project is to enter data and print on die-cut and continuous labels to a thermal transfer printer.
    The project was working and printing text and pictures to the printer correctly with it's max resolution of 300dpi, however I could not set the page size no mater what I did.
    After investigating, it seemed that the Monkeybreadsoftware win plugins would be my best choice, so I purchased and loaded the plugins.
    The page length from the plugins worked well, but my pictures became very large. After checking it, I found that the resolution was not at 72 dpi instead of the 300 dpi that the printer should have been printing to. Even after removing the code for the plugin and removing the plugins, I am still getting 72 dpi printing from the printer. I have tried the ps.MaximumHorizontalResolution = -1, ps.MaximumVerticalResolution = -1, also tried setting the resolutions to 300 and still remains at 72 dpi.

    dim g as Graphics
    dim ps as PrinterSetup

    ps = new PrinterSetup
    if ps <> nil then
    g = OpenPrinterDialog(ps)
    If g <> Nil Then
    ps.MaximumHorizontalResolution = -1
    ps.MaximumVerticalResolution = -1

    xscalefactor = page.horizontalresolution / 72
    yscalefactor = page.verticalresolution / 72

    PrintLabel(g, Ps)

    end if
    end if
    Can anyone give me some help on this?

  2. Sorry, Scalefactor should have been the following.

    xscalefactor = ps.horizontalresolution / 72
    yscalefactor = ps.verticalresolution / 72

  3. Martin T

    May 14 Testers Germany

    You have to multiplicate all Point/Size Parameter within Graphics Method calls with the scale factor.

  4. Emile S

    May 14 Europe (France, Strasbourg)

    Isn’t 96 dpi the default value under WIndows ?
    (instead of the 72 value you used in code above…)

  5. Tim H

    May 14 Portland, OR USA

    You have to set the Maximum values *before* you open the printer. The Max values act as a request for a certain resolution during OpenPrinter. After OpenPrinterDialog returns, ps.horizontalresolution will be set to the value the printer selected. Some printers will give you the closest value they support, others will return 72 if you don't request the exact resolution they support.

  6. Martin T

    May 14 Testers Germany

    @Emile S Isn’t 96 dpi the default value under WIndows ?
    (instead of the 72 value you used in code above…)

    Since 72 is the default value of Xojo, use 72.

  7. 2 weeks ago

    Tim, Thank you I had tried every combination before, but never tried to set the max values before opening the printer.
    This works perfectly.

or Sign Up to reply!