Package: pdfreactor.parsecfg
This package provides a parsing facility for thePDFreactorclient API,
as provided by thepdfreactor-apipackage.To effectively make use of it, you’ll needa runningPDFreactorserversomePDFreactorintegration for your framework;
when using Plone, you may use thepdfreactor.plonepackage.FeaturesAparse_configurationfunctionIn a Plone context, apdfreactor-configbrowser view
to make basic use of it,
i.e. producing aconfigdictionary from:a site-global textual conversion configuration
which is stored in the Plone registry.a custom@@pdfreactor-conversion-settingsformNote:
Despite the fact that thelicense key–
unless,as recommended, installed on the server –
needs to be put in theconfigdictionary,
we consider this to beconnection-related,so
we don’t expect you to put it in your
conversion configuration.You could do so (specifying itin one single string token), but e.g.
ourpdfreactor.plonepackage offers a dedicated setting in the
IPdfReactorConnectionSettings interface.ExamplesThe textual configuration could for example look like:# line comments are possible
outputFormat = {
    width: 640,  # and so are end-of-line comments
    type: OutputType.PNG_TRANSPARENT,
}The symbols defined by thePDFreactorAPI class are recognized, so this would
be converted to the followingconfigdictionary:{'outputFormat': {
    'width': 640,
    'type': 'PNG_TRANSPARENT',
    }
 }This doesn’t look very magic, but it saves you from finding a way to save
settings for each possible key; you just need one configuration string.On the values side, we’ll accept valid configuration symbols only
(case sensitively, soOutputType.png_transparentwould cause an error)
or validPythonstring or number tokens;  for convenience, several common names
fortrue,falseandnothingare accepted (case-insensitively).LimitationsWe are still limited in what we can process; for stylesheets, for example,
the API expects “objects” (in JSON terms; Python: dictionaries), not just URIs.
For now, we take strings as URI specifications:integrationStyleSheets = ['++resource++pdfreactor.plone/export.css']is converted to:{'integrationStyleSheets': [{
    'uri': '++resource++pdfreactor.plone/export.css'
    }]
 }API methods conversionWe provide as well a
(still incomplete and/or experimental – “use on your own risk”)
conversion function which allows you to convert API calls,
as they have been used until PDFreactor v7; for example:enableDebugMode()would be transformed to thisconfigvalue:{'debugSettings': {'appendLogs': True}}This is not done by default; use:from pdfreactor.parsecfg.oldmethods import convert_api_method
parse_configuration(..., convert=convert_api_method)to make it happen.DocumentationInstallationSimply install the configuration parser by using pip:pip install pdfreactor.parsecfgor, for projects usingbuildout,
add to yourbuildout.cfgscript:[buildout]
...
eggs =
    pdfreactor.parsecfgand then runbin/buildout.This will get you thepdfreactor-apipackage as well.After restarting your Zope instance, you’ll find the package in
the Quick-Installer or
the Plone Add-Ons view.Plone integrationAfter restarting your Zope instance withpdfreactor.parsecfg(and, likely,pdfreactor.plone) added to your eggs,
simply use the Plone Add-Ons view or the Quick-Installer to activate it.Then you may use the configuration registry and use theIPdfReactorConversionSettingsprefix to adjust your conversion preferences.Note:This package is about configuration parsing, not primarily about Zope /
Plone.  To have the PDFreactor web service use your actual session cookies, usepdfreactor.ploneas well.Possible valuesFor the values which will be recognized by thePDFreactorbackend, please refer
to the documentation byRealObjects GmbH:PDFreactor Web service documentationIf, for example, thedocumentation for the debugSettings modeltells you
about the boolean propertiesappendLogs,attachConfiguration,attachDocuments,attachResources,forceResultandall, this means that you may configure e.g.:debugSettings.all = onor:debugSettings = {
    appendLogs: yes,
    forceResult: true,
}Other packagespdfreactor-api, the required API distribution packageSupportIf you are having issuesconcerning this configuration parser,
please let us know;
please use theissue trackermentioned below.For issues regarding thePDFreactoritself, please refer toRealObjects GmbH:PDFreactor Support CenterContribute(To this configuration parser package:)Issue Tracker:https://github.com/visaplan/pdfreactor.plone/issuesSource Code:https://github.com/visaplan/pdfreactor.ploneLicenseThe project is licensed under the MIT License.AuthorTobias Herp,tobias.herp@visaplan.comChangelog1.0.1 (2023-01-20)Bugfixes:ForuserScripts, we need to create dictionaries with ‘uri’ keys as well.Miscellaneous:Obsolete files and directories removed[tobiasherp]1.0.0 (2022-07-12)Initial release.
[tobiasherp]