XHTML output and PDF

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

XHTML output and PDF

Tambet Matiisen
Hi everyone!

I've been working on generating PDF from Orbeon forms output. Here is
what I did:
1. Set oxf.epilogue.output-xhtml=true in properties-local.xml, so that
output of Orbeon can be easily fed into XHTMLRenderer
(https://xhtmlrenderer.dev.java.net/).
2. Preprocessed the form so that:
   a) all xforms:binds have attribute readonly="true()",
   b) the xforms:model has attribute xxforms:readonly-appearance="static",
   c) the xforms:model has attribute xxforms:noscript="true" (Orbeon PE
feature).
3. The converter itself is implemented as servlet filter and is engaged
only when there is special parameter (pdf=true) in URL.

I'm happy with the result, but I noticed one thing in the process: even
when oxf.epilogue.output-xhtml=true, the output is still HTML in IE and
it will give error when generating PDF. I tracked the problem down into
/config/epilogue-servlet.xsl in orbeon-resources-private.jar. There is a
check, that XHTML output is produced only, when accept header sent by
browser contains application/xhtml+xml. But IE sends accept header as
*/*, which should be acceptable also. My question is - why is this check
there and can't it be just removed? I want to use vanilla Orbeon with no
custom patches.

I did a little research before sending this e-mail and indeed when
accept header is */*, then output should be text/html.
http://www.w3.org/TR/xhtml-media-types/#media-types

I would rather see, that when oxf.epilogue.output-xhtml=true and accept
header is text/html or */*, then output is still XHTML, but formatted
according to HTML compatibility guidelines (isn't it already?):
http://www.w3.org/TR/xhtml1/#guidelines

Another question - I had to switch to Orbeon PE to generate PDF-s,
because otherwise xxforms:noscript mode was not available. But I
noticed, that read-only forms and PDF generation are working in Orbeon
Form Runner even in CE version. AFAIK you are using the same
XHTMLRenderer. We probably need PE anyway because of other features, but
I'm just curious - could it be possible to make our PDF generation
solution work also with Orbeon CE?

Regards,
  Tambet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: XHTML output and PDF

Erik Bruchez
Administrator
Tambet,

> I'm happy with the result, but I noticed one thing in the process: even when
> oxf.epilogue.output-xhtml=true, the output is still HTML in IE and it will
> give error when generating PDF. I tracked the problem down into
> /config/epilogue-servlet.xsl in orbeon-resources-private.jar. There is a
> check, that XHTML output is produced only, when accept header sent by
> browser contains application/xhtml+xml. But IE sends accept header as */*,
> which should be acceptable also. My question is - why is this check there
> and can't it be just removed? I want to use vanilla Orbeon with no custom
> patches.

I am not sure but I assume it's because IE did not (does not until
version 9) support application/xhtml+xml:

http://www.w3.org/MarkUp/2004/xhtml-faq#ie

