Post reply

Message icon:


shortcuts: hit alt+s to submit/post or alt+p to preview

Topic Summary

Posted by: gavind
« on: June 06, 2012, 11:20:43 PM »

I agree. I use Openoffice.
Posted by: LukeV
« on: April 05, 2012, 12:24:22 AM »

You are correct as normal. OpenOffice is running hidden while LibreOffice doesn't.
Posted by: RTT
« on: April 04, 2012, 07:38:29 PM »

Is there any way of running OO/LO in headless mode via the script, so it doesn't show up on the toolbar?
That's what the next line is supposed to do.
      Set OpenParam(0) = MakePropertyValue("Hidden", True)  ' Open the file hidden
In here, with OOo, it's working. The conversion is made without you even realize, except for the disk activity, any program has been called. Completely hidden.
Maybe the LO changed something related to this. You have the two installed, so try to use the OOo instead. You probably need to change the path at this registry key

      32-bit Windows
      64-bit Windows

to point to where you have the related OOo file installed.
Posted by: LukeV
« on: April 04, 2012, 01:20:59 AM »

I can't my script working now either :P
I did have it working last week. Seems my method of getting the file path isn't working now. You also had to set the folder with soffice in it in your PATH.

In any case, your script is a much better approach and makes my attempt seem feeble  :-[

On my PC it opens up with LibreOffice and works, even though I have OpenOffice and LibreOffice installed.
Apparently LibreOffice converts the files with a bit more accuracy.

Is there any way of running OO/LO in headless mode via the script, so it doesn't show up on the toolbar?

Posted by: RTT
« on: March 29, 2012, 03:54:49 PM »

Can't make that command line work here, so can't test possible solutions to accomplish that.
But I was talking about the more powerful COM Automation.
I digged a bit about this subject, and I coded this little script in VBScript.
Code: [Select]
Option Explicit

Sub SaveAsPDF(filename)
' ********************************
' Save an existing document as PDF
' ********************************
Dim oDoc
Dim OpenParam(0)
Dim SaveParam(0)
Dim sUrl

Set OpenParam(0) = MakePropertyValue("Hidden", True)  ' Open the file hidden
sURL = "file:///" & Replace(filename, "\" , "/")
Set oDoc = oDesk.loadComponentFromURL(sURL, "_blank", 0, OpenParam)

set SaveParam(0) = MakePropertyValue("FilterName", "writer_pdf_Export")
sURL = left(sURL,InStrRev(sURL,"."))+"pdf"
Call oDoc.storeToURL(sURL, SaveParam)

Set oDoc = Nothing
End Sub

Public Function MakePropertyValue(cName, uValue)
Dim oStruct
    Set oStruct = oSM.Bridge_GetStruct("")
    oStruct.Name = cName
    oStruct.Value = uValue
    Set MakePropertyValue = oStruct
End Function

Dim oSM, oDesk
Set oSM = CreateObject("")
Set oDesk = oSM.createInstance("")

Dim i
for i=0 to WScript.Arguments.count-1               

Just place it in a .vbs file, in the "send to" folder, and you have now a powerful toPDF converter, that's able to convert any of the file formats the OOo Writer can read, into the PDF format ;)
This uses the OOo ActiveX control, so make sure you install it when installing the OpenOffice.
I just tested it with the, so I have no idea if it also works with LibreOffice.
Posted by: LukeV
« on: March 29, 2012, 01:02:20 AM »

So I took your advise.
I went with LibreOffice and came up with the following in a batch file, which I have in my Send To folder:

ECHO off
cd %~p1
soffice -headless -convert-to PDF %1

I'm now just trying to get it to be able to run on multiple selected files. Unfortunately, you can't use "/folder/*.doc" as the -convert-to doesn't allow wildcards in Windows :(
The only way I can see would be a loop in the batch, with a pause to wait for each conversion to take place.
Posted by: LukeV
« on: March 25, 2012, 11:30:33 PM »

Thanks for the response. I thought this might be the case, but thought I'd ask just in case there was a way.

I'll have a look into the Open Office Writer idea though ;) Thanks!
Posted by: RTT
« on: March 23, 2012, 07:53:09 PM »

Hi Luke,
Such a tool is by itself a big project.
A direct Doc to PDF can only be done by a tool that fully understand, and correctly renders, the format, so the best approach is definitively the print to PDF solution. Such tools usually automate (or require user intervention) the MS Word or Word Previewer, to print to the postscript format (using a postscript printer driver), and then use a postscript to PDF converter, such as the AFL-GhostScript. Even the Adobe Acrobat tools use this method, complemented by additional processing to add hyperlinks, bookmarks, etc..
I could use such methods in PDF-ShellTools, but using third party solutions is not the spirit of the tools, so that's something not workable right now.

The Open Office Writer is able to do a direct conversion, so you can use it to open a .doc and then export it to a PDF. And this tool can be automated, so I suppose you can easily create a script and add it to the Shell context menu. ;)

Posted by: LukeV
« on: March 23, 2012, 01:40:24 AM »

Hi Rui,

Not sure if this is at all possible, put a great feature would be turning DOC files into PDF's, like you have for the JPG files.
I imagine it is probably not possible, as pictures can just be embedded in but DOC's would almost need to be printed to a PDF.