<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8">

<title>Alih Aksara Print</title>

<style>

body {
max-width:76mm;
}

@page {
size:76mm 60mm;
margin:0;
}

.aksara_img{
max-width:85%;
position:absolute;
top:0;
bottom:0;
margin:auto;
left:0;
right:0;
}

</style>

</head>

<body onload="window.print()">

@php

if($aksara_type == 'jawa'){
$aksara_text = $aksara_jawa;
}elseif($aksara_type == 'sunda'){
$aksara_text = $aksara_sunda;
}elseif($aksara_type == 'lontara'){
$aksara_text = $aksara_bugis;
}elseif($aksara_type == 'bali'){
$aksara_text = $aksara_bali;
}elseif($aksara_type == 'batak'){
$aksara_text = $aksara_batak;
}elseif($aksara_type == 'lampung'){
$aksara_text = $aksara_lampung;
}elseif($aksara_type == 'incung'){
$aksara_text = $aksara_incung;
}else{
$aksara_text = "Tidak ada Aksara";
}

$aksara_json = json_encode([
"aksara_latin"=>$aksara_latin,
"aksara_type"=>$aksara_type,
"aksara_text"=>$aksara_text
], JSON_UNESCAPED_UNICODE);

$base_url = url('/');
//$url_membership = "https://revitalisasiaksara.com/aksara_image_generate_imagick_v4_7860.php";
$url_membership = url('/aksara_image_generate_imagick_v4_7860.php');
//$url_membership = 'http://apprevitalisasi.test/aksara_image_generate_imagick_v4_7860.php';

$options = [
'http'=>[
'method'=>'POST',
'timeout'=>5,
'content'=>$aksara_json,
'header'=>"Content-Type: application/json\r\nAccept: application/json\r\n",
]
];

$context = stream_context_create($options);

$imgbinary = file_get_contents($url_membership,false,$context);

$image = 'data:image/png;base64,'.base64_encode($imgbinary);

@endphp

<img src="{{ $image }}" class="aksara_img">

</body>

</html>
