473,408 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

OpenOffice UNO export PDF help needed

I've geen googling for 3 days now, and cannot find out how to do this.

I'm trying to use OpenOffice 2.0 and UNO to generate PDF documents. I'm
using windows, but will have to make it work under Linux for production.
I've been able to set the parameters and call the exportToPdf method, but
the exported file is not PDF but an .odt document, I can change suffix from
pdf to odt and double click on it and open it as openoffice. The project is
sort of a custom mail-merge, but there is little data used to produce a
lengthy contract and attachments. The whole thing needs to be done via a
cgi script or a servlet.

below is a java code snippet, submitted with apologies, I'm using that
rather than python because I found better examples and my java IDE helps me
out. I originally started out to do python, and will eventually shift back
to it once I get this working
public void writePDF(XTextDocument doc, String stringUrl) {
String stringConvertType ="PDF Creator";// args[ 1 ];
PropertyValue propertyvalueHidden[] = new PropertyValue[ 0 ];
XStorable xstorable =( XStorable ) UnoRuntime.queryInterface(
XStorable.class, doc );

// Preparing properties for converting the document
PropertyValue propertyvalue[] = new PropertyValue[ 2 ];
propertyvalue[ 0 ] = new PropertyValue();
propertyvalue[ 0 ].Name = "Overwrite";
propertyvalue[ 0 ].Value = new Boolean(true);
propertyvalue[ 1 ] = new PropertyValue();
propertyvalue[ 1 ].Name = "Filter";
propertyvalue[ 1 ].Value = "writer_pdf_Export";
//propertyvalue[ 1 ].Value = "impress_pdf_Export"; //also tried
"PDF Creator"
xstorable.storeToURL( stringUrl+".pdf", propertyvalue ); //also
tried storeAsUrl, same result

---------------------------------------------------------------------------
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---------------------------------------------------------------------------
Apr 30 '06 #1
1 2212
Sells, Fred wrote:
I've geen googling for 3 days now, and cannot find out how to do
this.

I'm trying to use OpenOffice 2.0 and UNO to generate PDF documents.
I'm using windows, but will have to make it work under Linux for
production. I've been able to set the parameters and call the
exportToPdf method, but the exported file is not PDF but an .odt
document,


Have you tried the ooextract.py found on:
http://udk.openoffice.org/python/python-bridge.html

Here work well and generate a pdf file.

See also this for more info about generate pdf:
http://mithrandr.moria.org/blog/447.html

Michele
May 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Allenabethea | last post by:
Is there any advantage to upgrading the python distribution which is part of OpenOffice to 2.3.3? I notice it is version 2.2.2 Are the bug fixes crucial? allen
0
by: Bob M | last post by:
This question is about MySQL and how it can be accessed with OpenOffice (presumably the same issue would arise with MS Office, but I'm not sure about that). The problem I'm having is with the setup...
0
by: Jean-Marie Gouarné | last post by:
The new OpenOffice::OODoc distribution, V 1.203, is available from CPAN today. It's an Expat-based Perl extension allowing direct read/write access to OpenOffice.org (XML) documents. It provides...
205
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
5
by: Bob Powell | last post by:
Hello everyone: Can anyone tell me if it is possible to connect excel or openoffice via odbc directly to a postgres backend database. Also, if that is possible does either OpenOffice or Excel...
0
by: dtsearch | last post by:
New release expands-through a .NET Spider API, to Linux, and to OpenOffice-dtSearch's ability to index over a terabyte of text in a single index, with indexed search time typically less than a...
4
by: krishnakant Mane | last post by:
hello, right now I am involved on doing a very important accessibility work. as many people may or may not know that I am a visually handicap person and work a lot on accessibility. the main...
7
by: PaoloB | last post by:
Hi everyone, during our development, we need to write some unit tests that interact with OpenOffice through pyUno. Is there anyone who has got any experience on it? As OpenOffice is quite a...
0
by: mahesh123 | last post by:
Hi Folks, How can i export the data from the MSFlexGrid to the MS Open Office Excel in VB 6.0? I Can Know how to export data from the MSFlexgrid to the MS Office Excel. Please Help me regarding...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.