Re: Embedding Fonts for PDF/A

2016-01-07 Thread Tunahan Coban
Hi Pascal,

I sent the first part (because the file is 3000 lines long) from the *.xsl 
file, too.
Here again:


http://www.w3.org/1999/XSL/Transform; 
xmlns:fo="http://www.w3.org/1999/XSL/Format;>



  
  

  




























   .

...

I tested now the normal PDF converting and its still does work. Only the PDF/A 
doesn't work..
Maybe my java-code is wrong?

// TODO:Fonts configuration in work
   DefaultConfigurationBuilder cfgBuilder = new 
DefaultConfigurationBuilder();
   Configuration cfg = cfgBuilder.buildFromFile(new File("cfg.xml"));
   FopFactoryBuilder fopFactoryBuilder = new FopFactoryBuilder(new 
File(".").toURI()).setConfiguration(cfg);


final FopFactory fopFactory = FopFactory.newInstance(new 
File(".").toURI());


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


OutputStream pdfOut = new BufferedOutputStream(pdfOutputStream);

try {

 Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, 
pdfOut);

 TransformerFactory factory = TransformerFactory.newInstance();
 Transformer transformer = factory.newTransformer(styleSheet);
 transformer.setParameter("versionParam", "2.0");

 Result fopResult = new SAXResult(fop.getDefaultHandler());

 transformer.transform(xml, fopResult);


 } finally {
   pdfOut.close();
 }

 } catch (Exception e) {
e.printStackTrace(System.err);
 }
}


Thanks !

--


RE: Embedding Fonts for PDF/A

2016-01-06 Thread Simon Steiner
Hi,

 

Add font-family="DejaVuSans" to fo:root, maybe remove auto-detect from
conf.xml also.

 

Thanks

 

From: Tunahan Coban [mailto:tunahan.co...@coconet.de] 
Sent: 06 January 2016 10:11
To: fop-users@xmlgraphics.apache.org
Subject: Embedding Fonts for PDF/A

 

Hi,

 

this is my first question to the list and I don't know if this way the right
one. 

 

So I have a problem with the fonts to generate a PDF/A.

I have testing to embed the fonts Helvetica and DejaVuSans but anyone don't
work.

 

I used the following conf.xml with trying to embed DejaVuSans:

 



true



   

 
PDF/A-1a

   1.4

   

   

   

   

 


   

   





 

I have download the DejaVuSans.ttf from

http://dejavu-fonts.org/wiki/Main_Page.
 
Then I get this:
10:44:20,353 WARN  [org.apache.fop.apps.FOUserAgent] (http-/0.0.0.0:7080-4)
Font "Symbol,normal,700" not found. Substituting with "Symbol,normal,400".
10:44:20,353 WARN  [org.apache.fop.apps.FOUserAgent] (http-/0.0.0.0:7080-4)
Font "ZapfDingbats,normal,700" not found. Substituting with
"ZapfDingbats,normal,400".
10:44:20,353 WARN  [org.apache.fop.apps.FOUserAgent] (http-/0.0.0.0:7080-4)
Font "DejaVuSans,normal,400" not found. Substituting with "any,normal,400".
10:44:20,353 WARN  [org.apache.fop.apps.FOUserAgent] (http-/0.0.0.0:7080-4)
Font "DejaVuSans,normal,700" not found. Substituting with "any,normal,700".
 
10:44:20,602 ERROR [org.apache.fop.fo.FOTreeBuilder] (http-/0.0.0.0:7080-4)
org.apache.fop.pdf.PDFConformanceException: For PDF/A-1b, all fonts, even
the base 14 fonts, have to be embedded! Offending font: /Times-Roman
10:44:20,602 ERROR [stderr] (http-/0.0.0.0:7080-4) (Position des Fehlers
unbekannt)org.apache.fop.pdf.PDFConformanceException: For PDF/A-1b, all
fonts, even the base 14 fonts, have to be embedded! Offending font:
/Times-Roman
 

Is it the right way to embed any fonts?

 

It would be greate if you can show me an example with embedding DejaVuSans
or Helvetica..

 

Thank you so much!

 

--

 



RE: Embedding Fonts for PDF/A

2016-01-06 Thread Simon Steiner
Hi,

 

Show us the xslfo file.

 

Thanks

 

From: Tunahan Coban [mailto:tunahan.co...@coconet.de] 
Sent: 06 January 2016 11:42
To: simonsteiner1...@gmail.com; fop-users@xmlgraphics.apache.org
Subject: RE: Embedding Fonts for PDF/A

 

Hi Simon,

 

