PrinterVector why is not printed on the printer

Just starting out? Need help? Post your questions and find answers here.
Schobaer
User
User
Posts: 16
Joined: Sat Mar 06, 2004 9:36 am
Location: Germany

PrinterVector why is not printed on the printer

Post by Schobaer »

Hi,
why don't print on the printer? On Canvas it's fine.
Thanks for solution!

Code: Select all

If OpenWindow(0, 0, 0, 400, 400, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CanvasGadget(0, 0, 0, 400, 200)
  LoadFont(0, "Times New Roman", 20, #PB_Font_Bold)
  
    Debug DefaultPrinter()
  Debug PrinterVectorOutput()
  ;If StartVectorDrawing(CanvasVectorOutput(0))
  If StartVectorDrawing(PrinterVectorOutput())
    VectorFont(FontID(0), 11)
    VectorSourceColor(RGBA(255, 0, 0, 255))
    MovePathCursor(50, 25)
    DrawVectorText("huhu")
    DrawVectorText("hihi")
    MovePathCursor(50, 100)
    DrawVectorParagraph("asdfas asdfasdf asdfa fdsfasdf asdfasdf asdfasdf asdfasdfasdf asdfasdfasdf asdfasdf asdfa asdfasdf asdfasdfasdf",100,100,#PB_VectorParagraph_Right)
  
    StopVectorDrawing()
  EndIf


  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf
// Edit: Code-Tags added (Kiffi)
infratec
Always Here
Always Here
Posts: 6873
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: PrinterVector why is not printed on the printer

Post by infratec »

You forgot StartPrinting() and StopPrinting()

Code: Select all

EnableExplicit

Define.i Event

If OpenWindow(0, 0, 0, 400, 400, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CanvasGadget(0, 0, 0, 400, 200)
  LoadFont(0, "Times New Roman", 20, #PB_Font_Bold)
  
  If DefaultPrinter()
    If StartPrinting("PB VectorTest")
      ;If StartVectorDrawing(CanvasVectorOutput(0))
      If StartVectorDrawing(PrinterVectorOutput())
        VectorFont(FontID(0), 11)
        VectorSourceColor(RGBA(255, 0, 0, 255))
        MovePathCursor(50, 25)
        DrawVectorText("huhu")
        DrawVectorText("hihi")
        MovePathCursor(50, 100)
        DrawVectorParagraph("asdfas asdfasdf asdfa fdsfasdf asdfasdf asdfasdf asdfasdfasdf asdfasdfasdf asdfasdf asdfa asdfasdf asdfasdfasdf",100,100,#PB_VectorParagraph_Right)
        
        StopVectorDrawing()
      EndIf
      StopPrinting()
    EndIf
  EndIf
  
  
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: PrinterVector why is not printed on the printer

Post by TI-994A »

Schobaer wrote:...why don't print on the printer?
A call to the StartPrinting() function is required:

Code: Select all

wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered 
OpenWindow(0, 0, 0, 400, 200, "Vector Printing", wFlags)   

If DefaultPrinter() And 
   StartPrinting("Vector Printing") And 
   StartVectorDrawing(PrinterVectorOutput())  
  
  LoadFont(0, "Times New Roman", 20, #PB_Font_Bold)
  
  VectorFont(FontID(0), 11)
  VectorSourceColor(RGBA(255, 0, 0, 255))
  MovePathCursor(50, 25)
  DrawVectorText("PureBasic Vector Printing... ")
  DrawVectorText("a sample printout.")
  MovePathCursor(50, 100)
  DrawVectorParagraph("More random text to test printing constraints...", 
                      100, 100, #PB_VectorParagraph_Right)
  
  StopVectorDrawing()   
  StopPrinting()    
EndIf

While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend   
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
Schobaer
User
User
Posts: 16
Joined: Sat Mar 06, 2004 9:36 am
Location: Germany

Re: PrinterVector why is not printed on the printer

Post by Schobaer »

Thank you, was just too stupid!
eck49
Enthusiast
Enthusiast
Posts: 153
Joined: Sat Nov 14, 2020 10:08 pm
Location: England

Re: PrinterVector why is not printed on the printer

Post by eck49 »

Not too stupid, I hope!

Because I was about to ask the same question....

Supplementary...
I think this may not be a PB issue, but what is going on here, and what can I do about it?

If I VectorOutput to PDF and then view the resulting file with a PDF viewer (Evince), it looks on screen just like the print on paper I get using VectorOutput to printer. But if I print the PDF file from the Viewer I get a tiny version of what I want in the middle of the paper. Scaled almost exactly 28%.

EDIT: Do about it? Answer is to Scale to fit printable area (option in Evince) which produces a print looking exactly like the print done directly from PB. Although it is not obvious to me why the PDF from PB does not have this size as its default.
Ubuntu 22.04 64-bit
Purebasic 6.00 (as of 5 Sep 2022)
(native tongue: English)
Post Reply