How to use "com.jaspersoft.jasperreports.export.pdf.modern.ModernPdfProducerFactory" programmatically - jasper-reports

When using with Jasperreport Library programmatically, how can we change the default PDF producer to the iText7 producer?
i.e. com.jaspersoft.jasperreports.export.pdf.modern.ModernPdfProducerFactory
already tried to set the following before invoking export but FAILED:
net.sf.jasperreports.engine.export.JRPdfExporter.PDF_PRODUCER_FACTORY_PROPERTY = "com.jaspersoft.jasperreports.export.pdf.modern.ModernPdfProducerFactory";

Got answered from github of jasperreports-pdf-lib7, quoted below:
You can set the PDF producer property programmatically like this:
DefaultJasperReportsContext.getInstance().setProperty(JRPdfExporter.PDF_PRODUCER_FACTORY_PROPERTY, "com.jaspersoft.jasperreports.export.pdf.modern.ModernPdfProducerFactory");
You can also use ModernPdfProducerFactory.class.getName() as property value if you don't mind a compile dependency.

Related

fox:alt-text not allowed to appear in element 'fo:external-graphic'."

I'm trying to add the alternate text into my images just as the Apache FOP documentation instructs: By using fox-alt:-text.
<fo:external-graphic src="logo.gif" content-width="75%" content-height="75%" fox:alt-text="My company logo"/>
I'm using Apache FOP version 2.5 and accessibility is ON (setted true in fop.xconf). For some reason I'm getting an error message saying
org.xml.sax.SAXParseException:cvc-complex-type.3.2.2: Attribute 'fox:alt-text' is not allowed to appear in element 'fo:external-graphic'.
Any ideas on what might be wrong?
I now realized that the problem is not in Apache FOP but it's in my code. Our system is doing some additional schema validation (javax.xml.validation.Validator) against the plain fo schema and doesn't see the fox extension.
fox:alt-text is not a part of the original fo schema's fo:external-graphic definition and is causing validation failures.

How to pass {useMasterKey: true} to a parse-server js aggregate query?

I want to do an aggregate query using parse-server js.
Something of the style of the following code, but instead of using .find(), using .aggregate(pipeline, options).
const query = new Parse.Query("myClass");
query.find().then( // ... do something with the resulting objects)
)
According to the docs (https://parseplatform.org/Parse-SDK-JS/api/v1.11.0/Parse.Query.html#aggregate), aggregate requires the masterkey to be used. However, the options parameter of the call to .aggregate(pipeline, options) does not allow for the passing of an object that has the field to use the masterkey defined.
The workarounds found online suggest the use of Parse.Cloud.useMasterkey, which has been deprecated.
You must set the master key during the initialization of your Parse SDK. At some point in your code you probably initialize the connection with the Parse Server using a code similar to this:
Parse.serverURL = 'http://url_to_parse_server.com'
Parse.initialize('appId')
What you have to do is to pass two new parameters in the .initialize function above. The second parameter is a key to use the JS SDK, but if didn't set this key in your Parse Server then you can pass null in this parameter.
The third parameter is what you are looking for and here is where you will put the master key. Like this:
Parse.initialize('appId', null, 'master key')
After you do that all the API calls that require the master key, like aggregate will use it automatically.
There are actually two libraries at play here. Firstly, there is Parse Server - where they requirement for the use of the MasterKey is coming from.
Then there is the Parse JS SDK (to which your documentation link points) - which is the environment which Cloud Code uses to talk to Parse Server.
If you look at the source code for the aggregate function in the JS SDK, it appears that they set the MasterKey automatically: https://github.com/parse-community/Parse-SDK-JS/blob/8a69f9504f398187a856797c4b037b8eb6804dd8/src/ParseQuery.js#L763
So your query should just work, without you having to set the MasterKey explicitly from the JS SD call.

How to include application version number in HTML documentation genertated by Spring Rest Docs?

I would like to include application version number (version from build.gradle).
I see no way to pass some custom variables to ascidoc and use them in generated documentation. Is it possible?
Passing custom variables from gradle can be done using
asciidoctor {
attributes "build=${build}"
}
Then defined attribute may be refered in adoc file as {build}

Outlook meetings and rich text format

I have been working on creating appointments from Powershell in Outlook. Everything seems to be working with the exception of being able to set the appointment.RTFBODY. It looks like it is stored as a byte array, but despite my best efforts and many attempts I have been unable to set it. Any suggestions would be much appreciated.
http://pastebin.com/kQvGfNRS
Edit: I was able to find what could be a similar issue. https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5dba0d12-94e8-47a5-b082-93d3693e2a47/cant-set-the-rtfbody-of-an-appointmentitem
"I assume you add a wrong version reference. If you add Microsoft.Office.Interop.Outlook 12.0, I could reproduce your issue. I suggest you remove this reference, and add Microsoft.Office.Interop.Outlook 14.0."
Also found this: Outlook AppointmentItem - How do I programmatically add RTF to its Body?
from the link in your question - "it is just a known problem in OOM - setting the RtfBody property using early binding works. Setting through IDispatch::GetIDsIfNames / Invoke does not."
Powershell always uses late bindings (i.e. you cannot declare a variable as an instance of a particular object. e.g. AppointmentItem).

How to add an extra plist property using CMake?

I'm trying to add the item
<key>UIStatusBarHidden</key><true/>
to my plist that's auto-generated by CMake. For certain keys, it appears there are pre-defined ways to add an item; for example:
set(MACOSX_BUNDLE_ICON_FILE ${ICON})
But I can't find a way to add an arbitrary property.
I tried using the MACOSX_BUNDLE_INFO_PLIST target property as follows: I'd like the resulting plist to be identical to the old one, except with the new property I want, so I just copied the auto-generated plist and set that as my template. But the plist uses some Xcode variables, which also look like ${foo}, and CMake grumbles about this:
Syntax error in cmake code when
parsing string
<string>com.bedaire.${PRODUCT_NAME:identifier}</string>
syntax error, unexpected cal_SYMBOL,
expecting } (47)
Policy CMP0010 is not set: Bad
variable reference syntax is an error.
Run "cmake --help-policy CMP0010"
for policy details. Use the
cmake_policy command to set the
policy and suppress this warning. This
warning is for project developers.
Use -Wno-dev to suppress it.
In any case, I'm not even sure that this is the right thing to do. I can't find a good example or any good documentation about this. Ideally, I'd just let CMake generate everything as before, and just add a single extra line. What can I do?
Have you looked into copying the relevant *.plist.in file in /opt/local/share/cmake-2.8/Modules (such as MacOSXBundleInfo.plist.in), editing it to put <key>UIStatusBarHidden</key><true/> (or #VAR_TO_REPLACE_BY_CMAKE#), and adding the directory of the edited version in the CMAKE_MODULE_PATH?
If you have CMake installed as an app bundle, then the location of that file is /Applications/CMake.app/Contents/share/cmake-N.N/Modules
You can add your values using # and pass #ONLY to configure_file.
Unfortunately there is no simple way to add custom line to generated file.