Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-2838

PDF/A-1b fails

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: fo/block, font/unqualified
    • Labels:
      None
    • Environment:
      Ubuntu18.04, Java 8, Tomcat 9

      fopconf.xml and dejavu-sans-fontfacekit are in the tomcat classes folder.

      Description

      • FOP and CONF files are attached.

      Part of the Java Code:

      public FileHandle convert() throws Exception {
              try {
                  // Here need to do the conversion
                  log("Creating temporary file into " + tempPath);
                  File xml=File.createTempFile("FopDriver_",".xml",new File(tempPath));
                  xml.deleteOnExit();
                  File target=new File(this.outputPath);
                  log("Going into action with: ");
                  log("XML: " + xml + " of length: " + xml.length());
                  
                  if(target.canWrite()){                
                      OutputStream out = new BufferedOutputStream(new FileOutputStream(target));
                      try {
                          //Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);
                          
                          ClassLoader loader = getClass().getClassLoader();
                          URL url = loader.getResource("fopconf.xml");
                          System.out.println("********* url: "+url);
                          String filePath = url.getFile();
                          System.out.println("********* filepath: "+filePath);
                          FopFactory fopFactory = FopFactory.newInstance(new File(filePath));
                          // a user agent is needed for transformation
                          FOUserAgent userAgent = fopFactory.newFOUserAgent();
                          userAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-1b");
                          
                          Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
                            
                          Transformer transformer = getTransformer();
                          Source src = new StreamSource(xml);
                          Result res = new SAXResult(fop.getDefaultHandler());
                          transformer.transform(src, res);
                      } 
                      finally {
                          out.close();
                      }
                  }
                  else
                      log("Cannot either write to " + target.getAbsolutePath());
                      // Return FileHandle to target file
                      FileHandle ret=new FileHandle(target.getAbsolutePath(),0);
                      ret.getFile();
                      return ret;
              }        
              catch (Exception e){
                  e.printStackTrace();
                  throw e;
              }
          }
      

      Error in Tomcat server log:

      21-Jan-2019 12:11:25.451 SEVERE [SoveliaThread - Structure agent] org.apache.fop.apps.FOUserAgent.processEvent Invalid property value encountered in text-align="": org.apache.fop.fo.expr.PropertyException: file:/soveliaT/kalaza/temp_directories/converter_temp/FopDriver_633972825523617220.xml:1:15492: No conversion defined ; property:'text-align' (See position 1:15546)
       org.apache.fop.fo.expr.PropertyException: file:/soveliaT/kalaza/temp_directories/converter_temp/FopDriver_633972825523617220.xml:1:15492: No conversion defined ; property:'text-align'
      	at org.apache.fop.fo.properties.PropertyMaker.make(PropertyMaker.java:446)
      	at org.apache.fop.fo.PropertyList.convertAttributeToProperty(PropertyList.java:499)
      	at org.apache.fop.fo.PropertyList.addAttributesToList(PropertyList.java:386)
      	at org.apache.fop.fo.FObj.processNode(FObj.java:124)
      	at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:291)
      	at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:179)
      	at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:388)
      	at net.sf.saxon.event.NamespaceReducer.startContent(NamespaceReducer.java:213)
      	at net.sf.saxon.event.ComplexContentOutputter.startContent(ComplexContentOutputter.java:721)
      	at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:375)
      	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
      	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
      	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.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)
      	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      	at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:427)
      	at net.sf.saxon.event.Sender.send(Sender.java:164)
      	at net.sf.saxon.jaxp.IdentityTransformer.transform(IdentityTransformer.java:383)
      	at com.ravalik.external.converters.fop2pdf.FopDriver.convert(FopDriver.java:115)
      	at com.ravalik.app.converters.ConverterTool.doConversion(ConverterTool.java:141)
      	at com.ravalik.app.dms.layers.modules.document.ServerConverter.convertStrtoFG(ServerConverter.java:76)
      	at com.ravalik.app.dms.layers.modules.document.ServerConverter.convert(ServerConverter.java:40)
      	at com.ravalik.app.auric.structure_agent.ConverterAgent.getConvertedFile(ConverterAgent.java:114)
      	at com.ravalik.app.auric.structure_agent.ConverterAgent.beginJob2(ConverterAgent.java:80)
      	at com.ravalik.app.auric.structure_agent.StructureAgent.beginJob2(StructureAgent.java:202)
      	at sovelia.util.agency.Agent.beginJob(Agent.java:27)
      	at sovelia.util.agency.Agency$1.run(Agency.java:15)
      
      21-Jan-2019 12:11:25.495 WARNING [SoveliaThread - Structure agent] org.apache.fop.apps.FOUserAgent.processEvent Font "DejaVuSans,normal,400" not found. Substituting with "any,normal,400".
      21-Jan-2019 12:11:25.498 WARNING [SoveliaThread - Structure agent] org.apache.fop.apps.FOUserAgent.processEvent Font "DejaVuSans,normal,700" not found. Substituting with "any,normal,700".
      21-Jan-2019 12:11:25.529 WARNING [SoveliaThread - Structure agent] org.apache.fop.apps.FOUserAgent.processEvent The contents of fo:external-graphic line 1 exceed the available area in the inline-progression direction by 500 millipoints. (See position 1:7181)
      21-Jan-2019 12:11:25.532 WARNING [SoveliaThread - Structure agent] org.apache.fop.apps.FOUserAgent.processEvent The contents of fo:external-graphic line 1 exceed the available area in the inline-progression direction by 500 millipoints. (See position 1:11264)
      21-Jan-2019 12:11:25.535 WARNING [SoveliaThread - Structure agent] org.apache.fop.apps.FOUserAgent.processEvent The contents of fo:external-graphic line 1 exceed the available area in the inline-progression direction by 500 millipoints. (See position 1:15364)
      21-Jan-2019 12:11:25.622 INFO [SoveliaThread - Structure agent] org.apache.fop.apps.FOUserAgent.processEvent Rendered page #1.
      org.apache.fop.pdf.PDFConformanceException: For PDF/A-1b, all fonts, even the base 14 fonts, have to be embedded! Offending font: /Times-Bold
      	at org.apache.fop.pdf.PDFFont.validate(PDFFont.java:170)
      	at org.apache.fop.pdf.PDFFont.output(PDFFont.java:179)
      	at org.apache.fop.pdf.PDFDocument.outputIndirectObject(PDFDocument.java:1053)
      	at org.apache.fop.pdf.PDFDocument.streamIndirectObject(PDFDocument.java:1018)
      	at org.apache.fop.pdf.PDFDocument.output(PDFDocument.java:994)
      	at org.apache.fop.pdf.PDFDocument.outputTrailer(PDFDocument.java:1097)
      	at org.apache.fop.render.pdf.PDFDocumentHandler.endDocument(PDFDocumentHandler.java:191)
      	at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.endDocument(IFDocumentHandlerProxy.java:187)
      	at org.apache.fop.render.intermediate.IFRenderer.stopRenderer(IFRenderer.java:295)
      	at org.apache.fop.area.RenderPagesModel.endDocument(RenderPagesModel.java:265)
      	at org.apache.fop.area.AreaTreeHandler.endDocument(AreaTreeHandler.java:342)
      	at org.apache.fop.fo.FOTreeBuilder.endDocument(FOTreeBuilder.java:170)
      	at net.sf.saxon.event.ContentHandlerProxy.close(ContentHandlerProxy.java:298)
      	at net.sf.saxon.event.ProxyReceiver.close(ProxyReceiver.java:100)
      	at net.sf.saxon.event.ComplexContentOutputter.close(ComplexContentOutputter.java:676)
      	at net.sf.saxon.event.ReceivingContentHandler.endDocument(ReceivingContentHandler.java:249)
      	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)
      	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      	at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:427)
      	at net.sf.saxon.event.Sender.send(Sender.java:164)
      	at net.sf.saxon.jaxp.IdentityTransformer.transform(IdentityTransformer.java:383)
      	at com.ravalik.external.converters.fop2pdf.FopDriver.convert(FopDriver.java:115)
      	at com.ravalik.app.converters.ConverterTool.doConversion(ConverterTool.java:141)
      	at com.ravalik.app.dms.layers.modules.document.ServerConverter.convertStrtoFG(ServerConverter.java:76)
      	at com.ravalik.app.dms.layers.modules.document.ServerConverter.convert(ServerConverter.java:40)
      	at com.ravalik.app.auric.structure_agent.ConverterAgent.getConvertedFile(ConverterAgent.java:114)
      	at com.ravalik.app.auric.structure_agent.ConverterAgent.beginJob2(ConverterAgent.java:80)
      	at com.ravalik.app.auric.structure_agent.StructureAgent.beginJob2(StructureAgent.java:202)
      	at sovelia.util.agency.Agent.beginJob(Agent.java:27)
      	at sovelia.util.agency.Agency$1.run(Agency.java:15)
      
      

       

        Attachments

        1. fopconf.xml
          1 kB
          kalam azad
        2. FopDriver_633972825523617220.xml
          16 kB
          kalam azad

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              kalaza kalam azad
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: