Images in APT

2008-12-11 Thread Leo van den Berg
The subject is over a year old, but as far as I know there is still no
release available with a solution for the Image inclusión in the automatic
PDF-document generation. 

Because I really needed a solution for this problem I created a
quick-and-dirty solution for the short term. The problem with reading images
from the site/resources/images directory is that iText  isn’t using the
relative paths correctly (classpath problem), you can solve this by adding
the path manually to Maven startup classpath  (I said it was quick and
dirty…)

 

Look up the following lines in MVN.bat and add the directories manually to
the classpath..

 

@REM Start MAVEN2

:runm2

%MAVEN_JAVA_EXE% %MAVEN_OPTS% -classpath
./src/site/resources;%CLASSWORLDS_JAR%
-Dclassworlds.conf=%M2_HOME%\bin\m2.conf -Dmaven.home=%M2_HOME%
org.codehaus.classworlds.Launcher %MAVEN_CMD_LINE_ARGS%

if ERRORLEVEL 1 goto error

goto end

 

All images will be added without a problem and site/book generation works as
intended.

 

 

 

 

 



Re: Insert images in APT

2007-12-06 Thread Lukas Theussl


You have to include the figure extension in the link. This is a current 
bug that will be fixed soon: http://jira.codehaus.org/browse/DOXIA-99


HTH,
-Lukas


Gervais, Christophe wrote:

Hello,

I cannot insert picture in APT files. I've got the following exception 
generating my doc:
MalformedURLException: The URL of the image is missing.


My project structure is the following:

project
| src
 | site
   |-- apt
   ||--- apt file
   |---resources
| images
   |- image files

The picture is referenced using the following syntax in the APT file:

[../resources/images/OpenMediation_Architecture] Architecture Overview

Could you help?
Thank
Christophe

Full error stack is:

The image ../resources/images/OpenMediation_Architecture not found in the class 
loader. Try to call setClassLoader(ClassLoader) before.
[INFO] 
[ERROR] FATAL ERROR
[INFO] 
[INFO] The URL of the image is missing.
[INFO] 
[INFO] Trace
ExceptionConverter: java.net.MalformedURLException: The URL of the image is 
missing.
at com.lowagie.text.Image.getInstance(Unknown Source)
at com.lowagie.text.xml.SAXiTextHandler.handleStartingTags(Unknown 
Source)
at com.lowagie.text.xml.SAXiTextHandler.startElement(Unknown Source)
at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
at 
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:220)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:872)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScan
nerImpl.java:1693)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at 
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
at com.lowagie.text.xml.XmlParser.go(Unknown Source)
at com.lowagie.text.xml.XmlParser.parse(Unknown Source)
at com.lowagie.text.xml.XmlToXXX.parse(Unknown Source)
at 
org.apache.maven.doxia.module.itext.ITextUtil.writePdf(ITextUtil.java:118)
at 
org.apache.maven.doxia.book.services.renderer.PdfBookRenderer.renderXML(PdfBookRenderer.java:50)
at 
org.apache.maven.doxia.book.services.renderer.AbstractITextBookRenderer.renderBook(AbstractITextBookRenderer.java:162)
at 
org.apache.maven.doxia.book.DefaultBookDoxia.renderBook(DefaultBookDoxia.java:126)
at 
org.apache.maven.doxia.plugin.DoxiaRenderBooksMojo.execute(DoxiaRenderBooksMojo.java:214)
at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:447)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315

Re: Insert images in APT

2007-12-06 Thread Lukas Theussl

Ok, I have another explanation :)

http://jira.codehaus.org/browse/DOXIA-118

Can you confirm that it's only the pdf generation via itext that doesn't 
work?


-Lukas


Gervais, Christophe wrote:

Thank for your help Lukas,

Unfortunatly it does not solve the issue.

Christophe
-Original Message-
From: Lukas Theussl [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 06, 2007 11:11 AM
To: [EMAIL PROTECTED]
Subject: Re: Insert images in APT

Oh, the resources are copied directly into the main directory of the site, see 
http://maven.apache.org/guides/mini/guide-site.html

So it should work with

[images/OpenMediation_Architecture.png] Architecture Overview

HTH,
-Lukas


Gervais, Christophe wrote:


Hi,

I've also tried but I've got the same error.

APT file contains:

[../resources/images/OpenMediation_Architecture.png] Architecture

I've also tried to specify the resources in the pom file, but it does not help:

Thank
Christophe

build

   resources
   resource
   directorysrc/site/resources/directory
   includes
   includeimages/**/include
   /includes
   /resource
   /resources
   plugin
   groupIdorg.apache.maven.doxia/groupId
   artifactIddoxia-maven-plugin/artifactId
   version1.0-alpha-10/version
   executions
   execution
   phasecompile/phase
   goals
   goalrender-books/goal
   /goals
   /execution
   /executions
   configuration
   books
   book
   
directorysrc/site/apt/directory
   
descriptorsrc/site/book.xml/descriptor
   formats
   format
   
idpdf/id
   /format
   format
   
idxdoc/id
   /format
   /formats
   /book
   /books
   /configuration
   /plugin

-Original Message-
From: Lukas Theussl [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 06, 2007 10:44 AM
To: [EMAIL PROTECTED]
Subject: Re: Insert images in APT


You have to include the figure extension in the link. This is a
current bug that will be fixed soon:
http://jira.codehaus.org/browse/DOXIA-99

HTH,
-Lukas


Gervais, Christophe wrote:



Hello,

I cannot insert picture in APT files. I've got the following exception 
generating my doc:
  MalformedURLException: The URL of the image is missing.


My project structure is the following:

project
  | src
   | site
 |-- apt
 ||--- apt file
 |---resources
  | images
 |- image
files

The picture is referenced using the following syntax in the APT file:

  [../resources/images/OpenMediation_Architecture] Architecture
Overview

Could you help?
Thank
Christophe

Full error stack is:

The image ../resources/images/OpenMediation_Architecture not found in the class 
loader. Try to call setClassLoader(ClassLoader) before.
[INFO]
--
--
[ERROR] FATAL ERROR
[INFO]
--
-- [INFO] The URL of the image is missing.
[INFO]
--
--
[INFO] Trace
ExceptionConverter: java.net.MalformedURLException: The URL of the image is 
missing.
  at com.lowagie.text.Image.getInstance(Unknown Source)
  at com.lowagie.text.xml.SAXiTextHandler.handleStartingTags(Unknown Source)
  at com.lowagie.text.xml.SAXiTextHandler.startElement(Unknown Source)
  at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533

cannot find images in APT files

2007-01-09 Thread Martin Goldhahn
Hi!
I want to render an APT file that I use in my site as a PDF file.
Maven's site plugin finds the image because it is located in
src/site/resources. It seams that this path is not added to doxia's
classpath. Thus it cannot find the image.

How do I tell the doxia-maven-plugin that it should search the resources
folder as well?

Martin


Re: cannot find images in APT files

2007-01-09 Thread Vincent Siveton

Hi Martin,

2007/1/9, Martin Goldhahn [EMAIL PROTECTED]:

Hi!
I want to render an APT file that I use in my site as a PDF file.
Maven's site plugin finds the image because it is located in
src/site/resources. It seams that this path is not added to doxia's
classpath. Thus it cannot find the image.

How do I tell the doxia-maven-plugin that it should search the resources
folder as well?


It seems to be a limitation. Please open an issue.

Cheers,

Vincent



Martin