You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Virginijus Kandrotas <vk...@yahoo.com> on 2007/02/14 14:33:15 UTC

Need working example or help how to use PDF/A-1b with FOP 0.93

I am looking for help how to use PDF/A-1b. Does anybody have working example
? I need example  input XML fo file and FOP configuration / font embedding. 

Best regards,

Virginijus Kandrotas
-- 
View this message in context: http://www.nabble.com/Need-working-example-or-help-how-to-use-PDF-A-1b-with-FOP-0.93-tf3227266.html#a8964915
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: [SPAM] Need working example or help how to use PDF/A-1b with FOP 0.93

Posted by Virginijus Kandrotas <vk...@yahoo.com>.

I have already solved my problem. You right – the instantiation of  the 
PDFRenderer was the reason why my custom configuration  was not read and
used in the renderer. I have used this method because of following error:
“Don't know how to handle "application/pdf" as an output format. Neither an
FOEventHandler nor a Renderer could be found for this output format”. I have
found in the FOP mailing list that I can solve this error using
“setRendererOverride” method. But actually this was not a right solution.
The real problem was missing text files under the META-INF/Services
directory. I have forgotten to copy the in my environment. I found this
notice in your post by 
http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-users/200605.mbox/%3C20060510102135.BB9A.DEV@jeremias-maerki.ch%3E
apache mailing archive .

Thank you for your help

Virginijus Kandrotas
-- 
View this message in context: http://www.nabble.com/Need-working-example-or-help-how-to-use-PDF-A-1b-with-FOP-0.93-tf3227266.html#a9003689
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Need working example or help how to use PDF/A-1b with FOP 0.93

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
I should have looked more closely at your code. You instantiate the
PDFRenderer yourself, probably for the same reason that you set the
ElementMappings yourself. I'd really like to know the reason why you
think you need to do that. Why did Service discovery not work for you?

Anyway, the problem is as follows: After instantiating the renderer
yourself, you don't configure it (calling its configure(Configuration)
method). That's why it doesn't have any font configuration. If you use
setRendererOverride, you have to do everything (!) yourself.

I'd suggest you figure out how you can use the normal Service discovery
and switch back to the normal usage patterns as explained on the FOP
website.

On 15.02.2007 12:23:03 Virginijus Kandrotas wrote:
> 
> 
>  yes exactly I can not run your example using my embedded code as I already
> posted.  It seems that in embedded code configuration file is not read or
> not set to fo userAgent. I'm getting in log this warning “WARN  [FontInfo]
> Font 'Arial,normal,400' not found. Substituting with 'any,normal,400'.”. 
> 
>  On command line it works without problem.
> 
>  regards,
> 
>  Virginijus Kandrotas
> 
> 
> 
> Jeremias Maerki-2 wrote:
> > 
> > Does that mean you can't run my example? You get an error about
> > "Times-Roman" with pdfa-example.fo? If yes, that's really weird.
> > 
> > I simply did this on the command-line:
> > fop -c fop.xconf -fo pdfa-example.fo -pdfa1b pdfa-example.pdf
> > 
> > Have you tried it from the command-line?
> > 
> > On 14.02.2007 16:59:53 Virginijus Kandrotas wrote:
> >> 
> >> 
> >> 
> >> I just try to run your example (pdfa-example.fo), have no extra
> >> references
> >> to the fonts defined.
> >> 
> >> regards,
> >> 
> >> Virginijus Kandrotas


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Need working example or help how to use PDF/A-1b with FOP 0.93

Posted by Virginijus Kandrotas <vk...@yahoo.com>.

 yes exactly I can not run your example using my embedded code as I already
posted.  It seems that in embedded code configuration file is not read or
not set to fo userAgent. I'm getting in log this warning “WARN  [FontInfo]
Font 'Arial,normal,400' not found. Substituting with 'any,normal,400'.”. 

 On command line it works without problem.

 regards,

 Virginijus Kandrotas



Jeremias Maerki-2 wrote:
> 
> Does that mean you can't run my example? You get an error about
> "Times-Roman" with pdfa-example.fo? If yes, that's really weird.
> 
> I simply did this on the command-line:
> fop -c fop.xconf -fo pdfa-example.fo -pdfa1b pdfa-example.pdf
> 
> Have you tried it from the command-line?
> 
> On 14.02.2007 16:59:53 Virginijus Kandrotas wrote:
>> 
>> 
>> 
>> I just try to run your example (pdfa-example.fo), have no extra
>> references
>> to the fonts defined.
>> 
>> regards,
>> 
>> Virginijus Kandrotas
> 
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Need-working-example-or-help-how-to-use-PDF-A-1b-with-FOP-0.93-tf3227266.html#a8983656
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Need working example or help how to use PDF/A-1b with FOP 0.93

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Does that mean you can't run my example? You get an error about
"Times-Roman" with pdfa-example.fo? If yes, that's really weird.

I simply did this on the command-line:
fop -c fop.xconf -fo pdfa-example.fo -pdfa1b pdfa-example.pdf

Have you tried it from the command-line?

On 14.02.2007 16:59:53 Virginijus Kandrotas wrote:
> 
> 
> 
> I just try to run your example (pdfa-example.fo), have no extra references
> to the fonts defined.
> 
> regards,
> 
> Virginijus Kandrotas



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Need working example or help how to use PDF/A-1b with FOP 0.93

Posted by Virginijus Kandrotas <vk...@yahoo.com>.


I just try to run your example (pdfa-example.fo), have no extra references
to the fonts defined.

regards,

Virginijus Kandrotas

-- 
View this message in context: http://www.nabble.com/Need-working-example-or-help-how-to-use-PDF-A-1b-with-FOP-0.93-tf3227266.html#a8967758
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Need working example or help how to use PDF/A-1b with FOP 0.93

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
This means you are still somehow referencing one of the base 14 fonts.
Even if you use Times-Roman, you have to explicitely define this font in
the configuration for PDF/A (as if it were a custom font) even though
it's normally available for use for non-PDF/A documents. The
specification requires that ALL fonts are embedded. And that's not the
case with the normal base 14 fonts.

It's a good idea to set "font-family" to your main font you're using in
your documents and to set this property top-level directly on fo:root.
This is what I've done in the example. That way no default value for
font-family can creep in anywhere. Of course, you also have to make sure
that you can an entry in the FOP configuration for every font that you
use in your documents.

Your Java code looks good, but see my question below (not related to the
problem here).

On 14.02.2007 16:10:07 Virginijus Kandrotas wrote:
> 
> Hello Jeremias,
> 
>  Thank you for your help and the example you have attached, but it still not
> working for me. I think there is some problems with the FOP configuration. I
> getting this error:
> 
> org.apache.fop.pdf.PDFConformanceException: For PDF/A-1b, all fonts, even
> the base 14 fonts, have to be embedded! Offending font: Times-Roman
> 	at org.apache.fop.pdf.PDFFont.validate(PDFFont.java:199)
<snip/>
> 
> Can you please look at my code maybe you can see what is wrong ?
> 
>                   FopFactory fopFactory = FopFactory.newInstance();
> 
>                   File configFile = new
> File("/home/vk/a-tests/fop/exampl/fop.xconf");
>                   fopFactory.setUserConfig(configFile);
> 
>                   FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
>                   foUserAgent.getRendererOptions().put("pdf-a-mode",
> "PDF/A-1b");
> 
>                   PDFRenderer pdfrenderer = new PDFRenderer();
>                   pdfrenderer.setUserAgent(foUserAgent);
> 
>                   foUserAgent.setRendererOverride(pdfrenderer);
> 
> 
>                   // Construct fop with desired output format
>                   Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,
> foUserAgent, outputMessages[0]);
> 
>                   fopFactory.addElementMapping(new FOElementMapping());
>                   fopFactory.addElementMapping(new SVGElementMapping());
>                   fopFactory.addElementMapping(new
> BatikExtensionElementMapping());
>                   fopFactory.addElementMapping(new
> ExtensionElementMapping());
>                   fopFactory.addElementMapping(new XMPElementMapping());
>                   fopFactory.addElementMapping(new RDFElementMapping());
>                   fopFactory.addElementMapping(new
> PSExtensionElementMapping());

Why are you doing this? Didn't it work otherwise? Strange environment 
(application server)???


> 
>                   // Setup JAXP using identity transformer
>                   TransformerFactory factory =
> TransformerFactory.newInstance();
>                   Transformer transformer = factory.newTransformer(); //
> identity transformer
> 
>                   // Setup input stream
>                   Source src = new StreamSource(inputMessages[0]);
> 
>                   // Resulting SAX events (the generated FO) must be piped
> through to FOP
>                   Result res = new SAXResult(fop.getDefaultHandler());
> 
>                   // Start XSLT transformation and FOP processing
>                   transformer.transform(src, res);
> 
>   
>   Thank you in advance,
> 
>   Virginijus Kandrotas
> -- 
> View this message in context: http://www.nabble.com/Need-working-example-or-help-how-to-use-PDF-A-1b-with-FOP-0.93-tf3227266.html#a8966701
> Sent from the FOP - Users mailing list archive at Nabble.com.



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Need working example or help how to use PDF/A-1b with FOP 0.93

