none
LD-Extensions missing print immage RRS feed

  • Question

  • Hey LitDev,

    i missing in your extensions the posibility to print a image. It is possible to upgrate your extensions.


    Best Regards Martin

    Saturday, March 9, 2013 4:12 PM

Answers

  • I can add equivalents of GraphicsWindow.Height and Width that will work with scrollbars, but the print will still only be what is actually visible on the screen.  They will be Utilities.GWWidth and Utilities.GWHeight, but no solution for the off-screen bits not included.

    EDIT

    After quite a bit of playing I have a writer for the GraphicsWindow which will work for GWPrint and GWCapture using the "False" second argument for not including the border.  If you want the border too, then the window has to visible on the screen.

    The modifications also mean that there is no need to resize the GW to get a full capture of the scrollable region, although the GWWidth and GWHeight options will be available.

    And since it is not a screen capture, the scrollbars won't be there either so no need to remove them first.

    The critical part of your code will look like:

        If LKP = "P" Then
          'start to print 
          LDUtilities.GWCapture("C:\temp\test.jpg","False")
        EndIf 

    A little tweeking (perhaps a switch to turn the modifications off if there are issues) and will probably upload later today.

    EDIT

    Uploaded version.

    • Edited by litdevModerator Sunday, March 10, 2013 8:04 PM
    • Marked as answer by martmen Monday, March 11, 2013 7:32 PM
    Sunday, March 10, 2013 5:51 PM
    Moderator

