Drawing in a printer graphics object

When text and lines are drawn directly into the printer graphics object all appears sharp on the print.

Then I draw the same into the graphics object of a newly creatured picture of the same size. Then I draw this picture with the printer graphics method DrawPicture into the picture’s graphics object and it is blurred on print.

The picture is not scaled or crapped.

Is there a way to print the picture as sharp as drawing directly into the printer graphis object?

Yes, print a higher resolution version of that image AT THE SAME SIZE.

Image scanned at less than 100 dpi are for screen display (more or less because of HiDPI monitors);
Image scanned at 300 dpi or higher (far higher) are for printing purposes.

Nota: I do not print anything in the last… nearly 10 years *. I only print to pdf.

  • except résumé for job quest.

The picture is not scanned. It is created with

dim pic as new Picture(picWidth, picHeight)

Any ideas to set the pictures resolution to the values I got from the printers graphic object?

My fault, I did not undestand correctly your question.

When you do a “direct print” (the one that looked good), you get "vector text and lines if you print to pdf and get the next result to paper…).

When you print to a Picture - using New Picture(500 , 500), you paint the text and lines into an imge. Then if you print that image into a pdf or printer, you pain an image (you do not draw it: no vector there).

To go ahead, get an eye PrinterSetup at the “MaxHorizontalResolution and MaxVerticalResolution” properties and the MaxHorizontalResolution and MaxVerticalResolution paragraph.

Maybe a kind soul (there are many here) will give you more details on what to do.

[quote=190771:@Torben Vikow]When text and lines are drawn directly into the printer graphics object all appears sharp on the print.

Then I draw the same into the graphics object of a newly creatured picture of the same size. Then I draw this picture with the printer graphics method DrawPicture into the picture’s graphics object and it is blurred on print.

The picture is not scaled or crapped.

Is there a way to print the picture as sharp as drawing directly into the printer graphis object?[/quote]

Can you post your paint code?
Are you using g.AntiAlias = true ?

Thanks for your answers Emile and Mike. This is sample source code. Please put it into a newly created desktop project and run the code from a button event. Then view the result when you print it into the pdf viewer.

It still doesn’t work. Do I use the AntiAlias correct?

Sub PrintDummy()
  Dim g As Graphics
  dim left, top as integer
  dim strText as string
  dim pic as new Picture(200, 30)
  pic.Graphics.AntiAlias = True
  
  // Use Printer Settings
  g = OpenPrinterDialog()
  g.AntiAlias = true
  
  g.TextSize = 11
  left = 71        
  top = 43        
  strText = "Hello World"
  
  // draw directly to the printer graphics object
  g.DrawString(strText, left, top)
  
  // draw into a picture 
  pic.Graphics.DrawString(strText, 0, 15)
  
  // draw the image into the printers Graphics object
  g.DrawPicture(pic, left, top + 20)
End Sub

Are you compiling for windows?

No, this code should run on Mac OS 10.9.5.

That is the result:
https://xojo.io/a4609d6fc174

I expected the difference to be due to the printer resolution.
So I added the MaxResolution stuff to the code, and generated this:

[code] private sub PrintTest()
Dim g As Graphics
dim left, top as integer
dim strText as string

// Use Printer Settings
dim p as new PrinterSetup
p.MaxHorizontalResolution=-1
p.MaxVerticalResolution=-1
g = OpenPrinterDialog§

dim pic as new Picture(g.height, g.width,32)

// draw directly to the printer graphics object
g.AntiAlias = true
g.TextSize = 100
left = 71
top = 100
strText = “Hello World”
g.DrawString(strText, left, top)

// draw into a picture
pic.Graphics.AntiAlias = true
pic.Graphics.TextSize = 100
left = 71
top = 100
strText = “Hello World”
pic.Graphics.DrawString(strText, left, top)

// draw the image into the printers Graphics object
g.DrawPicture(pic, left, top + 300)
end sub[/code]

I run this and instead of printing, I ‘open PDF in Preview’ on my mac

At a max resolution of 300 dpi, the print quality of the letters is not the same, but its not bad
.
But at a text size of 11, there is still a world of difference.
It does seem that if you print text to the printer graphics, it understands that this is a vector font and retains the quality.

For even better evidence of this, use a font size of 4
It shouldnt be possible to show any detail in 4 points of height, yet if you zoom in to the result, the text printed straight to graphics is sharp as a pin, and the one in the picture is a blur

One technique to address this kind of thing is to assemble the page as vector objects.
Then draw the vector objects to either a picture (for screen display only) , or a printer (when printing)
That way you get the maximum resolution every time.

Thanks for taking the time to test this. It is looking noticeably sharper than before.

Welcome.
One other tip:

To get better again, I have in the past doubled the printer size for the matching picture.
So if it says 2000 pixels, my picture is 4000 pixels.

Drawing and texting at twice the size, then using drawpicture to put the picture onto the printer , (scaled down to the printer size), you get a better result.