Skip to content

Instantly share code, notes, and snippets.

View mindboard's full-sized avatar

Tomoaki Oshima mindboard

View GitHub Profile
@mindboard
mindboard / createImageFromSVG.kts
Last active April 9, 2016 06:35
Creating png image from SVG command
import java.io.File
import java.awt.Color
import java.awt.Graphics2D
import java.awt.BasicStroke
import java.awt.image.BufferedImage
import java.awt.geom.AffineTransform
import java.awt.geom.GeneralPath as Path
import javax.imageio.ImageIO
import java.util.ArrayList
#include <Foundation/Foundation.h>
#include <cairo.h>
typedef struct {
float x;
float y;
} point_t;
@import Foundation;
@interface PngUtil : NSObject {}
@end
@implementation PngUtil
+ (CGContextRef)
contextWithWidth : (int)width
andHeight : (int)height {
import Foundation
import CoreFoundation
import CoreImage
let path = NSProcessInfo.processInfo().arguments[1]
let url:NSURL = NSURL(fileURLWithPath: path) as CFURLRef
let pdfDocument = CGPDFDocumentCreateWithURL(url) // CGPDFDocument
//
def sb = new StringBuffer()
sb.append("""<html>
<body>
<table border=0 style="border-collapse: collapse;border:solid 1px;">""")
def cellW = 200
def cellStyle0 = "width:${cellW}px;border-left:solid 1px #333;background-color:#eee;"