All replies

  • The IO extension can print text, you should check it out : IO Extension Download


    chase morell

    Saturday, March 9, 2013 8:48 PM
  • Try other extension to print - I have tried not to reproduce features that already exist and work in other extensions. 

    Also you can create an image file using extension and print it using a command line print which you can issue using LDProcess.

    If neither of these work I may add printing.

    EDIT

    LDFile.PrintFile option added. - should work for all file types your (default) printer can handle - not heavily tested - printer ink is expensive.  For any kind of formatting of the print I would suggest importing the required file into something else and printing from there - many have batch methods (Gimp etc).

    Saturday, March 9, 2013 9:23 PM
    Moderator
  • It is possible to print the data content of the graphic window? Put graphics, write text to the graphic window. If it ready print it. So you can print what you see.


    Best Regards Martin

    Sunday, March 10, 2013 6:48 AM
  • I forgot there was already GWPrint

    GraphicsWindow.DrawText(100,100,"Hello World")
    Program.Delay(100)
    LDUtilities.GWPrint("False")

    Or

    GraphicsWindow.DrawText(100,100,"Hello World")
    Program.Delay(100)
    LDUtilities.GWCapture("C:/temp/testimage.jpg","False")
    LDFile.PrintFile("C:/temp/testimage.jpg")
    Do these not work?


    Sunday, March 10, 2013 10:41 AM
    Moderator
  • try this please:

    GraphicsWindow.KeyUp = OnKeyUp

    T = "True"
    F = "False"

    GraphicsWindow.Top = 0
    GraphicsWindow.Left = 0
    GraphicsWindow.Width = 820
    GraphicsWindow.Height = 680
    LDScrollBars.Add(795, 1120)

    GraphicsWindow.DrawLine(0,0,795,1120)
    GraphicsWindow.DrawLine(795,0,0,1120)

    GraphicsWindow.Show()

    Wait = T
    While Wait = T
      If KeyUp = T Then
        LKP = GraphicsWindow.LastKey
        If LKP = "P" Then
          GraphicsWindow.Height = 1195
          LDScrollBars.Visibility = F
          Program.Delay(200)
          LDUtilities.GWPrint("False")
          Program.Delay(200)
          GraphicsWindow.Height = 680
          LDScrollBars.Visibility = T
        EndIf
        If LKP = "Escape" Then
          Program.End()
        EndIf
      EndIf
    EndWhile

    Sub OnKeyUp
      KeyUp = T
    EndSub


    Best Regards Martin

    Sunday, March 10, 2013 11:42 AM
  • I don't want to print loads of full page images testing.  Simplify and test.

    1] Do the test examples I provided work (using a folder on your PC)? 

    We musk know the answer to this first (is it a printing issue or a programming implementation issue).

    2] If these don't work then no point complicating the issue with scrollbars and click events (asynchronously) controlling the printing.

    3] If it works then proceed to try with a simple GW display you want - forget all the key events - just do the test print - perhaps the Scrollbars is an issue if not set up right?

    4] Try the GWCapture to just create an image file.

    Sunday, March 10, 2013 12:19 PM
    Moderator
  • I did some simplifying and the issue is that once a key is pressed KeyUp remains true and last key is P and the print is continually (being done) over and over and getting messed up.

    My test code:

          GraphicsWindow.Height = 1195
          LDScrollBars.Visibility = F
          Program.Delay(200)
          LDUtilities.GWCapture("C:\temp\test.jpg","False")
          Program.Delay(200)
          GraphicsWindow.Height = 680
          LDScrollBars.Visibility = T
          KeyUp = F
    

    Note I test with GWCapture to prevent loads of wasted printing and reset the KeyUp status to false when it is done once.

    There are also potential problems resizing the GW programatically while the scrollbars are present - I suggest not using GraphicsWindow.Width and Height (apart from once at the start) and scrollbars.  Basically the scrollbars alter things that are also being used used by the GraphicsWindow.Width and Height , but there is no way (certainly not easily) for SmallBasicLibrary (Width and Height) to know that there are scrollbars to worry about.  The code for SmallBasicLibrary was not written with scrollbars in mind.

    So remove the GW resizing from the code above.

    Sunday, March 10, 2013 12:45 PM
    Moderator
  • show CCV213

    1. You see the great X if you scroll down. ok

    2. You can set the height of the window to the full height and you can hidden the scroll bars. ok

    3. If you print the great X it prints not realy the full height of the window. It print the window on the desktop.

    4. After printing the set to the normal window height has a problem.

    How can I print a complete DIN A4 Site?

    It is possible put the complete Window to a image and print the image?


    Best Regards Martin

    Sunday, March 10, 2013 2:51 PM
  • 3] The print is just what is visible in the GW - a bitmap of what is displayed - should cover virtually all cases where a SmallBasic print is wanted.

    4] See comments on my last post - don't resize the GW after scrollbars are added - to fix would require changes to SmallBasicLibrary.dll.  Don't do it.  It can be resized by the user.

    5] Set up your default printer options - for full control of printing as before use dedicated software.

    6] Possibly, but only relevant with scrollbars, otherwise where would the border be.  Why do you want to print outside what is visible?

    Sunday, March 10, 2013 3:25 PM
    Moderator
  • I can add equivalents of GraphicsWindow.Height and Width that will work with scrollbars, but the print will still only be what is actually visible on the screen.  They will be Utilities.GWWidth and Utilities.GWHeight, but no solution for the off-screen bits not included.

    EDIT

    After quite a bit of playing I have a writer for the GraphicsWindow which will work for GWPrint and GWCapture using the "False" second argument for not including the border.  If you want the border too, then the window has to visible on the screen.

    The modifications also mean that there is no need to resize the GW to get a full capture of the scrollable region, although the GWWidth and GWHeight options will be available.

    And since it is not a screen capture, the scrollbars won't be there either so no need to remove them first.

    The critical part of your code will look like:

        If LKP = "P" Then
          'start to print 
          LDUtilities.GWCapture("C:\temp\test.jpg","False")
        EndIf 

    A little tweeking (perhaps a switch to turn the modifications off if there are issues) and will probably upload later today.

    EDIT

    Uploaded version.

    • Edited by litdevModerator Sunday, March 10, 2013 8:04 PM
    • Marked as answer by martmen Monday, March 11, 2013 7:32 PM
    Sunday, March 10, 2013 5:51 PM
    Moderator
  • fantastic, it print know X. I will scan a formular and set textboxes on the input fields and its ready to print the formular.

    Best Regards Martin

    Monday, March 11, 2013 7:32 PM