Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The basic problem here is one of scaling. More or less, figure out how much to expand the resolution of the image and then stretchdraw it to the printer canvas. Something like this gets the image stretched out to the dimension of the printer canvas.</p> <pre><code>procedure TForm1.Button2Click(Sender: TObject); var MyRect: TRect; scale: Double; begin if PrintDialog1.Execute then begin Printer.BeginDoc; scale := Printer.PageWidth / Bitmap1.Width; ShowMessage(FloatToStr(scale)); { horizontal pixels, vertical pixels, bit depth 600 x 600 x 24} MyRect.Left := 0; MyRect.Top := 0; MyRect.Right := trunc(Bitmap1.Width * scale); MyRect.Bottom := trunc(Bitmap1.Height * scale); Printer.Canvas.StretchDraw(MyRect, Bitmap1); Printer.EndDoc; end; </code></pre> <p>Of course, you have to check "Right" and "Bottom" to make sure they don't exceed your PageWidth and PageHeight depending on the type of scaling you use (6.25 or 600/96 seems fine for simply making an image the same relative size as the screen, assuming those numbers match your printer and screen), assuming you want to keep the image to one page and not mosaic pieces of it onto multiple pages.</p> <p>I don't know if this works entirely since I don't have a varied number of devices (i.e. different DPIs) to test both orientations on, but this seems to be what you want to get both DPI numbers dynamically.</p> <pre><code>if Printer.Orientation = poPortrait then scale := GetDeviceCaps(Printer.Handle, LOGPIXELSX) / PixelsPerInch else scale := GetDeviceCaps(Printer.Handle, LOGPIXELSY) / pixelsperinch; </code></pre> <p>Then of course, you multiply like above.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload