Arkana Tools

Generate PDF Button

Checking your licence…

Partner documentation. Requires a Co-Brand or Whitelabel licence from Arkana Tools.

Generate PDF Button

Put a “Generate PDF” button next to any map on your site. One script tag, no build step, no dependencies. Your visitors get a printable, cut-and-assemble PDF of your map.

Available on Co-Brand and Whitelabel commercial licences, under our Terms of Service. The button opens the Paper Map Generator in a new tab, hands the image over directly from your visitor's browser, and the PDF is generated and downloaded there — your maps are never stored on our servers. See the Privacy Policy for what is processed.

Quick start

Add a container where the button should appear, then load the script:

<div id="pdf-button"></div>

<script
  src="https://js.arkanatools.com/pdf-button/v1.js"
  data-arkanatools-id="YOUR-ACCOUNT-UUID"
  data-image-selector="#my-map-image"
></script>

That's it. Two things you must get right:

Tell the generator how big the map is. This is what makes the print come out at the right scale — see Map scale. In short, either name the file my-map-70x48.webp or set data-settings-map-tiles="70x48".
Your account UUID is visible in your page source. That is expected — it identifies you, it is not a password. It only works from the domain registered on your licence, so it cannot be lifted and used elsewhere. Tell us if you change domains.

Try it

A real map, a real button — exactly the integration shown above.

The live demo is not configured on this copy of the documentation.

Options

All configuration is data-* attributes on the script tag.

AttributeDefaultDescription
data-arkanatools-idrequired Your Arkana account UUID.
data-image-selector#arkana-map-image CSS selector for the map <img>. Ignored if you use the JavaScript API.
data-mountpdf-button Id of the element the button is placed inside.
data-stylearkana Set to none to load no stylesheet and style the button yourself.

Map scale

Get this right and a printed square lines up with a miniature's base. Get it wrong and the whole map prints too large or too small, across the wrong number of pages.

The generator needs to know how big your map is in the real world. You can say that in tiles or in inches — whichever you actually know.

In tiles (usually what you want)

Tiles are the grid squares or hexes players count movement across. If your map is 70 squares wide and 48 tall:

data-settings-map-tiles="70x48"

Tiles are assumed to print at 1 inch each, the standard for tabletop battlemaps. If yours are a different size — 1.5″ hexes, or 25 mm squares (0.98″) — say so:

data-settings-map-tiles="70x48"
data-settings-tile-size="1.5"   <!-- inches per tile -->

In inches

If you know the finished printed size instead, give that directly:

data-settings-map-size="70x48"   <!-- inches -->

Or in the filename

With no settings at all, the generator looks for a WIDTHxHEIGHT token in the image filename and reads it as inches — harbin-westers-home-70x48.webp is a 70×48 inch map. Convenient if your library is already named that way, and it needs no configuration.

Precedence: map-size wins, then map-tiles, then the filename. If none of them is present the scale falls back to a default and your grid will not match the size you intended.

Map settings

Optionally control how the PDF is generated with data-settings-* attributes. Anything you leave out keeps the generator's default, and an unrecognised value is ignored rather than breaking generation.

SettingValues
data-settings-grid-typesquare, hexagon, hexagon-rotated, isometric, universal
data-settings-grid-overlaytrue, false
data-settings-grid-stylesolid, thin, dashed, dashed-thin
data-settings-grid-colorHex colour, e.g. #071214
data-settings-guide-colorHex colour — the assembly guide numbering
data-settings-paper-sizea0–a9, legal, letter, tabloid, ledger
data-settings-backside-numberstrue, false
data-settings-backside-cutlinestrue, false
data-settings-cutline-sizeNumber, e.g. 4
data-settings-cutline-colorHex colour
data-settings-cutting-methodoptimized, even, precise
data-settings-safety-marginnone, safe, double, extreme
data-settings-piece-marginnone, safe, double, extreme
data-settings-scale-accuracyprecise, limited, relaxed, extreme, or a number of inches
data-settings-commercial-logoURL of your logo, printed on the backside
data-settings-map-tilesWIDTHxHEIGHT in grid tiles, e.g. 70x48 — see Map scale
data-settings-tile-sizeInches per tile, default 1
data-settings-map-sizeWIDTHxHEIGHT in inches — takes precedence over both of the above
Some combinations are adjusted automatically, matching how the generator's own interface behaves: precise cutting needs a plain square grid with no overlay, and the universal grid always uses a solid style with the overlay off.

Example

<script
  src="https://js.arkanatools.com/pdf-button/v1.js"
  data-arkanatools-id="YOUR-ACCOUNT-UUID"
  data-image-selector="#my-map-image"
  data-settings-grid-type="hexagon"
  data-settings-paper-size="letter"
  data-settings-backside-numbers="true"
  data-settings-commercial-logo="https://your-site.com/logo.png"
></script>

Styling

The button ships looking like an Arkana Tools button. Its typography inherits from your page, so it picks up your font automatically. There are three levels of control.

1. Retint it

Override the custom properties. Keeps the shape and interactions, in your colours:

Copy the result straight into your stylesheet:

.arkana-pdf-button {
  --arkana-btn-bg-top: #9E0B0F;
  --arkana-btn-bg-bottom: #E61720;
  --arkana-btn-border: #E61720;
  --arkana-btn-color: #CCCDD2;
  --arkana-btn-radius: 6px;
}

2. Style it from scratch Whitelabel only

Removing the Arkana Tools styling entirely is permitted on a Whitelabel licence only. On Co-Brand, the button is meant to read as an Arkana Tools control — retint it to suit your palette using the custom properties above, but keep it recognisable.

On Whitelabel, add data-style="none" and no stylesheet of ours is loaded at all — you get a plain <button class="arkana-pdf-button"> with no styling to fight:

<script
  src="https://js.arkanatools.com/pdf-button/v1.js"
  data-arkanatools-id="YOUR-ACCOUNT-UUID"
  data-image-selector="#my-map-image"
  data-style="none"
></script>

<style>
  .arkana-pdf-button { /* entirely your design system */ }
</style>

3. States you should style

The button disables itself while a PDF is being prepared and re-enables when the tab responds, so style :disabled — otherwise a working button looks broken.

JavaScript API

If your map is not a plain <img> — it is drawn on a canvas, or fetched dynamically — hand the bytes over yourself instead of using data-image-selector:

window.PDFButton.setImage(arrayBuffer, 'my-map-30x30.jpg', width, height);

The filename still carries the map scale, so pass a real one. Call this before the visitor clicks; the button reads it at click time.

Image requirements

The map image must be readable by JavaScript. That means it is either on the same domain as the page (the normal case — just host your maps on your own site), or its host sends an Access-Control-Allow-Origin header. This is a browser security rule we cannot work around: a browser will not let any script read the pixels of an image from another domain without permission.

In practice this only bites if you serve maps from a separate image CDN or a different subdomain. If so, enable CORS there. The button will tell you in the browser console when this is the problem.

Formats: PNG, JPEG, WebP and GIF. The original file is sent as-is, so there is no quality loss from re-encoding.

Troubleshooting

What you seeWhat it means
“This integration is not authorised” The account UUID is wrong, the licence has no generations left, or the page's domain does not match the one registered on your licence. Changed domain recently? Tell us.
“Could not read the map image” Cross-origin image without CORS — see image requirements. The console names the exact URL.
“Please allow popups for this site” The browser blocked the new tab. The button only opens one in direct response to a click, so allowing popups for your domain fixes it.
“The PDF generator did not respond” The tab did not answer within 15 seconds. Usually a slow connection; try again.
Button does not appear at all The data-mount element does not exist. The console says which id it looked for.
Printed grid is the wrong size The map's real-world size was never stated, so it was guessed. Set data-settings-map-tiles — see Map scale.

Versioning

The v1 in the URL is a promise: we ship fixes and new settings to it, but never a change that breaks a page already using it. If we ever need to break something it becomes v2.js at a new URL, and v1.js keeps working.

So pin the version — use /pdf-button/v1.js exactly as shown. You never need to update it to receive fixes.

Need help? support@arkanatools.com
Use of this button is governed by our Terms of Service and Privacy Policy.