cancel
Showing results for 
Search instead for 
Did you mean: 

HTML to PDF Transformation

iwkse
Star Contributor
Star Contributor
Hi,
I'm checking the sources to find where this transformation is defined in order to understand how it works. I'm guessing somewhere it's taken the value of the mimetype extension and processed in a bean with sourceMimetype and targetMimetype. But it doesn't seem to be like that. I found no beans who actually transform HTML to PDF to show it in the preview.

Any hints about this default transformation?

Regards,
5 REPLIES 5

afaust
Legendary Innovator
Legendary Innovator
Hello,

HTML to PDF transformation is provided by JODConverter (Enterprise-only, see <a href="https://github.com/Alfresco/community-edition/blob/302816f73a96122a0635ce96e38fc3f85e9937dd/projects...">transformers.properties</a>) or direct OpenOffice (Community, see <a href="https://github.com/Alfresco/community-edition/blob/302816f73a96122a0635ce96e38fc3f85e9937dd/projects...">transformer.properties</a>).
From 4.2 on, transformations are no longer explicitly defined in Spring XML. Instead, transformer beans are externally configured via transformers.properties (or alfresco-global.properties) to "support" specific transformations (regardless of the question that they technically support any of the transformations - if configured incorrectly, they may still fail at runtime).

Regards
Axel

iwkse
Star Contributor
Star Contributor
Hi Axel,
Thanks for this clarification.

So basically if I want to add a new mimetype to be served by the content.transformer.OpenOffice.Html2Pdf I can add in the alfresco-global.properties something like that


content.transformer.OpenOffice.Html2Pdf.extensions.newMimetype.pdf.supported=true


or I have to redefine the bean somehow?

[edit]
It doesn't work the way I'm trying to do. Basically I don't need/want to create a new transformation but only say to Alfresco to use that Html2Pdf transformation for this new Mimetype (which is HTML)..I didn't find a way yet

Thanks again,

iwkse
Star Contributor
Star Contributor
It should work this way…but it doesn't and I don't have a clue why.


content.transformer.OpenOffice.extensions.newMimetype.pdf.maxSourceSizeKBytes=5120
content.transformer.OpenOffice.Html2Pdf.extensions.newMimetype.pdf.supported=true
content.transformer.OpenOffice.Html2Pdf.extensions.newMimetype.pdf.priority=50

The indexer finds NO transformers for such newMimetype -> pdf

Nobody to enlighten?

[edit]
In the while I let it work taking another way: Creating a custom transformer and use a pipeline with OpenOffice.Html2Pdf inside.
Check here if you are into the same trouble: https://github.com/deas/contentreich-eml/issues/3

afaust
Legendary Innovator
Legendary Innovator
Hello,

first of all, the indexer does not look for transformations to PDF, it looks for transformations to plain text. This might find a round-trip transformer, i.e. one that first converts to PDF, then to plain text - but such a round-trip transformer may need additional setup.

second of all, as I said, the properties only "declare" that a transformation should be considered supported. They do not technically force a transformation to be supported if the transformer actually fails or its implementation rejects it despite the configuration.

Furthermore, the OpenOffice.Html2Pdf transformer already is a pipeline. This pipeline works with input documents that OpenOffice can convert to ODT internally (HTML => ODT) and then to PDF (ODT => PDF). Also, the maxSourceSizeKBytes config should have been for OpenOffice.extensions.newMimetype.html.maxSiurceSizeKBytes and OpenOffice.Html2Pdf.extensions.newMimetype.pdf.maxSiurceSizeKBytes to be complete.

Now, either your new mimetype is HTML or it isn't. If it is you shouldn't have to do anything - if it isn't, that could be a possible reason for OpenOffice possibly rejecting it when using only OpenOffice.Html2Pdf - if your new pipeline contains a transformer that first converts to "real HTML" before passing it, that would explain why it's now working.

Regards
Axel

iwkse
Star Contributor
Star Contributor
As you suggested on IRC, I've provided a custom openoffice-document-formats.xml which includes the new mimetype and it's recognized by OpenOffice and does the required transformations without the need to use other classes.
Thanks,
Regards