Page 1 of 1

Vector Printing Image

Posted: Fri Nov 06, 2015 1:47 pm
by coder14
I am trying the new vector printing in 5.40 LTS and it is great. But this example prints well in Windows but on Mac the image gets cropped:

Code: Select all

UseJPEGImageDecoder()
DefaultPrinter()
If StartPrinting("Vector Print")
  If StartVectorDrawing(PrinterVectorOutput())
    ;replace with your own jpg image
    LoadImage(0, "A4_Letter.jpg")
    DrawVectorImage(ImageID(0), 255, VectorOutputWidth(), VectorOutputHeight())
    StopVectorDrawing()
  EndIf
  StopPrinting()
EndIf
Use any size jpg image to test and draw vector image will resize it.

Re: Vector Printing Image

Posted: Fri Nov 06, 2015 4:00 pm
by wilbert
I don't see it being cropped, only stretched. :?

Re: Vector Printing Image

Posted: Fri Nov 06, 2015 5:09 pm
by coder14
wilbert wrote:I don't see it being cropped, only stretched. :?
Mac OSX 10.7.5 and PureBasic 5.40 LTS 64bit:

Code: Select all

UseJPEGImageDecoder()

CreateImage(0, 300, 300)
StartDrawing(ImageOutput(0))
Box(0, 0, 300, 300, RGB(255, 255, 255))
DrawText(0, 0, "A line of text", RGB(0, 0, 0), RGB(255, 255, 255))
StopDrawing()

If PrintRequester()
  If StartPrinting("Vector Print")
    If StartVectorDrawing(PrinterVectorOutput())
      DrawVectorImage(ImageID(0), 255, VectorOutputWidth(), VectorOutputHeight())
      StopVectorDrawing()
    EndIf
    StopPrinting()
  EndIf
EndIf
Image

The rendering size is also different on the same printer.

Re: Vector Printing Image

Posted: Sun Dec 20, 2015 6:03 am
by collectordave
Have you looked at this topic?

http://www.purebasic.fr/english/viewtop ... 01#p472701

Shows a preview as well.

Re: Vector Printing Image

Posted: Sun Dec 20, 2015 6:54 am
by coder14
collectordave wrote:Have you looked at this topic?

http://www.purebasic.fr/english/viewtop ... 01#p472701

Shows a preview as well.
Thank you but I am trying to confirm the issue that I reported above.

I tried your code on my MacBook Air but it keeps crashing. :shock:

Re: Vector Printing Image

Posted: Mon Dec 21, 2015 8:03 am
by collectordave
Hi

Looking at the example, the DrawVectorImage() procedure will resize the image to the size specified. So could you first run the same programme but use debug to see what size the image is to be on each platform? Windows reports a setting for DPI on a printer and MAC appears to report the actual DPI so some error can creep in.

Debug VectorOutputWidth() etc and compare on each platform?

A second thing is that the code uses the default for StartVectorDrawing(PrinterVectorOutput()) which displays the image in points. Can you try this with mm?

Code: Select all

         StartVectorDrawing(PrinterVectorOutput(#PB_Unit_Millimeter))

         MovePathCursor(10, 10) ;Move cursor to 10mm from left and 10mm from top
         
         DrawVectorImage(ImageID(0), 255,100,15) ;draw image 100mm wide and 15mm high

         StopVectorDrawing()
Both should then print the same as you are giving definate sizes for DrawVectorImage to use.

Please let me know how you get on.

__________________________________________________
Code tags added
21.12.2015
RSBasic