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

OO in server mode on Linux generates long, narrow PDFs

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


Joined: 03 Aug 2004
Posts: 2

PostPosted: Tue Aug 03, 2004 9:28 am    Post subject: OO in server mode on Linux generates long, narrow PDFs Reply with quote

Greetings,

We're using Open Office(1.1.2) to do HTML->PDF conversion on some Linux machines.
We're running OO in -headless mode (with Xvbf) and connecting to OO over a socket. Our conversion uses the writer_web_pdf_Export filter.

Everything works fine except that the PDFs which are generated are super-skinny - they're as wide as the longest word. It looks like the document width is 0 (though the margins appear to be obeyed; there is white space on all sides of the text).

I've tried messing with every parameter I can think of by using spadmin to change margins, paper sizes, etc - but with no success.

Has anyone seen this problem, or does someone have a suggestion for something that I might be doing wrong? I'm running out of ideas...

Thanks for any help!
Ben
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Tue Aug 03, 2004 12:49 pm    Post subject: Reply with quote

The writer web pdf export is probably the reason.

Are your documents Web or Writer?

Maybe you can open your document (even if HTML) into Writer instead of Web. Then use Writer's PDF export which will have individual pages, as Writer does.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
ben1t
Newbie
Newbie


Joined: 03 Aug 2004
Posts: 2

PostPosted: Tue Aug 03, 2004 2:31 pm    Post subject: Reply with quote

Thanks for the reply, Danny!

The incoming documents are HTML. I'll try opening the document into Writer and then exporting into PDF. We'd thought that writer web pdf export actually did go through Writer first (because of "writer" in the name)...

There must be someone else out there using OO to do HTML->PDF conversion...

Why do you think the writer web pdf export is the culprit?
Thanks again for the feedback,
Ben
Back to top
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Wed Aug 04, 2004 10:10 am    Post subject: Reply with quote

Have you tried the extendedPDF macro?
Might have problems because of the web stuff, but one never knows...
_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Fri Aug 06, 2004 7:07 am    Post subject: Reply with quote

See this...
http://www.oooforum.org/forum/viewtopic.php?t=3973

WEB has a limited set of export options. One of them is PDF. The WEB->PDF export filter generates a long skinny PDF. (Like a web page viewed in a browser!)

You don't want a long skinny PDF.

Ergo, you don't want the WEB->PDF export filter.

Therefore, you must need a different PDF export filter.

WRITER has a WRITER->PDF export filter that generates one PDF page for each writer page.

Writer can import HTML documents, but an import filter is required to load HTML into WRITER.

Since WRITER can import html, and can export pdf in the format you want, the problem seems trivially solved.

WRITER and WEB are not the same thing.

Code:
Sub Main
   ' CHANGE ME!!!!
   ' Put your own HTML document here....
   cFile = "C:\Documents and Settings\dbrewer\Desktop\search.php.htm"
   
   ' Convert filename to URL.
   cUrl = ConvertToURL( cFile )
   
   ' Load the HTML file, but load it into WRITER not into WEB!
   ' We MUST specify an import filter to force the file to load in WRITER.
   oDoc = StarDesktop.loadComponentFromURL( cUrl, "_blank", 0,_
      Array(_
         MakePropertyValue( "FilterName", "HTML (StarWriter)" ) ) )
   
   ' Save as PDF.
   ' Note that we must use the WRITER export filter,
   '  because this is a WRITER document not a WEB document.
   cFile = "C:\Documents and Settings\dbrewer\Desktop\search.pdf"
   cUrl = ConvertToURL( cFile )
   oDoc.storeToURL( cUrl,_
      Array(_
         MakePropertyValue( "FilterName", "writer_pdf_Export" ) ) )
   
   ' Close the window
   oDoc.close( True )
End Sub

Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
   oPropertyValue = createUnoStruct( "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



In the line that says....
Code:
   oDoc = StarDesktop.loadComponentFromURL( cUrl, "_blank", 0,_
      Array(_
         MakePropertyValue( "FilterName", "HTML (StarWriter)" ) ) )

If you don't want a window to briefly pop up on screen, then add a Hidden=True property like this....
Code:
   oDoc = StarDesktop.loadComponentFromURL( cUrl, "_blank", 0,_
      Array(_
         MakePropertyValue( "FilterName", "HTML (StarWriter)" ),_
         MakePropertyValue( "Hidden", True ) ) )

If you do this, THEN BE SURE to close the document! Otherwise, you end up with an insivible document left open in the office. Because it is invisible, the user is unable to close it.
_________________
Want to make OOo Drawings like the colored flower design to the left?
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