Java Mailing List Archive

http://www.java2.5341.com/

Home » fop-users-digest.xmlgraphics »

fop-users Digest 4 Jan 2013 07:47:07 -0000 Issue 2631

fop-users-digest-help

2013-01-04


Author LoginPost Reply

fop-users Digest 4 Jan 2013 07:47:07 -0000 Issue 2631

Topics (messages 36145 through 36149)

Re: FOP 1.1 embedded examples
 36145 by: Robert Meyer

U+200e left-to-right mark glyph not available
 36146 by: Ryan Fong

Re: FOP 1.1 embedded examples - SOLVED step 1
 36147 by: Arjan Bokx

Re: FOP 1.1 embedded examples - SOLVED step 2
 36148 by: Arjan Bokx

Re: FOP 1.1 embedded examples - step 3 (final step)
 36149 by: Arjan Bokx

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: fop-users@(protected)
To unsubscribe, e-mail: fop-users-digest-unsubscribe@(protected)
For additional commands, e-mail: fop-users-digest-help@(protected)

----------------------------------------------------------------------


Attachment: fop-users_36145.eml (zipped)
Hi Arjan,

I did the following to get it working:

1) From the command line I went to the examples\embedding\ directory and ran ant to generate all the classes into a ./build/ directory.
2) I then ran the following from the same directory:

java -cp "build/classes:../../lib/*:../../build/fop.jar" embedding.ExampleFO2PDF

It will be slightly different for you though as I am on Linux. To get it running on Windows you will need to change the colons for semi-colons e.g.

java -cp "build/classes;../../lib/*;../../build/fop.jar" embedding.ExampleFO2PDF

That should then generate the output successfully into the ./out/ directory.

Let me know if you are still having problems

Regards,

Robert Meyer

> From: arjan.bokx@akb-ls.nl
> To: fop-users@xmlgraphics.apache.org
> Subject: FOP 1.1 embedded examples
> Date: Wed, 2 Jan 2013 07:29:14 +0000
>
> Hello everybody,
>
> I have a question about getting the "embedded" examples of FOP 1.1 to work.
> Is this the right place to ask?
> (If not, please redirect me and disregard the following)
>
> My OS is Windows XP.
> I've downloaded and installed the Java SDK 1.7.0_10
> I've downloaded and installed fop 1.1
> I've downloaded and installed Ant.
> With Ant, I compiled the "embedded" examples.
> "Ant example1" correctly runs ExampleFO2PDF.
> What should I do to call ExampleFO2PDF from Java? Actually I wish to call it from Delphi, using JNI, but first things first.
> "Java ExampleFO2PDF" from the command line gives:
> Exception in thread "main" java.lang.NoClassDefFoundError: ExampleFO2PDF (wrong name: embedding/ExampleFO2PDF)
>
> When I add just about every path to the classpath with the command line option -cp, I get:
> Error: Could not find or load main class ExampleFO2PDF.main
>
> Could you help me please.
>
>
> Regards,
> Arjan Bokx
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>

Attachment: fop-users_36146.eml (zipped)
G'day, everyone. I've encountered some trouble using the bidi control
character U+200E "left-to-right mark (LRM)" as described in the complex
script guide for Apache FOP 1.1.

According to fileformat.info, Arial Unicode MS 1.01 supports this
character but I encounter a warning message from FOP during rendering
and a "#" character is shown in its place. I couldn't find any recent
discussions about this for Apache FOP 1.1, hence this new message.

Thanks!


= OUTPUT (trimmed) =
C:\fop-1.1>fop -c fop.xml -fo in.xml -pdf out.pdf
Jan 02, 2013 9:46:35 AM org.apache.fop.events.LoggingEventListener
processEvent
WARNING: Glyph "?" (0x200e, afii299) not available in font
"ArialUnicodeMS".

= ATTACHMENTS =
* fop.xml: fop xml configuration
* in.xml: fop xml input
* out.pdf: pdf output

= REFERENCES =
http://xmlgraphics.apache.org/fop/trunk/complexscripts.html#bidi_control
s
http://www.fileformat.info/info/unicode/char/200e/fontsupport.htm
http://www.w3.org/TR/i18n-html-tech-bidi/#ri20030726.140315918

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:saxon="http://saxon.sf.net/"
  xmlns:fo="http://www.w3.org/1999/XSL/Format"
  font-size="9pt"
  font-family="ARIALUNI">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="report"
       margin-top=".25in"
       margin-bottom=".25in"
       margin-right=".25in"
       margin-left=".25in"
       page-height="11in"
       page-width="8.5in"
       writing-mode="rl">
       <fo:region-body margin-top="1.1in" margin-bottom=".25in"/>
       <fo:region-before extent="1.1in"/>
       <fo:region-after extent=".25in"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="report" writing-mode="rl">
    <fo:title font-family="ARIALUNI">title</fo:title>
    <fo:flow flow-name="xsl-region-body" font-family="ARIALUNI">
       <fo:table table-layout="fixed" width="100%" font-family="ARIALUNI">
          <fo:table-body>
            <fo:table-row>
               <fo:table-cell number-columns-spanned="2"
                  padding="4pt"
                  padding-top="0pt"
                  padding-bottom="0pt">
                  <fo:block
                    font-size="9pt"
                    font-style="normal"
                    font-weight="bold"
                    padding-top="0pt"
                    padding-bottom="0pt"
                    keep-with-next="always"
                    font-family="ARIALUNI">
                    <!-- WARNING: Glyph "?" (0x200e, afii299) not available in font "ArialUnicodeMS". -->
                    Cairo (EGY)&#x200e;
                  </fo:block>
               </fo:table-cell>
            </fo:table-row>
          </fo:table-body>
       </fo:table>
       <fo:block id="last-page" font-family="ARIALUNI"/>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

Attachment: out.pdf (zipped)
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Id: fop.xconf 447325 2006-09-18 10:55:33 +0200 (Mon, 18 Sep 2006) jeremias $ -->

<!--

This is an example configuration file for FOP.
This file contains the same settings as the default values
and will have no effect if used unchanged.

Relative config url's will be resolved relative to
the location of this file.

-->

<!-- NOTE: This is the version of the configuration -->
<fop version="1.0">

<!-- Base URL for resolving relative URLs -->
<base>.</base>

<!-- Source resolution in dpi (dots/pixels per inch) for determining the size of pixels in SVG and bitmap images, default: 72dpi -->
<source-resolution>72</source-resolution>
<!-- Target resolution in dpi (dots/pixels per inch) for specifying the target resolution for generated bitmaps, default: 72dpi -->
<target-resolution>72</target-resolution>

<!-- Default page-height and page-width, in case
    value is specified as auto -->
<default-page-settings height="11in" width="8.26in"/>

<!-- Information for specific renderers -->
<!-- Uses renderer mime type for renderers -->
<renderers>
  <renderer mime="application/pdf">
   <filterList>
    <!-- provides compression using zlib flate (default is on) -->
    <value>flate</value>

    <!-- encodes binary data into printable ascii characters (default off)
        This provides about a 4:5 expansion of data size -->
    <!-- <value>ascii-85</value> -->

    <!-- encodes binary data with hex representation (default off)
        This filter is not recommended as it doubles the data size -->
    <!-- <value>ascii-hex</value> -->
   </filterList>
   <fonts>
      <font embed-url="ARIALUNI.TTF" >
        <font-triplet name="ARIALUNI" style="normal" weight="normal"/>
        <font-triplet name="ARIALUNI" style="normal" weight="bold"/>
        <font-triplet name="ARIALUNI" style="italic" weight="normal"/>
        <font-triplet name="ARIALUNI" style="italic" weight="bold"/>
     </font>

     <font embed-url="ARIALBOLD.TTF">
        <font-triplet name="ARIALBOLD" style="normal" weight="normal"/>
        <font-triplet name="ARIALBOLD" style="italic" weight="normal"/>
        <font-triplet name="ARIALBOLD" style="bold" weight="bold"/>
      </font>

      <font embed-url="ARIALITALIC.TTF">
        <font-triplet name="ARIALITALIC" style="normal" weight="normal"/>
        <font-triplet name="ARIALITALIC" style="italic" weight="normal"/>
        <font-triplet name="ARIALITALIC" style="bold" weight="bold"/>
      </font>

      <font embed-url="ARIALBOLDITALIC.TTF">
        <font-triplet name="ARIALBOLDITALIC" style="normal" weight="normal"/>
        <font-triplet name="ARIALBOLDITALIC" style="italic" weight="normal"/>
        <font-triplet name="ARIALBOLDITALIC" style="bold" weight="bold"/>
      </font>

 <!-- embedded fonts -->
    <!--
    This information must exactly match the font specified
    in the fo file. Otherwise it will use a default font.

    For example,
    <fo:inline font-family="Arial" font-weight="bold" font-style="normal">
       Arial-normal-normal font
    </fo:inline>
    for the font triplet specified by:
    <font-triplet name="Arial" style="normal" weight="bold"/>

    If you do not want to embed the font in the pdf document
    then do not include the "embed-url" attribute.
    The font will be needed where the document is viewed
    for it to be displayed properly.

    possible styles: normal | italic | oblique | backslant
    possible weights: normal | bold | 100 | 200 | 300 | 400
                | 500 | 600 | 700 | 800 | 900
    (normal = 400, bold = 700)
    -->

    <!--
    <font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf">
      <font-triplet name="Arial" style="normal" weight="normal"/>
      <font-triplet name="ArialMT" style="normal" weight="normal"/>
    </font>
    <font metrics-url="arialb.xml" kerning="yes" embed-url="arialb.ttf">
      <font-triplet name="Arial" style="normal" weight="bold"/>
      <font-triplet name="ArialMT" style="normal" weight="bold"/>
    </font>
    -->
   </fonts>

   <!-- This option lets you specify additional options on an XML handler -->
   <!--xml-handler namespace="http://www.w3.org/2000/svg">
    <stroke-text>false</stroke-text>
   </xml-handler-->

  </renderer>

  <renderer mime="application/postscript">
   <!-- This option forces the PS renderer to rotate landscape pages -->
   <!--auto-rotate-landscape>true</auto-rotate-landscape-->

   <!-- This option lets you specify additional options on an XML handler -->
   <!--xml-handler namespace="http://www.w3.org/2000/svg">
    <stroke-text>false</stroke-text>
   </xml-handler-->
  </renderer>

  <renderer mime="application/vnd.hp-PCL">
  </renderer>

  <!-- MIF does not have a renderer
  <renderer mime="application/vnd.mif">
  </renderer>
  -->

  <renderer mime="image/svg+xml">
   <format type="paginated"/>
   <link value="true"/>
   <strokeText value="false"/>
  </renderer>

  <renderer mime="application/awt">
  </renderer>

  <renderer mime="image/png">
   <!--transparent-page-background>true</transparent-page-background-->
  </renderer>

  <renderer mime="image/tiff">
   <!--transparent-page-background>true</transparent-page-background-->
   <!--compression>CCITT T.6</compression-->
  </renderer>

  <renderer mime="text/xml">
  </renderer>

  <!-- RTF does not have a renderer
  <renderer mime="text/rtf">
  </renderer>
  -->

  <renderer mime="text/plain">
   <pageSize columns="80"/>
  </renderer>

</renderers>

</fop>

Attachment: fop-users_36147.eml (zipped)
Robert,

