You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2012/05/25 12:50:23 UTC

[Bug 119417] New: Problems with PDF export using FilterData (VB-Script using COM interface)

https://issues.apache.org/ooo/show_bug.cgi?id=119417

          Priority: P3
            Bug ID: 119417
          Assignee: ooo-issues@incubator.apache.org
           Summary: Problems with PDF export using FilterData (VB-Script
                    using COM interface)
          Severity: normal
        Issue Type: DEFECT
    Classification: Code
                OS: Windows XP
          Reporter: fs@drivve.de
          Hardware: PC
            Status: UNCONFIRMED
           Version: OOo 3.4 Beta
         Component: code
           Product: api

Created attachment 77598
  --> https://issues.apache.org/ooo/attachment.cgi?id=77598&action=edit
Windows VBS script

The problem is related to PDF export using COM Bridge on Windows: I am trying
to export a doc file to PDF.
Basically, the export works fine but thenone of  FilterData properies take
effect. Using the same code as an OpenOffice Macro works fine.

VBS Script
----------
I am executing the following VB script (see attached vbs file) on a Wndows XP
PC with Apache OpenOffice 3.4:

=========================================================================================
  Set oSM = CreateObject("com.sun.star.ServiceManager")
  Set oDesk = oSM.createInstance("com.sun.star.frame.Desktop")
  Dim OpenParam(0)
  Set OpenParam(0) = MakePropertyValue(oSM, "Hidden", false)  
  Set oDoc = oDesk.loadComponentFromURL("file:///c:/test.odt", "_blank", 0,
OpenParam)

  ' Save the document using a filter.
  Dim SaveFilter(0)
  Dim SaveOptions(1)
  Set SaveFilter(0) = MakePropertyValue(oSM,  "PageRange", "1" )
  Set SaveOptions(0)= MakePropertyValue(oSM,  "FilterName", "writer_pdf_Export"
)
  Set SaveOptions(1)= MakePropertyValue(oSM,  "FilterData", SaveFilter )
  Call oDoc.storeToURL( "file:///c:/test.pdf", SaveOptions)
  Call oDoc.close( false )

Function MakePropertyValue(oServiceManager, cName, uValue)
  Dim oPropertyValue
  Set oPropertyValue =
oServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
  oPropertyValue.Name = cName
  oPropertyValue.Value = uValue  
  Set MakePropertyValue = oPropertyValue
End Function
=========================================================================================

The problem is, that the FiltaData property does not take effect - all pages
are exported as PDF even though I set the "PageRange" property to "1".
I tested some other properties, like "MaxImageResolution" or security related
ones like "EncryptFile" and "DocumentOpenPassword" with no success. It seems
that none of these work.


OpenOffice Macro
-----------------
I made the same code as a Macro within OpenOffice and it works fine and the
FilterData works:

================================================================
Sub Main
    Dim OpenParam(0)
    Set OpenParam(0)=MakePropertyValue( "Hidden", false )
    oDoc = StarDesktop.loadComponentFromURL( "file:///c:/test.odt", "_blank",
0,OpenParam )

   ' Save the document using a filter.
    Dim SaveFilter(0)
    Dim SaveOptions(1)
    Set SaveFilter(0) = MakePropertyValue( "PageRange", "1" )
    Set SaveOptions(0)= MakePropertyValue( "FilterName", "writer_pdf_Export" )
    Set SaveOptions(1)= MakePropertyValue( "FilterData", SaveFilter )
    oDoc.storeToURL( "file:///c:/test.pdf", SaveOptions)
    oDoc.close( false )
End Sub

Function MakePropertyValue( Optional cName As String, Optional uValue ) As
com.sun.star.beans.PropertyValue
   Dim oPropertyValue As New com.sun.star.beans.PropertyValue
   oPropertyValue.Name = cName
   oPropertyValue.Value = uValue
   MakePropertyValue() = oPropertyValue
End Function 
================================================================

It looks like the COM interface does not work as expected.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 119417] Problems with PDF export using FilterData (VB-Script using COM interface)

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=119417

Ariel Constenla-Haile <ar...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED
                 CC|                            |arielch@apache.org

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 119417] Problems with PDF export using FilterData (VB-Script using COM interface)

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=119417

Ariel Constenla-Haile <ar...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |INVALID

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 119417] Problems with PDF export using FilterData (VB-Script using COM interface)

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=119417

fs@drivve.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from fs@drivve.de ---
Yes, this fixed the issue. Thanks

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 119417] Problems with PDF export using FilterData (VB-Script using COM interface)

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=119417

bmarcelly <ma...@club-internet.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marcelly@club-internet.fr

--- Comment #1 from bmarcelly <ma...@club-internet.fr> ---
This is a subtlety of COM bridge. You have to specify explicitly that
SaveFilter is an array of com.sun.star.beans.PropertyValue.

See thread [Solved] [PHP] Problem to export PDF /A with puno
http://user.services.openoffice.org/en/forum/viewtopic.php?f=44&t=36163

Your code should work with these changes:

Dim unoWrap

Set unoWrap = oSM.Bridge_GetValueObject
unoWrap.set "[]com.sun.star.beans.PropertyValue", SaveFilter

Set SaveOptions(1)= MakePropertyValue(oSM,  "FilterData", unoWrap)

-- 
You are receiving this mail because:
You are the assignee for the bug.