trouble using ExportFormFields in uno API; PDF form controls are exported even when set to False

Bug #118789 reported by Dan Connolly
2
Affects Status Importance Assigned to Milestone
openoffice.org (Ubuntu)
Invalid
Low
Unassigned

Bug Description

Binary package hint: openoffice.org

The spec for the PDF export dialog says

"ExportFormFields" oor:type="xs:boolean" default:true Specifies whether form fields are exported as widgets or only their fixed print representation is exported.

http://specs.openoffice.org/appwide/pdf_export/PDFExportDialog.odt

but it doesn't seem to actually work.

I took the ooextract.py example
http://udk.openoffice.org/python/samples/ooextract.py
and tried to use ExportFormFields, without luck.

I'm not the only one having this problem; in a Dec 2006 forum post, I see:

         So, has anyone been able to use OOo's writer_pdf_export
         filter and the "ExportFormFields" property with success?
         I have not had success with the following code:
         -- http://www.oooforum.org/forum/viewtopic.phtml?t=50504&highlight=flatten+pdf

Then I found an Aug 2006 suggestion from Giuseppe Castagno
http://<email address hidden>/msg03726.html

Castagno's code shows a FilterData indirection, so my code now looks like:

        filterOptions = (
            PropertyValue( "ExportFormFields", 0, False, 0),
            )

        outProps = (
            PropertyValue( "FilterName" , 0, filterName , 0 ),
            PropertyValue( "FilterData", 0, filterOptions, 0 ),
     PropertyValue( "Overwrite" , 0, True , 0 ),
            PropertyValue( "OutputStream", 0, OutputStream(), 0),
 )

but the resulting .pdf still has the form controls. It's distinctly
different from what I get via the GUI, which has different shaped
X's in the checkbox controls.

Help?

The forum post shows work-arounds involving post-processing
the PDF with some iText Java library, but I'd really rather not go there.

Revision history for this message
Dan Connolly (connolly) wrote :

attaching the whole modified ooexport.py

Revision history for this message
Dan Connolly (connolly) wrote :

Here's a simple document with one form control to help reproduce the problem.

Revision history for this message
Dan Connolly (connolly) wrote :

This is the sort of PDF that I want; it's produced using the PDF options dialog, manually.

Revision history for this message
Dan Connolly (connolly) wrote :

This is the output of:

$ python ooextract.py --pdf formcontrol.odt

it exhibits the problem: I want it to have no form controls,
but it has form controls.

Revision history for this message
Chris Cheney (ccheney) wrote :

On openoffice.org 1:2.4.0~rc2-1ubuntu3. For me they all look like your formcontrol.pdf, gui ooextract.py from the website and the ooextract.py that you modified. They all have the stylized X mark. So does that mean they are all broken for what you are trying to do?

Changed in openoffice.org:
status: New → Incomplete
Revision history for this message
Dan Connolly (connolly) wrote :

yes, if it's like formcontrol.pdf, it's broken. What I expect is formcontrol-gui.pdf.

Chris Cheney (ccheney)
Changed in openoffice.org:
status: Incomplete → New
Revision history for this message
Dan Connolly (connolly) wrote :

I got a clue from somebody...

"Your problem is that you need to pass an array as a value of a PropertyValue, and a PropertyValue can receive anything. So you have to tell the COM bridge what kind of value you are passing."

second comment on http://www.oooforum.org/forum/viewtopic.phtml?t=61144

Revision history for this message
Bruce van der Kooij (brucevdk) wrote :

That somebody was me by the way, I stumbled upon this issue while researching another property (PageRange) which is also a sub property of FilterData. Took me about 2 hours before I found B Marcelly's post mentioned above. I initially had some trouble finding out there was a PageRange property at all (for example it's not described in the spec linked above), however all properties seem to be listed in ImpPDFTabDialog::GetFilterData (see: http://lxr.go-oo.org/source/framework/filter/source/pdf/impdialog.cxx).

I was going to try and summarize the issue but since my experience with the UNO stuff is severely limited (to today) there's nothing I can add. Thought I'd at least take the time to post a patch for the previously attached ooextract.py. Here's the important snippet:

filterOptions = uno.Any("[]com.sun.star.beans.PropertyValue", (
    PropertyValue( "ExportFormFields", 0, False, 0),
),)

Notice how the uno.Any function is used to wrap the filterOptions tuple, or set the type to []com.sun.star.beans.PropertyValue (which I assume means an array of com.sun.star.beans.PropertyValue). B Marcelly explains the reason for this wrapping in this specific post over at the OOo forums (http://www.oooforum.org/forum/viewtopic.phtml?t=58792#233845).

I'll add a couple of keywords to this post so hopefully other people will stumble on this bug report when they're facing the same problems.

Keywords: writer_pdf_Export, PageRange, PropertyValue, filters, PyUNO

P.S.

Thanks to cl over at #dev.openoffice.org for his assistance with this issue.

Revision history for this message
Chris Cheney (ccheney) wrote :

Setting to alpha-4 so I don't forget to get this bug fixed.

Changed in openoffice.org:
assignee: nobody → ccheney
importance: Undecided → Low
milestone: none → intrepid-alpha-4
status: New → Triaged
Revision history for this message
Chris Cheney (ccheney) wrote :

12:48 < calc> Brucevdk: thanks for the update, i'll get it into the next upload to intrepid
12:49 < Brucevdk> calc: intrepid? If you're talking about patching ooextract.py, don't.
12:50 < Brucevdk> calc: the patch was for Dan's modified version, not the one at openoffice.org (that one deals with a generic
12:50 < Brucevdk> pdf exporter)
12:52 < Brucevdk> calc: my conclusion is that it's not a bug at all, should probably be set INVALID

Changed in openoffice.org:
assignee: ccheney → nobody
milestone: intrepid-alpha-4 → none
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.