Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Svg Error
{
"version": "1.0.0",
"summary": "helpful summary of your project, less than 80 characters",
"repository": "https://github.com/user/project.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "4.0.3 <= v < 5.0.0",
"elm-lang/html": "1.1.0 <= v < 2.0.0",
"elm-lang/svg": "1.1.1 <= v < 2.0.0",
"elm-lang/virtual-dom": "1.1.0 <= v < 2.0.0"
},
"elm-version": "0.17.1 <= v < 0.18.0"
}
module Print2 exposing (..)
import Html exposing (div, button, text, body, iframe)
import Html.Attributes as A
import Html.App as App
import Html.Events exposing (onClick)
import Svg exposing (..)
import Svg.Attributes exposing (..)
import VirtualDom exposing (..)
import String
imgData : String
imgData =
String.trim
"""
data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="""
myImg =
image
[ width "340"
, height "100"
, attribute "xmlns:xlink" "http://www.w3.org/1999/xlink"
, attribute "xlink:href" imgData
]
[]
page : Svg m
page =
let
logo =
g [ transform "translate(20, 20)" ] [ myImg ]
in
svg
[ attribute "height" "295mm"
, id "the-svg"
, attribute "version" "1.1"
, viewBox "0 0 595 842"
, attribute "width" "210mm"
, attribute "xmlns" "http://www.w3.org/2000/svg"
--, attribute "xmlns:svg" "http://www.w3.org/2000/svg"
, attribute "xmlns:xlink" "http://www.w3.org/1999/xlink"
]
[ g [ id "layer1" ]
[ rect
[ attribute "height" "822"
, id "rect12594"
, attribute "style" "stroke:#000000;fill:none;stroke-opacity:0.5"
, attribute "width" "575"
, attribute "x" "10"
, attribute "y" "10"
]
[]
, text " "
]
, logo
]
text =
Html.text
type Msg
= Print
update msg model =
case msg of
Print ->
( 0, Cmd.none )
main =
App.program
{ init = ( 0, Cmd.none )
, update = update
, view = view
, subscriptions = \_ -> Sub.none
}
displayNone =
A.style [ ( "display", "none" ) ]
view model =
div []
[ button [ onClick Print ] [ text "print" ]
, div [ A.id "output" ]
[ page
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.