[
https://issues.apache.org/jira/browse/FOP-2524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14738732#comment-14738732
]
MH commented on FOP-2524:
-------------------------
I found the problem and a workaround: the FopFactoryBuilder does not seem to
read (all) the values from the Configuration. During debugging, I noticed, that
the Configuration object hat the correct target-resolution 288, but the
FoUserAgent had the default 72 DPI. My workaround is, to read the
target-resolution from the Configuration and set it explicitaly in the
FoUserAgent:
----------
/**
* Setup FOP.
*
* @param defaultDir Default base directory. Required for remaining
(default / FOP internal) URI resolvements. (e.g. ".",
"K:\amcReports\xml\fonts").
* @param currentDir Current base directory for custom URI resolver. (e.g.
"H:\temp\iComps\amc\rep\150709155541BE13E0-F516-478C-AF77-5E23D7DCD594\1_4986\0_R_FrontPage2_10").
* @throws Exception on error.
* @since 6.2.0
*/
public final void setupFOP(final File defaultDir, final File currentDir)
throws Exception {
URI defaultURI = null;
if (defaultDir != null) {
defaultURI = defaultDir.toURI();
}
URI currentURI = null;
if (currentDir != null) {
currentURI = currentDir.toURI();
if (uriResolver != null) {
uriResolver.setCurDir(currentDir);
}
}
if (fopConfig != null) {
if (uriResolver != null) {
fopFactoryBuilder = new FopFactoryBuilder(defaultURI,
uriResolver);
} else {
fopFactoryBuilder = new FopFactoryBuilder(defaultURI);
}
fopFactoryBuilder.setConfiguration(fopConfig); //expected to also
read target-resolution
fopFactoryBuilder.setBaseURI(currentURI); //since FOP 2.0
//builder.setStrictFOValidation(false);
fopFactory = fopFactoryBuilder.build();
} else {
fopFactory = FopFactory.newInstance(currentURI);
}
foUserAgent = fopFactory.newFOUserAgent();
//workaround to set configuration values explicitaly from configuration:
foUserAgent.setTargetResolution(fopConfig.getChild("target-resolution").getValueAsInteger());
}//setupFOP()
------------------------------
As the Configuration is set in the FopFactoryBuilder and the FopFactory is
created from it and the FoUserAgent is created from this FopFactory, I expected
that the FoUserAgent had the targetResolution from the configuration. But is
not the case.
> FOP 2.0: PNG renderer produces very bad quality
> -----------------------------------------------
>
> Key: FOP-2524
> URL: https://issues.apache.org/jira/browse/FOP-2524
> Project: FOP
> Issue Type: Bug
> Components: renderer/png
> Affects Versions: 2.0
> Environment: Java 1.8.0_51, 64 Bit, Windows 7, Windows 2008 R2
> Reporter: MH
> Priority: Blocker
> Attachments: screenshot-FOP-PNG-Renderer.png
>
>
> We upgraded from FOP 1.0 to FOP 2.0 (as we had to skip FOP 1.1 due to a
> blocker bug in 1.1). After converting all Java embedding code, we are now in
> test phase. Almost everything looks good, but our PNG rendered documents
> suddenly all look very blurry (see atachement). We had the same problem with
> FOP 1.0 but "solved" it by setting the target resolution to 288:
> <target-resolution>288</target-resolution>
> We still have this setting in the fop user config XML file, but it seems that
> it has no effect anymore!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)