[Java] Export as PDF without lauching OOo

The Application Programming Interface and the OASIS Open Document Format

[Java] Export as PDF without lauching OOo

Postby Korps » Fri Sep 10, 2010 3:45 pm

Hi,
I am currently using OOo to create documents, save them, ...
My problem is that I would like to export existing document and then export it as pdf without launching OOo (I mean to load the document and then export it as pdf). I am using it in Java
It is possible or not?
I saw there is may be a way while using :
Code: Select all   Expand viewCollapse view
xComponentLoader.loadComponentFromURL(private:stream/, "_blank", 0, loadProps);

Can you tell me if is it possible and how can I do it.
Thanks

PS : my english may be bad, i am french so I try to do my best.
OOo 3.2 on Vista
Korps
 
Posts: 2
Joined: Fri Sep 10, 2010 3:35 pm

Re: [Java] Export as PDF without lauching OOo

Postby hol.sten » Sat Sep 11, 2010 3:21 pm

Korps wrote:My problem is that I would like to export existing document and then export it as pdf without launching OOo (I mean to load the document and then export it as pdf). I am using it in Java
It is possible or not?

No, it is not possible.

Korps wrote:PS : my english may be bad, i am french so I try to do my best.

Pas de problem. If you like you can ask in french here http://user.services.openoffice.org/fr/forum/.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java] Export as PDF without lauching OOo

Postby Korps » Sun Sep 12, 2010 9:56 pm

Ok thanks,
I'll find another way.
OOo 3.2 on Vista
Korps
 
Posts: 2
Joined: Fri Sep 10, 2010 3:35 pm

Re: [Java] Export as PDF without lauching OOo

Postby groverblue » Tue Mar 08, 2011 7:24 pm

Yes you can.

Code: Select all   Expand viewCollapse view
PropertyValue[] filterData = new PropertyValue[5];

filterData[0] = new PropertyValue();

filterData[0].Name = "UseLosslessCompression";

filterData[0].Value = Boolean.FALSE;

filterData[1] = new PropertyValue();

filterData[1].Name = "Quality";

filterData[1].Value = new Integer(50);

filterData[2] = new PropertyValue();

filterData[2].Name = "ReduceImageResolution";

filterData[2].Value = Boolean.TRUE;

filterData[3] = new PropertyValue();

filterData[3].Name = "MaxImageResolution";

filterData[3].Value = new Integer(150);

filterData[4] = new PropertyValue();

filterData[4].Name = "ExportFormFields";

filterData[4].Value = Boolean.FALSE;


pdfStoreProps = new PropertyValue[4];

pdfStoreProps[0] = new PropertyValue();

pdfStoreProps[0].Name = "FilterName";

pdfStoreProps[0].Value = "writer_pdf_Export";

pdfStoreProps[1] = new PropertyValue();

pdfStoreProps[1].Name = "Pages";

pdfStoreProps[1].Value = "All";

pdfStoreProps[2] = new PropertyValue();

pdfStoreProps[2].Name = "Overwrite";

pdfStoreProps[2].Value = Boolean.TRUE;

pdfStoreProps[3] = new PropertyValue();

pdfStoreProps[3].Name = "FilterData";

pdfStoreProps[3].Value = filterData;

           
String filePath = "/path/to/my/pdf/file.pdf";

XTextDocument xTextDocument; // or XComponent

XStorable xStorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);

xStorable.storeToURL("file:///" + filePath, pdfStoreProps);

xStorable = null;
groverblue
 
Posts: 40
Joined: Wed Mar 26, 2008 6:17 pm

Re: [Java] Export as PDF without lauching OOo

Postby groverblue » Tue Mar 08, 2011 7:29 pm

Here is another useful thread:

viewtopic.php?f=44&t=1804&start=0
groverblue
 
Posts: 40
Joined: Wed Mar 26, 2008 6:17 pm

Re: [Java] Export as PDF without lauching OOo

Postby hol.sten » Wed Mar 09, 2011 12:25 am

groverblue wrote:Yes you can.

Even half a year later you didn't get the point of the original question? The emphasis of this thread laid on "without lauching OOo". Your answers provide only a solution for the part "Export as PDF".
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java] Export as PDF without lauching OOo

Postby groverblue » Wed Mar 09, 2011 5:27 pm

Relax cowboy. It isn't clear from the original post what "without launching OOo" actually means. I take that wording to mean running the GUI and selecting File > Export as PDF. If the original poster meant "without bootstrapping OOo," then it wasn't made clear.
groverblue
 
Posts: 40
Joined: Wed Mar 26, 2008 6:17 pm


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest