Creating PDFpriate Plugins (Mason)
Since the core components and some plugins use Mason it's now very simple to extend PDFpirate functionality using this framework. Please check out this guide first to get general information about creating plugins.
Available global variables
The following globals are available to you at all times.
%strings # textual data
%config # config options
$language # language detected or set by user
$language_subtag # ISO 639-1 language subtag
$text_direction # text direction ('ltr' or 'rtl')
Apache2 settings
All directories are by default served with Mason. No change is required to the configuration file.
Hello world!
For Hello world! plugin simply copy and paste the below code into index.html file in your working directory. Don't forget adding the necessary text to the English.strings db for this to work.
<!DOCTYPE html>
<html dir="<% $text_direction | h %>" lang="<% $language_subtag | h %>">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="/lib/style.css">
<link rel="stylesheet" href="/plugins/my_plugin/my_plugin.css">
<script src="/plugins/my_plugin/my_plugin.js"></script>
<title><% ($text_direction eq 'rtl') ? '‫' : '' %>PDFpirate, <% $strings{my_plugin_000} | h %><% ($text_direction eq 'rtl') ? '‬' : '' %></title>
</head>
<body>
<div id="the_container">
<p><% $strings{my_plugin_001} | h %></p>
</div>
</body>
</html>