openiffice转换附件格式为pdf,如何加入jegp压缩的质量选择
openiffice转换附件格式为pdf,怎么加入jegp压缩的质量选择
利用openiffice转换附件格式为pdf
Sub ConvertWordToPDF( cSourceFile , cDestinationFile)
cURL = ConvertToURL( cSourceFile )
' Open the document.
' Just blindly assume that the document
' is of a type that OOo will
' correctly recognize and open --
' without specifying an import filter.
oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, _
Array(MakePropertyValue( "Hidden", True ), ) )
cURL = ConvertToURL( cDestinationFile )
' Save the document using a filter.
oDoc.storeToURL( cURL, _
Array(MakePropertyValue( "FilterName", "writer_pdf_Export"),)
oDoc.close( True )
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
If Not IsMissing( cName ) Then
oPropertyValue.Name = cName
EndIf
If Not IsMissing( uValue ) Then
oPropertyValue.Value = uValue
EndIf
MakePropertyValue() = oPropertyValue
End Function
加入有个jegp压缩可以进行质量选择,求大神帮我完善一下
------解决方案--------------------
Sub Export( xObject, sFileUrl As String, aFilterData )
xExporter = createUnoService( "com.sun.star.drawing.GraphicExportFilter" )
xExporter.SetSourceDocument( xObject )
Dim aArgs (2) as new com.sun.star.beans.PropertyValue
Dim aURL as new com.sun.star.util.URL
aURL.complete = sFileUrl
aArgs(0).Name = "MediaType"
aArgs(0).Value = "image/jpeg"
aArgs(1).Name = "URL"
aArgs(1).Value = aURL
aArgs(2).Name = "FilterData"
aArgs(2).Value = aFilterData
xExporter.filter( aArgs() )
End Sub
Sub ExportCurrentPageOrSelection
'creating filter dependent filter properties
Dim aFilterData (4) as new com.sun.star.beans.PropertyValue
aFilterData(0).Name = "PixelWidth" '
aFilterData(0).Value = 1000
aFilterData(1).Name = "PixelHeight"
aFilterData(1).Value = 1000
aFilterData(2).Name ="LogicalWidth"
aFilterData(2).Value = 1000
aFilterData(3).Name ="LogicalHeight"
aFilterData(3).Value = 1000
利用openiffice转换附件格式为pdf
Sub ConvertWordToPDF( cSourceFile , cDestinationFile)
cURL = ConvertToURL( cSourceFile )
' Open the document.
' Just blindly assume that the document
' is of a type that OOo will
' correctly recognize and open --
' without specifying an import filter.
oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, _
Array(MakePropertyValue( "Hidden", True ), ) )
cURL = ConvertToURL( cDestinationFile )
' Save the document using a filter.
oDoc.storeToURL( cURL, _
Array(MakePropertyValue( "FilterName", "writer_pdf_Export"),)
oDoc.close( True )
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
If Not IsMissing( cName ) Then
oPropertyValue.Name = cName
EndIf
If Not IsMissing( uValue ) Then
oPropertyValue.Value = uValue
EndIf
MakePropertyValue() = oPropertyValue
End Function
加入有个jegp压缩可以进行质量选择,求大神帮我完善一下
C#
winform
openoffice
宏
------解决方案--------------------
Sub Export( xObject, sFileUrl As String, aFilterData )
xExporter = createUnoService( "com.sun.star.drawing.GraphicExportFilter" )
xExporter.SetSourceDocument( xObject )
Dim aArgs (2) as new com.sun.star.beans.PropertyValue
Dim aURL as new com.sun.star.util.URL
aURL.complete = sFileUrl
aArgs(0).Name = "MediaType"
aArgs(0).Value = "image/jpeg"
aArgs(1).Name = "URL"
aArgs(1).Value = aURL
aArgs(2).Name = "FilterData"
aArgs(2).Value = aFilterData
xExporter.filter( aArgs() )
End Sub
Sub ExportCurrentPageOrSelection
'creating filter dependent filter properties
Dim aFilterData (4) as new com.sun.star.beans.PropertyValue
aFilterData(0).Name = "PixelWidth" '
aFilterData(0).Value = 1000
aFilterData(1).Name = "PixelHeight"
aFilterData(1).Value = 1000
aFilterData(2).Name ="LogicalWidth"
aFilterData(2).Value = 1000
aFilterData(3).Name ="LogicalHeight"
aFilterData(3).Value = 1000