Git Product home page Git Product logo

sheet-export's Introduction

  • Latest Release Download Count
  • Forge Installs

Sheet Export

This module is an evolution of the Arcanist's module PDF Export.

It aims to offer the ability to export in PDF all the sheets for PC, NPC, Spells, Items etc.

At the moment the module manages:

Game System Version Release Sheets Mantainer Description
dnd5e standard latest PC The classical PC PDF from WotC for the PC for latest release
NPC a custom PDF for NPC for latest release
extended latest PC A union of the classical WotC with extended pages for equipment and spells
NPC a custom PDF for NPC
BR latest PC The Brazilian version of the classical PC PDF from WotC for the PC for latest release
pf1 standard latest PC The remastered PC PDF for Pathfinder 1° Edition
pfe2 remastered latest PC bushvin The remastered PC PDF for Pathfinder 2° Edition
CoC7 standard latest PC The PC PDF for Call of Cthuluh 7° Edition
sfrpg standard latest PC The PC PDF for Starfinder Edition
shadowrun6-eden standard latest PC The PC PDF for Shadowrun 6° Edition (incomplete)
swade standard latest PC The PC PDF for SWADE

If you want to become a mantainer of a game system, please contact me.

Features

  1. Allow to choose different mapping from the ones aviable for the game system (like in the case of dnd5e with standard and extended)
  2. Allow to export images in the PDF
  3. Error management that explain precisely which mapping field had problems
  4. Generate mapping file from PDF form by uploading PDF
  5. Allow to code the mapping in a dedicated class with the option of creating own functions to help the work
  6. Override PDF (it has to have the same mapping attributes to work)

Documentation

Export

As seen in the image below in the actor sheet there is an Export to PDF button in the toolbar

Button

By pressing it you can choose to either use the default PDF that comes with the module (by pressing Apply) or to upload your own PDF (by choosing the button Override mapping's PDF).

Export to PDF

Applying the data to the PDF could require some time so wait untill it is finished and presents the following content:

Alt text

By pressing the round printer button the PDF is generated and downloaded to your computer.

Mapping file

The mapping file is a JS file that has to be named "player.js" or "npc.js" and contains a class named MappingClass that inherits from the base class baseMapping

import baseMapping from "../../../../scripts/baseMapping.js";

class MappingClass extends baseMapping {


    authors = [
        {
            name: 'gioppoluca',
            url: 'https://github.com/gioppoluca',
            github: 'https://github.com/gioppoluca',
        },
    ];
    this.pdfFiles.push({
            pdfUrl: '/modules/sheet-export/mappings/THE_GAME_SYSTEM/YOUR_PDF_FILENAME.pdf',
            nameDownload: \`\${this.actor.name ?? "character"}.pdf\`,
            name: "YOUR_PDF_FILENAME.pdf",
        });
    createMappings() {
      // HERE THE MAPPING CODE
      ...

      // HERE THE CODE TO EMBED THE IMAGE
      this.setImage(this.actor.img, 2, 40, 500, 120, 200);
    }

Add images Images can be embedded in the generated PDF; as shown in the code above there is a function to call: the parameters are (image path to embed, page of the pdf, x position of the bounding box, y position of the bounding box, width of the bounding box, height of the bounding box). The image will be placed within the defined bounding box in the proper page of the PDF; image will be scaled proportionally.

Global content The base class offers a function to keep content that could be splitted in different fields. setGlobalValue function has a key parameter and the mapping value to assign the Global Value. With the getGlobalValue it is ossible to get a number of charcters of the global content by passing (key to the content, start char, end char) the syntax is the same as the substring function.

Settings

The settings form presents the drop down list for choosing the mapping for the game system of the world for your game; after saving a refresh will be asked.

Settings

The Genarate mapping button opens a dialog to access the button Generate mapping for PC from PDF allows you to generate the JS mapping file from the PDF file you will upload: you will get a js file with all PDF fields listed and all the mapping empty for you to complete.

edit mapping

Changelog

Changelog

Support

Please open issues on this repo for any problems that you can have using this module. For discussing on my modules please join my discord server:

If you want to support this work Buy Me A Coffee

sheet-export's People

Contributors

gioppoluca avatar lordmogra avatar bushvin avatar dependabot[bot] avatar

Stargazers

Kianfu Odawara avatar Marco D'Antonio avatar  avatar  avatar

Watchers

 avatar

sheet-export's Issues

PF1e- Not able to create pdf if XP number is not equal to nel level XP requiered

Describe the bug
If experience is not equal to a next level required XP, printer button didnt appear, i.e:
at 50000 XP you can create PDF, at 50001 printer button doesnt appear, that happens for each level if XP didnt match required XP for new level

To Reproduce
Change XP to something diferent than a round noumber for level change

Expected behavior
You can create PDF for any XP given points

Screenshots
If applicable, add screenshots to help explain your problem.

No printer
YES printer

Desktop (please complete the following information):

  • OS: Windows
  • Browser Native app
  • Version 11.315

Additional context

Tested with several characters with several levels and behaviour is the same

create an overloadManager

I need a function that allow to persist long content so that I can split it and load it later on fields.
Since I do not know the order of the fields I need to have a new stanza in the mapping to preload content and place it into a named area.
This way I will be able to consume that content in the fields

manage fonts

There is the need to manage fonts different from helvetica and probably to embed them in the PDF

Error exporting when hosting on The Forge

Describe the bug
There is a 404 error trying to fetch the avatar image when exporting from a game hosted on The Forge.

To Reproduce
Steps to reproduce the behavior:

  1. Be hosted on The Forge
  2. Open Character Sheet
  3. Export To PDF
  4. Apply

Expected behavior
Should ignore error.

Additional context
This appears to happen because the Avatar image is an absolute URL to Forge's Assets page and is being appended to the Forge game's URL. The image that is being attempted to grab is {ForgeGameURL}{AvatarPath}, when in this situation it only needs to be the AvatarPath.

I have a feeling this is being cased by getRoute, but could not find how to tell getRoute to not do this or I would have provided a fix myself (I'll still look into this, but getting more eyes will help I think).

Error when exporting in Chinese language

Describe the bug
Exporting PC sheet and shows the error below.
image

To Reproduce
Steps to reproduce the behavior:
1.Open Character Sheet
2.Export To PDF
3.Apply
4. See error

Expected behavior
Multi language support?

Desktop (please complete the following information):

  • V11.315
  • DND3.2.1
  • mod version 0.7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.