camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bilgin Ibryam <bibr...@gmail.com>
Subject Re: PDF/A files using Camel FOP component
Date Thu, 14 Apr 2016 10:02:32 GMT
Is that related my change in the component? How would you pass the
fonts in a non-osgi environment?

On 14 April 2016 at 08:03, Laurentiu Trica <laurentiu.trica@moredevs.ro> wrote:
> Hi Bilgin,
>
> Thank you, sorry for the late response.
> I tried your update and it seems to work, but now I get this error:
>
> javax.xml.transform.TransformerException:
> org.apache.fop.pdf.PDFConformanceException: For PDF/A-1b, all fonts, even
> the base 14 fonts, have to be embedded! Offending font: /Helvetica
> at
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:749)[:1.7.0_95]
> at
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:353)[:1.7.0_95]
> at
> de.edigrid.util.fop.FopProducer.transform(FopProducer.java:89)[520:org.apache.camel.camel-fop:2.13.2]
> at
> de.edigrid.util.fop.FopProducer.process(FopProducer.java:64)[520:org.apache.camel.camel-fop:2.13.2]
> at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[84:org.apache.camel.camel-core:2.14.1]
> at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:120)[84:org.apache.camel.camel-core:2.14.1]
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[84:org.apache.camel.camel-core:2.14.1]
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:416)[84:org.apache.camel.camel-core:2.14.1]
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[84:org.apache.camel.camel-core:2.14.1]
> at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[84:org.apache.camel.camel-core:2.14.1]
> at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[84:org.apache.camel.camel-core:2.14.1]
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[84:org.apache.camel.camel-core:2.14.1]
> at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:433)[84:org.apache.camel.camel-core:2.14.1]
> at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:211)[84:org.apache.camel.camel-core:2.14.1]
> at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:175)[84:org.apache.camel.camel-core:2.14.1]
> at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)[84:org.apache.camel.camel-core:2.14.1]
> at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)[84:org.apache.camel.camel-core:2.14.1]
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_95]
> at
> java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)[:1.7.0_95]
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)[:1.7.0_95]
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.7.0_95]
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_95]
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_95]
> at java.lang.Thread.run(Thread.java:745)[:1.7.0_95]
> Caused by: org.apache.fop.pdf.PDFConformanceException: For PDF/A-1b, all
> fonts, even the base 14 fonts, have to be embedded! Offending font:
> /Helvetica
> at
> org.apache.fop.pdf.PDFFont.validate(PDFFont.java:169)[515:org.apache.servicemix.bundles.fop:1.1.0.1]
> at
> org.apache.fop.pdf.PDFFont.output(PDFFont.java:178)[515:org.apache.servicemix.bundles.fop:1.1.0.1]
> at
> org.apache.fop.pdf.PDFDocument.outputIndirectObject(PDFDocument.java:951)[515:org.apache.servicemix.bundles.fop:1.1.0.1]
> at
> org.apache.fop.pdf.PDFDocument.streamIndirectObject(PDFDocument.java:918)[515:org.apache.servicemix.bundles.fop:1.1.0.1]
> at
> org.apache.fop.pdf.PDFDocument.output(PDFDocument.java:912)[515:org.apache.servicemix.bundles.fop:1.1.0.1]
> at
> org.apache.fop.pdf.PDFDocument.outputTrailer(PDFDocument.java:995)[515:org.apache.servicemix.bundles.fop:1.1.0.1]
> at
> org.apache.fop.render.pdf.PDFDocumentHandler.endDocument(PDFDocumentHandler.java:172)[515:org.apache.servicemix.bundles.fop:1.1.0.1]
> at
> org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.endDocument(IFDocumentHandlerProxy.java:192)[515:org.apache.servicemix.bundles.fop:1.1.0.1]
> at
> org.apache.fop.render.intermediate.IFRenderer.stopRenderer(IFRenderer.java:296)[515:org.apache.servicemix.bundles.fop:1.1.0.1]
> at
> org.apache.fop.area.RenderPagesModel.endDocument(RenderPagesModel.java:265)[515:org.apache.servicemix.bundles.fop:1.1.0.1]
> at
> org.apache.fop.area.AreaTreeHandler.endDocument(AreaTreeHandler.java:342)[515:org.apache.servicemix.bundles.fop:1.1.0.1]
> at
> org.apache.fop.fo.FOTreeBuilder.endDocument(FOTreeBuilder.java:168)[515:org.apache.servicemix.bundles.fop:1.1.0.1]
> at
> com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endDocument(ToXMLSAXHandler.java:185)[:1.7.0_95]
> 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
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:644)[:1.7.0_95]
> at
> com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:740)[:1.7.0_95]
> ... 23 more
>
> How can I embed the fonts? I'm using Camel from a bundle in Servicemix, so
> I'd need to be able to get the font from the classpath.
>
> Regards,
> Laurentiu
>
> On Tue, Apr 5, 2016 at 12:46 AM, Bilgin Ibryam <bibryam@gmail.com> wrote:
>
>> Hi Laurentiu,
>>
>> I just extended FOP component with the following header which lets you
>> set parameters to getRendererOptions.
>>
>> So in your case it would be:
>>
>> <setHeader headerName="CamelFop.RendererOptions.pdf-a-mode">
>> <constant>PDF/A-1b</constant>
>> </setHeader>
>>
>> Basically FOP userAgent object is not an easy one that can be
>> autoamted and set through convention. Some values are set as fields to
>> userAgent (in Camel that would be with CamelFop.Render. header), some
>> have to be set to userAgent.getRendererOptions() (in Camel that will
>> be with CamelFop.RendererOptions) and some are set as Map to
>> userAgent.getRendererOptions() (in Camel that is for example through
>> CamelFop.Encrypt header).
>>
>> Can you try Camel master and let me know whether it works for you or not
>> please?
>>
>> Cheers,
>>
>>
>>
>> On 1 April 2016 at 07:30, Laurentiu Trica <laurentiu.trica@moredevs.ro>
>> wrote:
>> > Hi,
>> >
>> > It is possible with Apache FOP, and the needed parameter is: -pdfprofile
>> > PDF/A-1b
>> >
>> > Usage (command line)
>> > <https://xmlgraphics.apache.org/fop/1.1/pdfa.html#command-line>
>> >
>> > To activate PDF/A-1b from the command-line, specify "-pdfprofile
>> PDF/A-1b"
>> > as a parameter. If there is a violation of one of the validation rules
>> for
>> > PDF/A, an error message is presented and the processing stops.
>> >
>> > PDF/A-1a is enabled by specifying "-pdfprofile PDF/A-1a".
>> > Usage (embedded) <
>> https://xmlgraphics.apache.org/fop/1.1/pdfa.html#embedded>
>> >
>> > When FOP is embedded in another Java application you can set a special
>> > option on the renderer options in the user agent to activate the PDF/A-1b
>> > profile. Here's an example:
>> >
>> > userAgent.getRendererOptions().put("pdf-a-mode", "PDF/A-1b");Fop fop =
>> > fopFactory.newFop(MimeConstants.MIME_PDF, userAgent);[..]
>> >
>> > If one of the validation rules of PDF/A is violated, an
>> > PDFConformanceException (descendant of RuntimeException) is thrown.
>> >
>> > For PDF/A-1a, just use the string "PDF/A-1a" instead of "PDF/A-1b".
>> > Regards,
>> > Laurentiu
>> >
>> >
>> > On Fri, Apr 1, 2016 at 7:55 AM, Claus Ibsen <claus.ibsen@gmail.com>
>> wrote:
>> >
>> >> I suggest to research whether its possible with Apache Fop and then
>> >> see what may be missing in camel-fop to do this. After all camel-fop
>> >> can only do what Apache Fop can do.
>> >>
>> >> On Thu, Mar 31, 2016 at 2:23 PM, Laurentiu Trica
>> >> <laurentiu.trica@moredevs.ro> wrote:
>> >> > Hello,
>> >> >
>> >> > Do you know any other way to do this?
>> >> > Can the component be updated to include this?
>> >> > Can I use a custom fopFactory for this?
>> >> >
>> >> > This is kind of urgent for me.
>> >> >
>> >> > Regards,
>> >> > Laurentiu
>> >> >
>> >> > On Wed, Mar 30, 2016 at 10:03 AM, Laurentiu Trica <
>> >> > laurentiu.trica@moredevs.ro> wrote:
>> >> >
>> >> >> Hi Ibryam,
>> >> >>
>> >> >> I tried that header but it doesn't seem to work. The output looks
the
>> >> same
>> >> >> (same number of bytes, doesn't pass the PDF/A checks
>> >> >> http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx)
>> >> >>
>> >> >> <setHeader headerName="CamelFop.Render.pdf-a-mode">
>> >> >> <constant>PDF/A-1b</constant>
>> >> >> </setHeader>
>> >> >>
>> >> >> Do you have other ideas?
>> >> >>
>> >> >> Regards,
>> >> >> Laurentiu
>> >> >>
>> >> >> On Tue, Mar 29, 2016 at 10:46 PM, Bilgin Ibryam <bibryam@gmail.com>
>> >> wrote:
>> >> >>
>> >> >>> Can you try to set the following header and see if it works
>> >> >>>
>> >> >>> CamelFop.Render.pdf-a-mode: "PDF/A-1b"
>> >> >>>
>> >> >>> HTH,
>> >> >>> B
>> >> >>>
>> >> >>>
>> >> >>> On 29 March 2016 at 09:46, Laurentiu Trica <
>> >> laurentiu.trica@moredevs.ro>
>> >> >>> wrote:
>> >> >>> > Hello,
>> >> >>> >
>> >> >>> > I need to generate PDF/A files using Camel FOP component.
>> >> >>> > I don't see anything about the PDF/A standard in the
>> documentation:
>> >> >>> > http://camel.apache.org/fop.html
>> >> >>> >
>> >> >>> > Can this be done?
>> >> >>> > Apache FOP can do this:
>> >> >>> > https://xmlgraphics.apache.org/fop/1.1/pdfa.html
>> >> >>> >
>> >> >>> > Can I use the CamelFop.Output.Format to set the output
format?
>> >> >>> >
>> >> >>> > Thank you!
>> >> >>> >
>> >> >>> > Regards,
>> >> >>> > Laurentiu
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> --
>> >> >>> Bilgin Ibryam
>> >> >>> Camel Committer at ASF & Integration Architect at Red Hat
>> >> >>> Blog: http://ofbizian.com | Twitter: @bibryam
>> >> >>>
>> >> >>> Camel Design Patterns https://leanpub.com/camel-design-patterns
>> >> >>> Instant Apache Camel Message Routing
>> >> http://www.amazon.com/dp/1783283475
>> >> >>>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>> >> --
>> >> Claus Ibsen
>> >> -----------------
>> >> http://davsclaus.com @davsclaus
>> >> Camel in Action 2: https://www.manning.com/ibsen2
>> >>
>>
>>
>>
>> --
>> Bilgin Ibryam
>> Camel Committer at ASF & Integration Architect at Red Hat
>> Blog: http://ofbizian.com | Twitter: @bibryam
>>
>> Camel Design Patterns https://leanpub.com/camel-design-patterns
>> Instant Apache Camel Message Routing http://www.amazon.com/dp/1783283475
>>



-- 
Bilgin Ibryam
Camel Committer at ASF & Integration Architect at Red Hat
Blog: http://ofbizian.com | Twitter: @bibryam

Camel Design Patterns https://leanpub.com/camel-design-patterns
Instant Apache Camel Message Routing http://www.amazon.com/dp/1783283475

Mime
View raw message