Posted by Virginijus Kandrotas <vk...@yahoo.com>.
Hello Jeremias,

 Thank you for your help and the example you have attached, but it still not
working for me. I think there is some problems with the FOP configuration. I
getting this error:

org.apache.fop.pdf.PDFConformanceException: For PDF/A-1b, all fonts, even
the base 14 fonts, have to be embedded! Offending font: Times-Roman
	at org.apache.fop.pdf.PDFFont.validate(PDFFont.java:199)
	at org.apache.fop.pdf.PDFFont.toPDFString(PDFFont.java:210)
	at org.apache.fop.pdf.PDFObject.toPDF(PDFObject.java:164)
	at org.apache.fop.pdf.PDFObject.output(PDFObject.java:153)
	at org.apache.fop.pdf.PDFDocument.output(PDFDocument.java:831)
	at org.apache.fop.pdf.PDFDocument.outputTrailer(PDFDocument.java:896)
	at org.apache.fop.render.pdf.PDFRenderer.stopRenderer(PDFRenderer.java:483)
	at
org.apache.fop.area.RenderPagesModel.endDocument(RenderPagesModel.java:241)
	at
org.apache.fop.area.AreaTreeHandler.endDocument(AreaTreeHandler.java:426)
	at org.apache.fop.fo.FOTreeBuilder.endDocument(FOTreeBuilder.java:171)
	at
org.apache.xalan.transformer.TransformerIdentityImpl.endDocument(TransformerIdentityImpl.java:962)
	at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
	at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
	at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
	at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
	at
org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown
Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

Can you please look at my code maybe you can see what is wrong ?

                  FopFactory fopFactory = FopFactory.newInstance();

                  File configFile = new
File("/home/vk/a-tests/fop/exampl/fop.xconf");
                  fopFactory.setUserConfig(configFile);

                  FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
                  foUserAgent.getRendererOptions().put("pdf-a-mode",
"PDF/A-1b");

                  PDFRenderer pdfrenderer = new PDFRenderer();
                  pdfrenderer.setUserAgent(foUserAgent);

                  foUserAgent.setRendererOverride(pdfrenderer);


                  // Construct fop with desired output format
                  Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,
foUserAgent, outputMessages[0]);

                  fopFactory.addElementMapping(new FOElementMapping());
                  fopFactory.addElementMapping(new SVGElementMapping());
                  fopFactory.addElementMapping(new
BatikExtensionElementMapping());
                  fopFactory.addElementMapping(new
ExtensionElementMapping());
                  fopFactory.addElementMapping(new XMPElementMapping());
                  fopFactory.addElementMapping(new RDFElementMapping());
                  fopFactory.addElementMapping(new
PSExtensionElementMapping());

                  // Setup JAXP using identity transformer
                  TransformerFactory factory =
TransformerFactory.newInstance();
                  Transformer transformer = factory.newTransformer(); //
identity transformer

                  // Setup input stream
                  Source src = new StreamSource(inputMessages[0]);

                  // Resulting SAX events (the generated FO) must be piped
through to FOP
                  Result res = new SAXResult(fop.getDefaultHandler());

                  // Start XSLT transformation and FOP processing
                  transformer.transform(src, res);

  
  Thank you in advance,

  Virginijus Kandrotas
-- 
View this message in context: http://www.nabble.com/Need-working-example-or-help-how-to-use-PDF-A-1b-with-FOP-0.93-tf3227266.html#a8966701
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Need working example or help how to use PDF/A-1b with FOP 0.93

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Make sure you follow the instructions here:
http://xmlgraphics.apache.org/fop/0.93/pdfa.html

I've uploaded an example for you:
http://people.apache.org/~jeremias/pdfa-example.zip

(you just have to copy arial.ttf in the same directory. Omitted in the
ZIP for legal reasons.)

HTH

On 14.02.2007 14:33:15 Virginijus Kandrotas wrote:
> 
> I am looking for help how to use PDF/A-1b. Does anybody have working example
> ? I need example  input XML fo file and FOP configuration / font embedding. 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org