OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Exporting PS/EPS with UNO/Python

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
michaelh
Newbie
Newbie


Joined: 27 Sep 2006
Posts: 3

PostPosted: Tue Oct 03, 2006 3:03 am    Post subject: Exporting PS/EPS with UNO/Python Reply with quote

Hi,
my problem is the following: I want to export the pages of an .sxd file automatically to EPS/PDF. As a starting base, I got a Python script from a collegue exporting the document into Postscript. Another Python script then extract the single pages and named them according to the information in the XML files.

Surely, this is not the optimal way, but it works.

Now, I needed some improvements like...
(1) automatically convert certain colors into grayscales or replaced them by hatches if used as filling colors.
(2) exporting it as a grayscale image
---

(1) works fine, but (2) makes problems:

propTuple = (OOoLib.createPropertyValue("FileName", cTargetURL), OOoLib.createPropertyValue("PrintQuality", ???)

=> PrintQuality not responsible for Color/Grayscale?

Then I tried to add another printer using only Grayscale by copying the default printer in psprint.conf and customizing it. The funny thing is that I really get grayscale, but it exports only in portrait mode, although drawn in landscape mode. Even if a change this in psprint.conf, this does not help. Btw: The default printer uses portrait mode and can make it, however.

My code to change the printer looks as follows (I tried to select the new printer by the PrinterName property during exporting, but this did not work...):

printer = oDoc.getPrinter
for prop in printer:
if prop.Name == "Name":
prop.Value = "uno_grayscale" <= the new printer

Is there any solution?


--------------------------------------------------------------------

My favourite solution would be to export the single pages directly into EPS instead exporting one multi-page PS document. From my point of view, this strategy used by the original script I got, is responsible for the problems.

So I tried to export the pages into EPS (but again without success)

I also considered: http://www.oooforum.org/forum/viewtopic.phtml?t=6769
but this did not help.

Here again my code:

oGraphic = OOoLib.createUnoService('uno.sun.star.drawing.GraphicExportFilter')
filterData = (OOoLib.createPropertyValue('Level', 2), OOoLib.createPropertyValue('ColorFormat', 2), OOoLib.createPropertyValue('TextMode', 1), OOoLib.createPropertyValue('Preview', 0), OOoLib.createPropertyValue('CompressionMode', 2))

oGraphic.setSourceDocument(xPage) <== the current page as as a collection of shapes
argsExport = (OOoLib.createPropertyValue('URL', cExportURL, OOoLib.createPropertyValue('MediaType', 'application/postscript'), OOoLib.createPropertyValue('FilterData', filterData))

oGraphic.filter(argsExport)


=> The problem is that I get an EPS file with binary data before the postscript code, although I turned compression off. I also tried other parameter combinations and it seems that the properties have no effect!?

And: I can view the file with kghostview, but not include it into a latex document.



Thank you very much in advance!
Back to top
View user's profile Send private message
ms777
Super User
Super User


Joined: 07 Feb 2004
Posts: 1355

PostPosted: Thu Oct 05, 2006 2:01 pm    Post subject: Reply with quote

a search after "eps" and "binary" turns out this result http://www.oooforum.org/forum/viewtopic.phtml?p=25895#25895
searchin the bug list after the same words gives http://qa.openoffice.org/issues/show_bug.cgi?id=25256 . Go vote for it - it is targeted OO Later (=never)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group