B4J Question Printing trouble

Discussion in 'B4J Questions' started by Chicao99, Sep 16, 2019.

  1. Chicao99

    Chicao99 Member Licensed User

    Hi guys, I am expecting some difficults trying to print a canvas. It always prints just the first quarter of the page.


    The beggining of my canvas building (pdf is my canvas):

    PrintForm.RootPane.RemoveAllNodes

    Dim scp As ScrollPane
    scp.Initialize("scp")

    PrintForm.RootPane.AddNode(scp,0,0,605,870)

    Dim p As Pane = scp.InnerNode

    p.AddNode(pdf, 0, 0, 605, 3000)

    PrintForm.Show


    My printing routine:

    Dim PA As Paper
    PA.Initialize()
    PA = Paper_static.A4

    Dim PR As Printer = GetPrinter("PDF Architect 4")

    Dim PL As PageLayout
    PL.Initialize()
    PL = PR.CreatePageLayout2(PA, PageOrientation_Static.PORTRAIT, "HARDWARE_MINIMUM")

    Dim PJ As PrinterJob = PrinterJob_Static.CreatePrinterJob2(PR) 'CreatePrinterJob
    PJ.PrintPage2(PL, pdf)
    PJ.EndJob


    Can anybody help me?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    1. Moved to B4J forum.
    2. Please use [code]code here...[/code] tags when posting code.
     
  3. Daestrum

    Daestrum Well-Known Member Licensed User

    Could it be the fact that javafx only prints the visible part of nodes. If the canvas is in a scrollpane and not entirely visible, only the part showing will print.
    Similar to how a tableview will only print the visible rows, not the one that are not scrolled into view.

    As a (possible) solution put the canvas into a node that is large enough to view it and print that. eg, create a node 605 x 3000 and print that.
     
  4. Chicao99

    Chicao99 Member Licensed User

    It didn't work:
    Code:
    PrintForm.RootPane.RemoveAllNodes
       
        PrintForm.RootPane.AddNode(pdf,
    0,0,605,3000)
       
        PrintForm.Show
    It always print the top left quarter, see pdf attached.
     

    Attached Files:

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice