City-of-Bloomington / OnBoard

An extensible system to keep track of boards & commissions details, the people appointed to those groups, any legislation they write, and the voting records of each committee member.
https://bloomington.in.gov/onboard
GNU Affero General Public License v3.0
16 stars 4 forks source link

Validate uploaded files for accessbility #326

Open inghamn opened 1 year ago

inghamn commented 1 year ago

When users upload meetingFiles we want to make sure they're accessible. Making an accessible document involves a special process that must be done by the user in Word (or LibreOffice).

It would be a good thing to have the server validate the uploaded files and not proceed if the user's file does not pass. VeraPDF is an open source PDF validator that could be used.

https://verapdf.org

inghamn commented 1 year ago

Ubuntu 22.04 ships with LibreOffice 7.3, which does not have support for setting these parameters on the command line. In the future, LibreOffice 7.4 will have these options available on the command line.

libreoffice --convert-to pdf:writer_pdf_Export:SelectPdfVersion=16,PDFUACompliance,UseTaggedPDF=True

In the meantime, these options can only be set by editing the user configuration files. In particular, we would need to edit the registrymodifications.xcu.

<item oor:path="/org.openoffice.Office.Common/Filter/PDF/Export"><prop oor:name="ExportFormFields" oor:op="fuse"><value>false</value></prop></item>
<item oor:path="/org.openoffice.Office.Common/Filter/PDF/Export"><prop oor:name="PDFUACompliance" oor:op="fuse"><value>true</value></prop></item>
<item oor:path="/org.openoffice.Office.Common/Filter/PDF/Export"><prop oor:name="SelectPdfVersion" oor:op="fuse"><value>3</value></prop></item>
<item oor:path="/org.openoffice.Office.Common/Filter/PDF/Export"><prop oor:name="UseLosslessCompression" oor:op="fuse"><value>true</value></prop></item>
<item oor:path="/org.openoffice.Office.Common/Filter/PDF/Export"><prop oor:name="UseTaggedPDF" oor:op="fuse"><value>true</value></prop></item>

I think if we edit this file, those settings will persist. Launching the gui version of LibreOffice and clicking around will change these settings. However, since we only install the headless version of LibreOffice, I do not think these will be changed.

inghamn commented 1 year ago

VeraPDF supports defining our policy using XML. We can write an XML schematron file defining the things we want to Vera to check for.

https://docs.verapdf.org/policy