Your suggestions work perfectly for me, thank you.
Step 2:
Now I'm trying to call Java from Delphi using JNI.
With the classpath set as suggested - I had to include all the .jar files in the .bin directory separately, since bin/* didn't work - I construct the desired object (Delphi 7 code, I adapted URLGrabberMainForm.pas):


Var
Cls: JClass;
Mid: JMethodID;
ExampleFO2PDF: JObject;

//Construct ExampleFO2PDF object
ExampleFO2PDF := CreateJavaObject(FJNIEnv, 'embedding/ExampleFO2PDF', Cls);


This works; no error messages.
But then...


//Locate the 'convertFO2PDF' method
Mid := FJNIEnv.GetMethodID(Cls, 'convertFO2PDF', '(Ljava/lang/File;Ljava/lang/File;)V');

"A Java exception occurred
Java.lang.NoSuchMethodError
convertFO2PDF"

Source file ExampleFO2PDF.java contains

  public void convertFO2PDF(File fo, File pdf) throws IOException, FOPException

so I think I'm using GetMethodID correctly - evidently not, can someone tell me what I'm missing?





Regards,
Arjan Bokx

-------------------------------------------------------------------
Van: Robert Meyer [mailto:rmeyer@(protected)]
Verzonden: woensdag 2 januari 2013 10:21
Aan: fop-users@(protected)
Onderwerp: RE: FOP 1.1 embedded examples

Hi Arjan,

I did the following to get it working:

1) From the command line I went to the examples\embedding\ directory and ran ant to generate all the classes into a ./build/ directory.
2) I then ran the following from the same directory:

java -cp "build/classes:../../lib/*:../../build/fop.jar" embedding.ExampleFO2PDF

It will be slightly different for you though as I am on Linux. To get it running on Windows you will need to change the colons for semi-colons e.g.

java -cp "build/classes;../../lib/*;../../build/fop.jar" embedding.ExampleFO2PDF

That should then generate the output successfully into the ./out/ directory.

Let me know if you are still having problems

Regards,

Robert Meyer
> From: arjan.bokx@(protected)
> To: fop-users@(protected)
> Subject: FOP 1.1 embedded examples
> Date: Wed, 2 Jan 2013 07:29:14 +0000
>
> Hello everybody,
>
> I have a question about getting the "embedded" examples of FOP 1.1 to work.
> Is this the right place to ask?
> (If not, please redirect me and disregard the following)
>
> My OS is Windows XP.
> I've downloaded and installed the Java SDK 1.7.0_10
> I've downloaded and installed fop 1.1
> I've downloaded and installed Ant.
> With Ant, I compiled the "embedded" examples.
> "Ant example1" correctly runs ExampleFO2PDF.
> What should I do to call ExampleFO2PDF from Java? Actually I wish to call it from Delphi, using JNI, but first things first.
> "Java ExampleFO2PDF" from the command line gives:
> Exception in thread "main" java.lang.NoClassDefFoundError: ExampleFO2PDF (wrong name: embedding/ExampleFO2PDF)
>
> When I add just about every path to the classpath with the command line option -cp, I get:
> Error: Could not find or load main class ExampleFO2PDF.main
>
> Could you help me please.
>
>
> Regards,
> Arjan Bokx
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@(protected)
> For additional commands, e-mail: fop-users-help@(protected)
>



Attachment: fop-users_36148.eml (zipped)
I spoke too soon.
My code should have been

Mid := FJNIEnv.GetMethodID(Cls, 'convertFO2PDF', '(Ljava/io/File;Ljava/io/File;)V');

and not

Mid := FJNIEnv.GetMethodID(Cls, 'convertFO2PDF', '(Ljava/lang/File;Ljava/lang/File;)V');



Sorry for wasting time and bandwidth!


Regards,
Arjan Bokx




> -----Oorspronkelijk bericht-----
> Van: Arjan Bokx [mailto:arjan.bokx@(protected)]
> Verzonden: donderdag 3 januari 2013 8:37
> Aan: fop-users@(protected)
> Onderwerp: RE: FOP 1.1 embedded examples - SOLVED step 1
>
> Robert,
>
> Your suggestions work perfectly for me, thank you.
> Step 2:
> Now I'm trying to call Java from Delphi using JNI.
> With the classpath set as suggested - I had to include all the .jar files in the
> .bin directory separately, since bin/* didn't work - I construct the desired
> object (Delphi 7 code, I adapted URLGrabberMainForm.pas):
>
>
> Var
>  Cls: JClass;
>  Mid: JMethodID;
>  ExampleFO2PDF: JObject;
>
> //Construct ExampleFO2PDF object
> ExampleFO2PDF := CreateJavaObject(FJNIEnv,
> 'embedding/ExampleFO2PDF', Cls);
>
>
> This works; no error messages.
> But then...
>
>
> //Locate the 'convertFO2PDF' method
> Mid := FJNIEnv.GetMethodID(Cls, 'convertFO2PDF',
> '(Ljava/lang/File;Ljava/lang/File;)V');
>
> "A Java exception occurred
> Java.lang.NoSuchMethodError
> convertFO2PDF"
>
> Source file ExampleFO2PDF.java contains
>
>   public void convertFO2PDF(File fo, File pdf) throws IOException,
> FOPException
>
> so I think I'm using GetMethodID correctly - evidently not, can someone tell
> me what I'm missing?
>
>
>
>
>
> Regards,
> Arjan Bokx
>
> -------------------------------------------------------------------
> Van: Robert Meyer [mailto:rmeyer@(protected)]
> Verzonden: woensdag 2 januari 2013 10:21
> Aan: fop-users@(protected)
> Onderwerp: RE: FOP 1.1 embedded examples
>
> Hi Arjan,
>
> I did the following to get it working:
>
> 1) From the command line I went to the examples\embedding\ directory and
> ran ant to generate all the classes into a ./build/ directory.
> 2) I then ran the following from the same directory:
>
> java -cp "build/classes:../../lib/*:../../build/fop.jar"
> embedding.ExampleFO2PDF
>
> It will be slightly different for you though as I am on Linux. To get it running
> on Windows you will need to change the colons for semi-colons e.g.
>
> java -cp "build/classes;../../lib/*;../../build/fop.jar"
> embedding.ExampleFO2PDF
>
> That should then generate the output successfully into the ./out/ directory.
>
> Let me know if you are still having problems
>
> Regards,
>
> Robert Meyer
> > From: arjan.bokx@(protected)
> > To: fop-users@(protected)
> > Subject: FOP 1.1 embedded examples
> > Date: Wed, 2 Jan 2013 07:29:14 +0000
> >
> > Hello everybody,
> >
> > I have a question about getting the "embedded" examples of FOP 1.1 to
> work.
> > Is this the right place to ask?
> > (If not, please redirect me and disregard the following)
> >
> > My OS is Windows XP.
> > I've downloaded and installed the Java SDK 1.7.0_10
> > I've downloaded and installed fop 1.1
> > I've downloaded and installed Ant.
> > With Ant, I compiled the "embedded" examples.
> > "Ant example1" correctly runs ExampleFO2PDF.
> > What should I do to call ExampleFO2PDF from Java? Actually I wish to call it
> from Delphi, using JNI, but first things first.
> > "Java ExampleFO2PDF" from the command line gives:
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> ExampleFO2PDF (wrong name: embedding/ExampleFO2PDF)
> >
> > When I add just about every path to the classpath with the command line
> option -cp, I get:
> > Error: Could not find or load main class ExampleFO2PDF.main
> >
> > Could you help me please.
> >
> >
> > Regards,
> > Arjan Bokx
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-users-unsubscribe@(protected)
> > For additional commands, e-mail: fop-users-help@(protected)
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@(protected)
> For additional commands, e-mail: fop-users-help@(protected)
>




Attachment: fop-users_36149.eml (zipped)
Now for step 3 of my 'calling Java from Delphi' project...
So far, everything seems to work.

Var
Cls: JClass;
Mid: JMethodID;
ExampleFO2PDF: JObject;

//Construct ExampleFO2PDF object
ExampleFO2PDF := CreateJavaObject(FJNIEnv, 'embedding/ExampleFO2PDF', Cls);
//Locate the 'convertFO2PDF' method
Mid := FJNIEnv.GetMethodID(Cls, 'convertFO2PDF', '(Ljava/io/File;Ljava/io/File;)V');



After this, I wish to actually call the method from Delphi:
// Call the method
FJNIEnv.CallObjectMethod(...);


In ExampleFO2PDF.java, it says
public void convertFO2PDF(File fo, File pdf) throws IOException, FOPException {

What, now, is the type of the parameters that I should pass with FJNIEnv.CallObjectMethod()? I couldn't find any examples of this.
I tried some Delphi file types but they didn't work.



Regards,
Arjan Bokx



©2008 java2.5341.com - Jax Systems, LLC, U.S.A.