> I did a little research before sending this e-mail and indeed when accept
> header is */*, then output should be text/html.
> http://www.w3.org/TR/xhtml-media-types/#media-types
>
> I would rather see, that when oxf.epilogue.output-xhtml=true and accept
> header is text/html or */*, then output is still XHTML, but formatted
> according to HTML compatibility guidelines (isn't it already?):
> http://www.w3.org/TR/xhtml1/#guidelines

That would be a possibility. Could you try this change and make sure
it works with IE and other browsers?

One requirement is that we don't want to trigger IE's quirks mode with
an improper DOCTYPE.

> Another question - I had to switch to Orbeon PE to generate PDF-s, because
> otherwise xxforms:noscript mode was not available. But I noticed, that
> read-only forms and PDF generation are working in Orbeon Form Runner even in
> CE version. AFAIK you are using the same XHTMLRenderer. We probably need PE
> anyway because of other features, but I'm just curious - could it be
> possible to make our PDF generation solution work also with Orbeon CE?

You could probably post-process the output of the form in non-Noscript
mode with XSLT.

-Erik


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: XHTML output and PDF

Tambet Matiisen
On 5.11.2010 3:09, Erik Bruchez wrote:

> Tambet,
>
>> I'm happy with the result, but I noticed one thing in the process: even when
>> oxf.epilogue.output-xhtml=true, the output is still HTML in IE and it will
>> give error when generating PDF. I tracked the problem down into
>> /config/epilogue-servlet.xsl in orbeon-resources-private.jar. There is a
>> check, that XHTML output is produced only, when accept header sent by
>> browser contains application/xhtml+xml. But IE sends accept header as */*,
>> which should be acceptable also. My question is - why is this check there
>> and can't it be just removed? I want to use vanilla Orbeon with no custom
>> patches.
> I am not sure but I assume it's because IE did not (does not until
> version 9) support application/xhtml+xml:
>
> http://www.w3.org/MarkUp/2004/xhtml-faq#ie
Just did test with my IE8 and it happily accepts application/xhtml+xml
content type, even in compatibility mode.

>> I did a little research before sending this e-mail and indeed when accept
>> header is */*, then output should be text/html.
>> http://www.w3.org/TR/xhtml-media-types/#media-types
>>
>> I would rather see, that when oxf.epilogue.output-xhtml=true and accept
>> header is text/html or */*, then output is still XHTML, but formatted
>> according to HTML compatibility guidelines (isn't it already?):
>> http://www.w3.org/TR/xhtml1/#guidelines
> That would be a possibility. Could you try this change and make sure
> it works with IE and other browsers?
I could remove the accept header check (therefore output is always
XHTML), set content-type to text/html (although application/xhtml+xml
doesn't seem to trigger any problem in IE8 and IE7 compatibility mode),
let it sink for a few weeks and send you patch then. I currently don't
have time or knowledge to review xml-converter, if it outputs
HTML-compliant XHTML in xhtml mode. But this solution would be better
aligned with my expectations, when I set oxf.epilogue.output-xhtml = true.

> One requirement is that we don't want to trigger IE's quirks mode with
> an improper DOCTYPE.

Quirks mode choice is based on DOCTYPE as you said, not Content-Type. If
oxf.epilogue.output-xhtml = true and browser is IE, then currently
Orbeon works in quirks mode. It is in standards mode in all other
browsers (that send application/xhtml+xml as part of accept header) and
in IE when oxf.epilogue.output-xhtml = false. Interesting choice.

Regards,
Tambet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: XHTML output and PDF

Erik Bruchez
Administrator
>> That would be a possibility. Could you try this change and make sure
>> it works with IE and other browsers?
>
> I could remove the accept header check (therefore output is always XHTML),
> set content-type to text/html (although application/xhtml+xml doesn't seem
> to trigger any problem in IE8 and IE7 compatibility mode), let it sink for a
> few weeks and send you patch then. I currently don't have time or knowledge
> to review xml-converter, if it outputs HTML-compliant XHTML in xhtml mode.
> But this solution would be better aligned with my expectations, when I set
> oxf.epilogue.output-xhtml = true.

Sure, please keep us posted.

Ideally IE 6 compatibility is (still) a requirement.

>> One requirement is that we don't want to trigger IE's quirks mode with
>> an improper DOCTYPE.
>
> Quirks mode choice is based on DOCTYPE as you said, not Content-Type. If
> oxf.epilogue.output-xhtml = true and browser is IE, then currently Orbeon
> works in quirks mode. It is in standards mode in all other browsers (that
> send application/xhtml+xml as part of accept header) and in IE when
> oxf.epilogue.output-xhtml = false. Interesting choice.

Probably a bug rather! Are you using a nightly build though? We made
some changes here a while back:

https://github.com/orbeon/orbeon-forms/commit/5ebdda0bf44bb194328f76d848baaa4020803162

-Erik

>
> Regards,
> Tambet
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing
> list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws