farling42 / fvtt-pdf-pager

PDF Pager for Foundry
MIT License
6 stars 4 forks source link

Idea CSV export from PDF #25

Closed CePeU closed 1 year ago

CePeU commented 1 year ago

As PDF forms might be a temporary step before a system will be fully implemented maybe an integration of a new menue button which allows to export all pdf form fields into a CSV might be helpfull for reimporting or using the character data in foundry or third party applications.

A simple solution like looping over all form fields end extracting the name as header and the value as data would probably be enough.

farling42 commented 1 year ago

If Foundry ever adds core support for Form Fillable PDFs, then a simple macro would be enough to transfer the "hidden" data on actors into the correct location for however the core support will work.

You could actually write a macro that would iterate over a PDF document that has been loaded into a window, to find the relevant fields and their stored values.

CePeU commented 1 year ago

IF :) Also you need to be able to write such a macro which most are not able to do. If I have understood right so far the PDF is mapped to a foundry document and is accessed that way? Maybe I would try that as an excercixe. I also saw that PDF Pager supports a JSON for mapping. If such is supplied could it be used to also get the data from the PDF (thus only exporting those values which habe been defined?

farling42 commented 1 year ago

A PDF defines the name of each editable field within it. An Actor in Foundry has a lot of data fields inside it. Most of the time there is a simple 1-to-1 mapping between the two; but sometimes there is more work involved in transforming one field into how it can be displayed on the other side of the mapping.

PDF Pager actually allows you to define a Javascript object which defines the marking, rather than it being only JSON. This allows the not-simple mappings to be handled by functions.

farling42 commented 1 year ago

Issue #14 is a proposal to help people move from the hidden fields to normal actor fields. This would simplify the transition to game system supported fields without requiring the creation of an intermediate CSV file.