Thanks for your answer. But it doesn't work when I add
font-family="DejaVuSans" to fot:root. I deleted the  too.

 

Maybe my java-code has a problem?

 

// TODO:Fonts configuration in work

 DefaultConfigurationBuilder cfgBuilder = new
DefaultConfigurationBuilder();

 Configuration cfg = cfgBuilder.buildFromFile(new
File("cfg.xml"));

 FopFactoryBuilder fopFactoryBuilder = new FopFactoryBuilder(new
File(".").toURI()).setConfiguration(cfg);

 

 

final FopFactory fopFactory = FopFactory.newInstance(new
File(".").toURI());

 

   

FOUserAgent foUserAgent = fopFactory.newFOUserAgent();

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

   // fopFactoryBuilder.setConfiguration(this.getClass().getResource(c))





OutputStream pdfOut = new BufferedOutputStream(pdfOutputStream);



try {



 Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,
foUserAgent, pdfOut);

 

 TransformerFactory factory = TransformerFactory.newInstance();

 Transformer transformer = factory.newTransformer(styleSheet);

 transformer.setParameter("versionParam", "2.0");

   

 Result fopResult = new SAXResult(fop.getDefaultHandler());

 

 transformer.transform(xml, fopResult);





 } finally {

   pdfOut.close();

 }



 } catch (Exception e) {

e.printStackTrace(System.err);

 }

}

 

Thanks



Re: Embedding Fonts for PDF/A

2016-01-06 Thread Pascal Sancho
Hi,
Simon asked for XSL-FO file (what feeds FOP), not fop.xconf

2016-01-06 13:18 GMT+01:00 Tunahan Coban :
> Edit:
>
>
>
> I change the font to Arial. But it still doesn’t work.
>
>
>
> 
>
>true
>
>
>
>  
>
> PDF/A-1a
>
> 1.4
>
> 
>
> embed-url="file:///C:/Utilities/arial.ttf">
>
> weight="normal"/>
>
>
>
> 
>
>  
>
>
>
> 
>
>
>
>
>
> Thanks.
>
>
>
> --



-- 
pascal

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



Re: Embedding Fonts for PDF/A

2016-01-06 Thread Clay Leeds
That should be fo:root not fot:root

Sent from my iPhone 6s

> On Jan 6, 2016, at 3:41 AM, Tunahan Coban  wrote:
> 
> Hi Simon,
>  
> Thanks for your answer. But it doesn’t work when I add 
> font-family=”DejaVuSans” to fot:root. I deleted the  too.
>  
> Maybe my java-code has a problem?
>  
> // TODO:Fonts configuration in work
>  DefaultConfigurationBuilder cfgBuilder = new 
> DefaultConfigurationBuilder();
>  Configuration cfg = cfgBuilder.buildFromFile(new 
> File("cfg.xml"));
>  FopFactoryBuilder fopFactoryBuilder = new FopFactoryBuilder(new 
> File(".").toURI()).setConfiguration(cfg);
> 
> 
> final FopFactory fopFactory = FopFactory.newInstance(new 
> File(".").toURI());
> 
>
> FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
> foUserAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-1b");
>// fopFactoryBuilder.setConfiguration(this.getClass().getResource(c))
>
> 
> OutputStream pdfOut = new BufferedOutputStream(pdfOutputStream);
>
> try {
>
>  Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, 
> pdfOut);
> 
>  TransformerFactory factory = TransformerFactory.newInstance();
>  Transformer transformer = factory.newTransformer(styleSheet);
>  transformer.setParameter("versionParam", "2.0");
>   
>  Result fopResult = new SAXResult(fop.getDefaultHandler());
>  
>  transformer.transform(xml, fopResult);
>
> 
>  } finally {
>pdfOut.close();
>  }
>
>  } catch (Exception e) {
> e.printStackTrace(System.err);
>  }
> }
>  
> Thanks


RE: Embedding Fonts for PDF/A

2016-01-06 Thread Tunahan Coban
Hi Simon,

Thanks for your answer. But it doesn't work when I add font-family="DejaVuSans" 
to fot:root. I deleted the  too.

Maybe my java-code has a problem?

// TODO:Fonts configuration in work
 DefaultConfigurationBuilder cfgBuilder = new 
DefaultConfigurationBuilder();
 Configuration cfg = cfgBuilder.buildFromFile(new File("cfg.xml"));
 FopFactoryBuilder fopFactoryBuilder = new FopFactoryBuilder(new 
File(".").toURI()).setConfiguration(cfg);


final FopFactory fopFactory = FopFactory.newInstance(new 
File(".").toURI());


FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
foUserAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-1b");
   // fopFactoryBuilder.setConfiguration(this.getClass().getResource(c))


OutputStream pdfOut = new BufferedOutputStream(pdfOutputStream);

try {

 Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, 
pdfOut);

 TransformerFactory factory = TransformerFactory.newInstance();
 Transformer transformer = factory.newTransformer(styleSheet);
 transformer.setParameter("versionParam", "2.0");

 Result fopResult = new SAXResult(fop.getDefaultHandler());

 transformer.transform(xml, fopResult);


 } finally {
   pdfOut.close();
 }

 } catch (Exception e) {
e.printStackTrace(System.err);
 }
}

Thanks


RE: Embedding Fonts for PDF/A

2016-01-06 Thread Tunahan Coban
Edit:

I change the font to Arial. But it still doesn't work.


   true
   
 
PDF/A-1a
1.4

   
   
   

 
   



Thanks.

--


Re: Embedding Fonts for PDF/A

2016-01-06 Thread Pascal Sancho
(Tunahan sent me the FO file off-list, due to confidential things)

Tunahan,
I can reproduce DejaVu substitution:
Your config lacks font descriptions for variations:


  


  


  



2016-01-06 15:26 GMT+01:00 Tunahan Coban <tunahan.co...@coconet.de>:
> Hi Pascal,
>
> Thank you to invest your time for me. It is better for me that our 
> conversation don't been uploaded to the mail list site. Because of the 
> internal informations. I hope I understand you correctly with the xsl-fo file.
> Now I have converted my XML file with the stylesheet to FO.
> I will send you this as a mail-attachment.
>
> When you could say me what kind of mistakes you search, so can I help you.. 
> Because the file is too long, you will see.. :/
>
> Thanks so much !
>
> --
>
>
> -Ursprüngliche Nachricht-
> Von: Pascal Sancho [mailto:psancho@gmail.com]
> Gesendet: Mittwoch, 6. Januar 2016 14:43
> An: Tunahan Coban
> Betreff: Re: Embedding Fonts for PDF/A
>
> Hi,
>
> Please, rather than XSL stylsheet, it's easier for us to play with resulting 
> XSL-FO, witch can be achieved without FOP, using XALAN, for example.
> And it is better to attach such file rather than copy/paste in mail
> body: all blank spaces and lines are preserved,  with actual used encoding.
>
> 2016-01-06 14:06 GMT+01:00 Tunahan Coban <tunahan.co...@coconet.de>:
>> Hi Pascal,
>>
>>
>>
>> I sent the first part (because the file is 3000 lines long) from the
>> *.xsl file, too.
>>
>> Here again:
>>
>>
>>
>> 
>>
>> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform;
>> xmlns:fo="http://www.w3.org/1999/XSL/Format;>
>>
>> 
>>
>> 
>>
>> > page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="2cm"
>> margin-right="2cm">
>>
>>   
>>
>>   
>>
>> 
>>
>>   
>>
>> 
>>
>> 
>>
>> 
>>
>> 
>>
>> > initial-page-number="1" format="1">
>>
>> 
>>
>> 
>>
>> 
>>
>> 
>>
>> 
>>
>> > space-before.optimum="1pt" space-after.optimum="2pt">
>>
>> 
>>
>> 
>>
>> 
>>
>> 
>>
>> 
>>
>> > text-align="center" padding-start="3pt" padding-end="3pt"
>> padding-before="3pt" padding-after="3pt" display-align="center"
>> border-style="solid" border-width="1pt" border-color="white">
>>
>> 
>>
>> > select="data">
>>
>> > select="texts">
>>
>> > select="DateText">
>>
>> > font-size="7pt">
>>
>>
>> 
>>
>> 
>>
>> 
>>
>> 
>>
>> 
>>
>>…..
>>
>>
>>
>> …
>>
>>
>>
>> I tested now the normal PDF converting and its still does work. Only
>> the PDF/A doesn’t work..
>>
>> Maybe my java-code is wrong?
>>
>>
>>
>> // TODO:Fonts configuration in work
>>
>>DefaultConfigurationBuilder cfgBuilder = new
>> DefaultConfigurationBuilder();
>>
>>Configuration cfg = cfgBuilder.buildFromFile(new
>> File("cfg.xml"));
>>
>>FopFactoryBuilder fopFactoryBuilder = new FopFactoryBuilder(new
>> File(".").toURI()).setConfiguration(cfg);
>>
>>
>>
>>
>>
>> final FopFactory fopFactory = FopFactory.newInstance(new
>> File(".").toURI());
>>
>>
>>
>>
>>
>> F