KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to copy a 4D SVG Picture for transfer to the OS Clipboard
PRODUCT: 4D | VERSION: 14.x, 15.x | PLATFORM: Mac & Win
Published On: September 2, 2016

When a 4D picture variable contains an SVG image, using the command SET PICTURE TO PASTEBOARD to directly put th image on 4D Pasteboard does put an image on the pasteboard the is transferrable to the system OS for pasting into third party applications, such as MS Word or Apple's Pages.

To put to image that is SVG in 4D on the pasteboard in a form that is transferrable to the system clipboard tie image must first be converted to a format that the OS understands is an image. The example code below accomplishes this task.

If(Picture_Sz_L>0)
    C_PICTURE($PIC_G)
    CLEAR PASTEBOARD
    $PIC_G:=MyIMG_G
    CONVERT PICTURE($PIC_G;"image/png")

    SET PICTURE TO PASTEBOARD($PIC_G) // Copy the SVG image to the pastboard
    If(OK=0)
       ALERT("The image could not be placed on the clipboard.")
    End if

Else
    CLEAR PASTEBOARD // No graph to copy
    ALERT("The is not image to place on the clipboard.")

End if