incubator-ooo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 119417] New: Problems with PDF export using FilterData (VB-Script using COM interface)
Date Fri, 25 May 2012 10:50:23 GMT
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.

Mime
View raw message