PDF Drawpicture

What am I doing wrong here with Drawpicture?
Error Msg “Using Getdata on an image is not supported”

Var pdf As New PDFDocument
Var g As Graphics = pdf.Graphics

g.DrawRoundRectangle(10, 10, pdf.PageWidth-20, pdf.PageHeight-20,20,20)
Mytitle = "The following ..............."
g.DrawText(mytitle, 100, 100, pdf.PageWidth-40) 

  select case PlayerNum
  case 1
    g.DrawPicture(MyImage,20,20,me.width,me.height,0,0,MyImage.width,MyImage.height)
  case 2

What kind of object is MyImage, and how is it instantiated?

1 Like

It is just one of the images I have dragged into the project and am referencing elsewhere in the project without issue in a canvas with the same code in the Paint event??

The pdf example uses which is the same as what I have used but it turns out

g.DrawPicture(SailorImage, 20, 20, 60, 60, 0, 0, SailorImage.Width, SailorImage.Height)

I needed to use MyImage.ImageAt(0) to make it work… not too sure why

g.DrawPicture(MyImage.ImageAt(0),20,20,me.width,me.height,0,0,MyImage.width,MyImage.height)

Hi @Martin_Fitzgibbons

In a multi-resolution Picture, the app will display (choose) the one that best fits the screen dpi.

PDF is a device independent resolution format, what means that it can’t choose for you the one that you want to render. That is, between two images or planes for the picture (one of these with 32 x 32 px, and the second one with 64 x 64 px), which one should it render in the page, specially if you intend to scale or fit the image at a given size?

Is for that, that you must explicity give the desired image to render in the page to the PDF document.

1 Like

Thanks Javier appreciate the explanation and makes sense.

1 Like