I copied the snippetcode into a draw document (001.1.2) and also (001.9.69)
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 = 100 aFilterData(1).Name = "PixelHeight" aFilterData(1).Value = 100 aFilterData(2).Name ="LogicalWidth" aFilterData(2).Value = 1000 aFilterData(3).Name ="LogicalHeight" aFilterData(3).Value = 1000 aFilterData(4).Name ="Quality" aFilterData(4).Value = 60 Dim sFileUrl As String sFileUrl = "file:///d:/test2.jpg" xDoc = thiscomponent xView = xDoc.currentController xSelection = xView.selection If isEmpty( xSelection ) then xObj = xView.currentPage else xObj = xSelection End If Export( xObj, sFileUrl, aFilterData() ) End SubThen I placed a simple jpeg graphic into the document selected an run the macro, resulting in a Jpeg file with its original dimensions.
changing the filterdata in both OOversions has no influence at all.
Thanks for the respons
Fernand
At 19:27 6/06/05, you wrote:
Hello,
The PixelWidth and PixelHeight property in the FilterData sequence allows it to set the number of wanted pixels within the destination graphic, thus means the property is only meaningful if the destination graphic is a pixel format (e.g. bmp, jpeg, png).
The LogicalWidth and LogicalHeight property does not influence the destination file size or the number of pixels, instead it makes it possible to set the size of the viewport. Not every file format is supporting the logical size, this might be your problem.
To be able to help any further I need more information (OpenOffice.org version, your target format ...)
Sven
sos wrote:
Yes, i tested it also the graphis are exported at ther original size , ther must ne something wrong with the usage of the "filterdata"
Maybe one of the authors of the code snipet:
Olivier Samyn
Sven Jacobi
Michael Hoennig
can help us further
Fernand
At 11:05 1/06/05, you wrote:
So, if i want to reduce the dimension (the weight..) of the image in the final document, which properties i must set?? (Setting the height and the width i don't obtain nothing..)
sos ha scritto:
At 15:52 31/05/05, you wrote:
I try to use the example, i must set the pixelwidth and the pixelheight to reduce the resolution??
I supose that "resolution" is some notation in the header of a graphic file, needed bij some applications , screens and printers, to now how "big" the graphic must be presented. and the resolution has no influence on the sise of the graphic, only the number of pixels.
sos ha scritto:
At 16:50 30/05/05, you wrote:
Hi to all,
i want to insert an image in a Writer Document with the Java Api.
After this, how can i reduce the resolution (if i reduce the size of the image, the dimension of the document remain the same..)??
Thanks to all
I found a solution for a similar "export" problem in the OO snipet base
http <http://codesnippets.services.openoffice.org/Office/Office.GraphicExport.snip>://codesnippets.services.openoffice.org/Office/Office.GraphicExport.snip <http://codesnippets.services.openoffice.org/Office/Office.GraphicExport.snip>
so you can using the exportfilters to write the grapchic to some temporay file at the wanted resolution and then import it back to the document.
Wondering if we can write to a "virtual" file on the clipboard ??
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dott. Cristian Fonti
mailto: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Centro Elaborazione Dati (CED) - Resp. Web Area
SCM Group S.p.a. http://www.scmgroup.com
via Emilia, 77 - 47900 Rimini (RN), Italy
Tel.: +39 0541 700163 Interno: 2163
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dott. Cristian Fonti
mailto: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Centro Elaborazione Dati (CED) - Resp. Web Area
SCM Group S.p.a. http://www.scmgroup.com
via Emilia, 77 - 47900 Rimini (RN), Italy
Tel.: +39 0541 700163 Interno: 2163
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
