Jan Tosovsky | 7 Jul 23:05 2015
Picon

RE: Change bars status

On 2015-07-02 Jan Tosovsky wrote:
> I've attached the updated patch recently to the related ticket:
> https://issues.apache.org/jira/browse/FOP-1760
> 
> From that time I locally fixed two issues (2 - support for overlapping
> bars) and (4 - wrapping table cells). The rest requires the help of
> more experienced devs.

I've moved forward the rest of issues. Currently I am considering what
should be covered by layout tests.

My proposal:
change-bar-on-inline (solid bar of same thickness in various places of the
content)
change-bar-on-block (same for block element)
change-bar-on-list (same for list)
change-bar-on-table (same for various table fragments - cell, rows, headers,
tables)
change-bar-on-wrapper (same for wrapper element)
change-bar-on-overlapped (testing overlapped bars)
change-bar-on-mixed

change-bar-style (block elements with various bar styles
/solid/dashed/dotted/..., colors and widths)
change-bar-position (block elements with start/left/end/inset/... position)
change-bar-direction (testing position in LR/RL direction)

Btw, what is preferred dummy text? Currently I use The Universal Declaration
of Human Rights (Article 1). Is it Ok?

(Continue reading)

MH (JIRA | 7 Jul 12:06 2015
Picon

[jira] [Comment Edited] (FOP-2495) Embedding: missing migration documentation from FOP 1.x


    [
https://issues.apache.org/jira/browse/FOP-2495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14616452#comment-14616452
] 

MH edited comment on FOP-2495 at 7/7/15 10:05 AM:
--------------------------------------------------

The missing foUserAgent.setBaseURL() (or setBaseURI()) is a major problem! Even calling it on the
factory builder:

fopFactoryBuilder.setBaseURI(uriBase); //since FOP 2.0

is not enough: "IllegalStateException: The final FOP Factory configuration has already been built"

I have to setup complete FOP for each single document just to change the base URI  to get things working:

-----------------------
    /**
     * Set current base directory.
     *
     *  <at> param defaultBase URI to default base directory (e.g. ".", "file:/K:/reports/xml/fonts/")
     *  <at> param currentBase URI to current working directory (e.g. "file:///C:/Temp/").
     *  <at> param resolver Optional custom resolver.
     *  <at> throws Exception on error.
     */
    public final void setupFOP(final URI defaultBase, final URI currentBase, final ResourceResolver
resolver) throws Exception {
        if (fopConfig != null) {
            if (resolver != null) {
(Continue reading)

MH (JIRA | 7 Jul 12:05 2015
Picon

[jira] [Comment Edited] (FOP-2495) Embedding: missing migration documentation from FOP 1.x


    [
https://issues.apache.org/jira/browse/FOP-2495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14616452#comment-14616452
] 

MH edited comment on FOP-2495 at 7/7/15 10:04 AM:
--------------------------------------------------

The missing foUserAgent.setBaseURL() (or setBaseURI()) is a major problem! Even calling it on the
factory builder:

fopFactoryBuilder.setBaseURI(uriBase); //since FOP 2.0

is not enough: "IllegalStateException: The final FOP Factory configuration has already been built"

I have to setup complete FOP for each single document to get things working:

-----------------------
    /**
     * Set current base directory.
     *
     *  <at> param defaultBase URI to default base directory (e.g. ".", "file:/K:/reports/xml/fonts/")
     *  <at> param currentBase URI to current working directory (e.g. "file:///C:/Temp/").
     *  <at> param resolver Optional custom resolver.
     *  <at> throws Exception on error.
     */
    public final void setupFOP(final URI defaultBase, final URI currentBase, final ResourceResolver
resolver) throws Exception {
        if (fopConfig != null) {
            if (resolver != null) {
(Continue reading)

MH (JIRA | 7 Jul 12:03 2015
Picon

[jira] [Commented] (FOP-2495) Embedding: missing migration documentation from FOP 1.x


    [
https://issues.apache.org/jira/browse/FOP-2495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14616452#comment-14616452
] 

MH commented on FOP-2495:
-------------------------

The missing foUserAgent.setBaseURL() (or setBaseURI()) is a major problem! Even calling it on the
factory builder:

fopFactoryBuilder.setBaseURI(uriBase); //since FOP 2.0

is not enough: "IllegalStateException: The final FOP Factory configuration has already been built"

I have to setup complete FOP for each single document to get things working:

-----------------------
    /**
     * Set current base directory.
     *
     *  <at> param defaultBase URI to default base directory (e.g. ".", "file:/K:/reports/xml/fonts/")
     *  <at> param currentBase URI to current working directory (e.g. "file:///C:/Temp/").
     *  <at> param resolver Optional custom resolver.
     *  <at> throws Exception on error.
     */
    public final void setupFOP(final URI defaultBase, final URI currentBase, final ResourceResolver
resolver) throws Exception {
        if (fopConfig != null) {
            if (resolver != null) {
(Continue reading)

MH (JIRA | 7 Jul 11:53 2015
Picon

[jira] [Commented] (FOP-2495) Embedding: missing migration documentation from FOP 1.x


    [
https://issues.apache.org/jira/browse/FOP-2495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14616444#comment-14616444
] 

MH commented on FOP-2495:
-------------------------

... I don't know what you are refering to. The parth problem is with Windowsnetwork shares like
"\\PC1\...". I set the correct URI (tested in Windows Explorer) "file:////PC1/.." but somehoe, FOP is
changing this to an invalid path.

> Embedding: missing migration documentation from FOP 1.x
> -------------------------------------------------------
>
>                 Key: FOP-2495
>                 URL: https://issues.apache.org/jira/browse/FOP-2495
>             Project: FOP
>          Issue Type: Bug
>          Components: documentation
>    Affects Versions: 2.0
>         Environment: WIndows, Java 8, FOP 1.0
>            Reporter: MH
>            Priority: Blocker
>              Labels: documentation
>
> Because of bug FOP-2177 we couldn't upgrade form FOP 1.0 to FOP 1.1. FOP 2.0 has solved this bug (tested with
standalone FOP scripts).
> Now we would like to upgrade our Java code from FOP 1.0 to FOP 2.0. The Upgrading page
(https://xmlgraphics.apache.org/fop/2.0/upgrading.html) says "You should encounter very few
(Continue reading)

simon steiner (JIRA | 7 Jul 11:08 2015
Picon

[jira] [Commented] (FOP-2495) Embedding: missing migration documentation from FOP 1.x


    [
https://issues.apache.org/jira/browse/FOP-2495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14616392#comment-14616392
] 

simon steiner commented on FOP-2495:
------------------------------------

eg in your ResourceResolver so you bypass fop looking at relative urls
{code}
       public Resource getResource(URI uri) throws IOException {
            return new Resource(new FileInputStream());
        }
{code}

> Embedding: missing migration documentation from FOP 1.x
> -------------------------------------------------------
>
>                 Key: FOP-2495
>                 URL: https://issues.apache.org/jira/browse/FOP-2495
>             Project: FOP
>          Issue Type: Bug
>          Components: documentation
>    Affects Versions: 2.0
>         Environment: WIndows, Java 8, FOP 1.0
>            Reporter: MH
>            Priority: Blocker
>              Labels: documentation
>
> Because of bug FOP-2177 we couldn't upgrade form FOP 1.0 to FOP 1.1. FOP 2.0 has solved this bug (tested with
(Continue reading)

MH (JIRA | 7 Jul 10:54 2015
Picon

[jira] [Commented] (FOP-2495) Embedding: missing migration documentation from FOP 1.x


    [
https://issues.apache.org/jira/browse/FOP-2495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14616385#comment-14616385
] 

MH commented on FOP-2495:
-------------------------

Next problem: when I try to change the base URI:

builder.setBaseURI(uri);

I get this exception:

------------
java.lang.IllegalStateException: The final FOP Factory configuration has already been built
    	at org.apache.fop.apps.FopFactoryBuilder$CompletedFopFactoryConfigBuilder.throwIllegalStateException(FopFactoryBuilder.java:515)
    	at org.apache.fop.apps.FopFactoryBuilder$CompletedFopFactoryConfigBuilder.setBaseURI(FopFactoryBuilder.java:528)
    	at org.apache.fop.apps.FopFactoryBuilder.setBaseURI(FopFactoryBuilder.java:182)
-------------

Very bad! That means I have to create everything from scratch for each document: (!!!):

---
 if (resolver != null) {
                builder = new FopFactoryBuilder(fontBase, resolver);
            } else {
                builder = new FopFactoryBuilder(fontBase);
            }
            builder.setConfiguration(cfg);
(Continue reading)

MH (JIRA | 7 Jul 10:51 2015
Picon

[jira] [Commented] (FOP-2495) Embedding: missing migration documentation from FOP 1.x


    [
https://issues.apache.org/jira/browse/FOP-2495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14616382#comment-14616382
] 

MH commented on FOP-2495:
-------------------------

Simon, I don't see in your code what you mean by "inputstream".

> Embedding: missing migration documentation from FOP 1.x
> -------------------------------------------------------
>
>                 Key: FOP-2495
>                 URL: https://issues.apache.org/jira/browse/FOP-2495
>             Project: FOP
>          Issue Type: Bug
>          Components: documentation
>    Affects Versions: 2.0
>         Environment: WIndows, Java 8, FOP 1.0
>            Reporter: MH
>            Priority: Blocker
>              Labels: documentation
>
> Because of bug FOP-2177 we couldn't upgrade form FOP 1.0 to FOP 1.1. FOP 2.0 has solved this bug (tested with
standalone FOP scripts).
> Now we would like to upgrade our Java code from FOP 1.0 to FOP 2.0. The Upgrading page
(https://xmlgraphics.apache.org/fop/2.0/upgrading.html) says "You should encounter very few
issues in upgrading from FOP 1.0, except as noted in the following: ...". The truth is completely
different: starting by replacing fop.jar, our code gets dozens of compiler errors! Many methods are
(Continue reading)

simon steiner (JIRA | 6 Jul 19:45 2015
Picon

[jira] [Comment Edited] (FOP-2495) Embedding: missing migration documentation from FOP 1.x


    [
https://issues.apache.org/jira/browse/FOP-2495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14615370#comment-14615370
] 

simon steiner edited comment on FOP-2495 at 7/6/15 5:44 PM:
------------------------------------------------------------

You can use a resource resolver to return a inputstream to any files to avoid these issues:
{code}
    static class MyResourceResolver implements ResourceResolver {
        public Resource getResource(URI uri) throws IOException {
            return new Resource(xxx);
        }
        public OutputStream getOutputStream(URI uri) throws IOException {
            throw new RuntimeException(uri.toString());
        }
    }

    public static void main(String[] args) throws TransformerException, SAXException, IOException {
        String fopxconf = "<fop version=\"1.0\"></fop>";

        ResourceResolver cloudResourceResolver = new MyResourceResolver();
        FopFactoryBuilder confBuilder = new FopConfParser(new ByteArrayInputStream(fopxconf.getBytes()),
                EnvironmentalProfileFactory.createRestrictedIO(new File(".").toURI(), cloudResourceResolver)).getFopFactoryBuilder();
        FopFactory fopFactory = confBuilder.build();
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        FileOutputStream fos = new FileOutputStream("out.png");
        Fop fop = fopFactory.newFop("image/png", foUserAgent, fos);
        TransformerFactory factory = TransformerFactory.newInstance();
(Continue reading)

simon steiner (JIRA | 6 Jul 19:44 2015
Picon

[jira] [Commented] (FOP-2495) Embedding: missing migration documentation from FOP 1.x


    [
https://issues.apache.org/jira/browse/FOP-2495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14615370#comment-14615370
] 

simon steiner commented on FOP-2495:
------------------------------------

You can use a resource resolver to return a inputstream to any files to avoid these issues:

    static class MyResourceResolver implements ResourceResolver {
        public Resource getResource(URI uri) throws IOException {
            return new Resource(xxx);
        }
        public OutputStream getOutputStream(URI uri) throws IOException {
            throw new RuntimeException(uri.toString());
        }
    }

    public static void main(String[] args) throws TransformerException, SAXException, IOException {
        String fopxconf = "<fop version=\"1.0\"></fop>";

        ResourceResolver cloudResourceResolver = new MyResourceResolver();
        FopFactoryBuilder confBuilder = new FopConfParser(new ByteArrayInputStream(fopxconf.getBytes()),
                EnvironmentalProfileFactory.createRestrictedIO(new File(".").toURI(), cloudResourceResolver)).getFopFactoryBuilder();
        FopFactory fopFactory = confBuilder.build();
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        FileOutputStream fos = new FileOutputStream("out.png");
        Fop fop = fopFactory.newFop("image/png", foUserAgent, fos);
        TransformerFactory factory = TransformerFactory.newInstance();
(Continue reading)

MH (JIRA | 6 Jul 18:10 2015
Picon

[jira] [Comment Edited] (FOP-2495) Embedding: missing migration documentation from FOP 1.x


    [
https://issues.apache.org/jira/browse/FOP-2495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14615173#comment-14615173
] 

MH edited comment on FOP-2495 at 7/6/15 4:09 PM:
-------------------------------------------------

For the last font Problem I also found a very ugly workaround: I had to read the configuration , get the value
of font-base and set it during the FopFactoryBuilder construction:

----------------------------------
    /**
     * Set up new FOP factory with a configuartion file.
     *
     *  <at> param defaultBaseURI Base URI to read user config file (e.g. "\\PC1\instDir\reports\xml\fonts").
     *  <at> param userConfigFile (e.g. "userconfig.xml")
     *  <at> param resolver Custom resolver.
     *  <at> param uri URI of current working path..
     *  <at> throws Exception on error.
     */
    public final void setUserConfigFile(final File defaultBaseURI, final File userConfigFile, final
ResourceResolver resolver, final URI uri) throws Exception {
        if (userConfigFile != null) {
            DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
            Configuration cfg = cfgBuilder.buildFromFile(userConfigFile);

            //read font-base from configuration file:
            URI fontBase = defaultBaseURI.toURI(); //default (e.g.
"file:////PC1/instDir/reports/xml/fonts/") - network shares doesn't work!
(Continue reading)


Gmane