DOCs in PDF konvertieren [gelöst]

Antwort erstellen


BBCode ist eingeschaltet
[img] ist ausgeschaltet
[url] ist eingeschaltet
Smileys sind ausgeschaltet

Die letzten Beiträge des Themas
   

Ansicht erweitern Die letzten Beiträge des Themas: DOCs in PDF konvertieren [gelöst]

Re: DOCs in PDF konvertieren [gelöst]

von SteffCN » Di, 15.03.2011 16:08

Danke für die Tipps :-)

Nun läuft alles !

Gruß
Steff

Re: DOCs in PDF konvertieren

von hol.sten » Di, 15.03.2011 13:22

SteffCN hat geschrieben:Jetzt muß ich nur noch rausfinden, wie man das Verzeichnis mit den DOCs abarbeitet.
(Doc öffnen, umwandeln, weg bewegen, nächste Doc öffnen... usw.)
Dann schau doch einfach in den Abschnitt Files and directories im Kapitel 3 The Runtime Library of StarOffice Basic des StarOffice 8 Programming Guide for BASIC: http://download.oracle.com/docs/cd/E195 ... index.html.

Leider gibt es das Dokument für Oracle Open Office 3 nicht, aber an OOo Basic ht sich über die Jahre nicht so viel getan. Die Dokumentation sollte also noch passen.

Re: DOCs in PDF konvertieren

von SteffCN » Di, 15.03.2011 12:57

hol.sten hat geschrieben:Schau dir mal diesen Thread an: http://www.oooforum.org/forum/viewtopic ... ourl+basic
Danke hol.sten,
das hilft doch schon mal weiter :-)

Jetzt muß ich nur noch rausfinden, wie man das Verzeichnis mit den DOCs abarbeitet.
(Doc öffnen, umwandeln, weg bewegen, nächste Doc öffnen... usw.)

Gruß aus Hamburg
Steff

-Holsten knallt am dollsten-

Re: DOCs in PDF konvertieren

von hol.sten » Di, 15.03.2011 11:25

Schau dir mal diesen Thread an: http://www.oooforum.org/forum/viewtopic ... ourl+basic

Dort findest du u. a. ein paar Zeilen OOo Basic Code, um ein Dokument als PDF zu speichern:

Code: Alles auswählen

...
rem ----------------------------------------------------------------------
rem - Export PDF
dim pdfProperties(1) as new com.sun.star.beans.PropertyValue
pdfProperties(0).Name = "FilterName"
pdfProperties(0).Value = "writer_pdf_Export"
document.storeToURL(pdfurl, pdfProperties())
...
Ich verwende immer OOo Basic Methoden, wenn sie denn vorhanden sind, anstatt den Dispatcher zu bemühen.

Re: DOCs in PDF konvertieren

von SteffCN » Di, 15.03.2011 11:06

komma4 hat geschrieben: Tipp 2:
...
(ooomacros momentan down)
Danke Winfried für deine Antwort :-)

Weißt du zufällig, ob die Seite irgendwann wieder ONLINE ist
bzw. was ich machen muß, um das Problem des Tipps 1 zu beseitigen ?

Gruß
Steff

Re: DOCs in PDF konvertieren

von komma4 » Di, 15.03.2011 10:48

Tipp 1:

Der dispatcher arbeitet mit dem FRAME-Objekt, nicht mit einem Document-Objekt (s. auskommentierte Zeile)


Tipp 2:

Es gibt bereit zahllose Konverter... erfinde das Rad nicht neu.
Bspw.
http://wiki.services.openoffice.org/wik ... _to_PDF%3F

(ooomacros momentan down)

DOCs in PDF konvertieren [gelöst]

von SteffCN » Di, 15.03.2011 10:20

Hallo,
auch ich komme von VBA und verstand die 'VBA-Sprache' mittlerweile ganz gut.
Aber das OOo-Basic ist ja eine ganz andere Welt :shock:

Ich möchte die Word-Dokumente eines Ordners öffnen und dann in PDFs umwandeln.

Bis jetzt hänge ich an dem folgenden Problem:

Code: Alles auswählen

Sub Main
Dim oDoc as Object
Dim Filepath as String
Dim DirPath as String
Dim DirPath_1 as String
Dim OpenFile as String
dim document   as object
dim dispatcher as object

Dim NewWorkbook as Object
Dim NoArgs()

document  = StarDesktop.loadComponentFromURL(ConvertToURL("C:/LibreOfficePortable/KAZ.doc"),"_blank",0 ,NoArgs())
'document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "URL"
args1(0).Value = "file:///C:/LibreOfficePortable/test.pdf"
args1(1).Name = "FilterName"
args1(1).Value = "writer_pdf_Export"
args1(2).Name = "FilterData"
args1(2).Value = Array(Array("UseLosslessCompression",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Quality",0,90,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ReduceImageResolution",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("MaxImageResolution",0,300,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("UseTaggedPDF",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("SelectPdfVersion",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportNotes",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportBookmarks",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("OpenBookmarkLevels",0,-1,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("UseTransitionEffects",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("IsSkipEmptyPages",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("IsAddStream",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("FormsType",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportFormFields",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("HideViewerToolbar",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("HideViewerMenubar",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("HideViewerWindowControls",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ResizeWindowToInitialPage",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("CenterWindow",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("OpenInFullScreenMode",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("DisplayPDFDocumentTitle",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("InitialView",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Magnification",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Zoom",0,100,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PageLayout",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("FirstPageOnLeft",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("InitialPage",0,1,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Printing",0,2,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("Changes",0,4,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("EnableCopyingOfContent",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("EnableTextAccessForAccessibilityTools",0,true,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportLinksRelativeFsys",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PDFViewSelection",0,0,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ConvertOOoTargetToPDFTarget",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("ExportBookmarksToPDFDestination",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("_OkButtonString",0,"",com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("EncryptFile",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("DocumentOpenPassword",0,"",com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("RestrictPermissions",0,false,com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("PermissionPassword",0,"",com.sun.star.beans.PropertyState.DIRECT_VALUE),Array("",0,,com.sun.star.beans.PropertyState.DIRECT_VALUE))

dispatcher.executeDispatch(document, ".uno:ExportToPDF", "", 0, args1())
End Sub
Hier bekomme ich die Fehlermeldung:
>Basic-Laufzeitfehler
>Es ist eine Exception aufgetreten
>Type com.sun.star.lang.IllegalArgumentException
>Message: cannot coerce argument type during corereflection call

Das muß irgendwie mit der StarDesktop-Zeile zu tun haben.
Aber auch nach 2 Stunden im Forum lesen hab ich's nicht begriffen. :?

Vielleicht könnte mir jemand einen kleinen Tipp geben :-)

Danke & Gruß
Steff

Nach oben