Drucken in PDF

Von Ausgaben mit der Gra-Engine über Generatoren bis zum Export in diversen Formaten

Moderator: Moderatoren

Antworten
Benutzeravatar
Rolf Ramacher
Der Entwickler von "Deep Thought"
Der Entwickler von "Deep Thought"
Beiträge: 1930
Registriert: Do, 09. Nov 2006 10:33
Wohnort: Bergheim
Danksagung erhalten: 3 Mal
Kontaktdaten:

Drucken in PDF

Beitrag von Rolf Ramacher »

Hallo zuzammen

eine frage ist es möglich eine erzeugte RTF-Datei direkt auch als PDF-Dokument zu erzeugen, ohne über den Drucker-treiber PDF-Creator zu gehen ?
wenn ja - wie ?
Gruß Rolf

Mitglied der Gruppe XUG-Cologne
www.xug-cologne.de
Benutzeravatar
brandelh
Foren-Moderator
Foren-Moderator
Beiträge: 15688
Registriert: Mo, 23. Jan 2006 20:54
Wohnort: Germersheim
Hat sich bedankt: 65 Mal
Danksagung erhalten: 33 Mal
Kontaktdaten:

Re: Drucken in PDF

Beitrag von brandelh »

Das kommt darauf an.

Wenn du NUR Text hast, könnte man das ohne fremde Hilfsmittel mit Fleiß umbauen (es gibt Beispiele in Pascal und Basic die sowas einfaches machen).

ABER viel mehr Leistung und viel einfacher ist es eine fertige Xbase++ Lösung zu nutzen.
Es gibt derer 2 (3) ...

1. XppPDF :arrow: Xbase++ PDF Class von Edgar Borger (Email : softsupply@terra.commbr ) - einfach und schnell
2. HBPrintPDF :arrow: Meine Klasse in Verbindung mit QuickPDF ... kann alles, aber ist auch komplexer und teurer (QuickPDF)
3. Man könnte den HBPrintPDF Quellcode auf die freie QuickPDF Version beschränken, aber ich mache das nicht ;-)

Mit 2. kann man alle möglichen und Denkbaren Manipulationen in PDFs vornehmen. Ich z.B. teile ein großes auf in Kapitel, korrigiere Sprungadressen und Lesezeichen etc.
Gruß
Hubert
Benutzeravatar
Wolfgang Ciriack
Der Entwickler von "Deep Thought"
Der Entwickler von "Deep Thought"
Beiträge: 2932
Registriert: Sa, 24. Sep 2005 9:37
Wohnort: Berlin
Hat sich bedankt: 13 Mal
Danksagung erhalten: 34 Mal
Kontaktdaten:

Re: Drucken in PDF

Beitrag von Wolfgang Ciriack »

Du könntest die Datei in Word öffnen und als PDF speichern:

Code: Alles auswählen

******************************************************************
// Enumeration WdSaveFormat
#DEFINE wdFormatDocument                 0        && Microsoft Office Word format.
#DEFINE wdFormatDocument97               0        && Microsoft Word 97 document format.
#DEFINE wdFormatTemplate                 1        && Word template format.
#DEFINE wdFormatTemplate97               1        && Word 97 template format.
#DEFINE wdFormatText                     2        && Microsoft Windows text format.
#DEFINE wdFormatTextLineBreaks           3        && Windows text format with line breaks preserved.
#DEFINE wdFormatDOSText                  4        && Microsoft DOS text format.
#DEFINE wdFormatDOSTextLineBreaks        5        && Microsoft DOS text with line breaks preserved.
#DEFINE wdFormatRTF                      6        && Rich text format (RTF).
#DEFINE wdFormatEncodedText              7        && Encoded text format.
#DEFINE wdFormatUnicodeText              7        && Unicode text format.
#DEFINE wdFormatHTML                     8        && Standard HTML format.
#DEFINE wdFormatWebArchive               9        && Web archive format.
#DEFINE wdFormatFilteredHTML            10        && Filtered HTML format.
#DEFINE wdFormatXML                     11        && Extensible Markup Language (XML) format.
#DEFINE wdFormatXMLDocument             12        && XML document format.
#DEFINE wdFormatXMLDocumentMacroEnabled 13        && XML document format with macros enabled.
#DEFINE wdFormatXMLTemplate             14        && XML template format.
#DEFINE wdFormatXMLTemplateMacroEnabled 15        && XML template format with macros enabled.
#DEFINE wdFormatDocumentDefault         16        && Word default document file format. For Microsoft Office Word 2007, this is the DOCX format.
#DEFINE wdFormatPDF                     17        && PDF format.
#DEFINE wdFormatXPS                     18        && XPS format.
// Enumeration WdExportFormat
#DEFINE wdExportFormatPDF               17        && Export document into PDF format.
#DEFINE wdExportFormatXPS               18        && Export document into XML Paper Specification (XPS) format.
******** Excel
#define xlTypePDF                        0
******************************************************************
function ConvToPDF(datei)
local retw:="", oWord, oDoc, oExcel, oWorkBook
local cSaveFile

cSaveFile:=substr(datei, rat( '\', datei)+1)
cSaveFile:=Left(cSaveFile, rat( '.', cSaveFile))+"PDF"

if ".DOC" $ upper(datei)
   oWord := CreateObject( 'Word.Application' )
   if !empty(oWord)
      oWord:visible := .F.
      ** Dokument schreibgeschtzt öffnen, falls in Bearbeitung
      oWord:documents:open(datei,.F.,.T.)
      oDoc:=oWord:ActiveDocument
      oDoc:saveas( cSaveFile, wdFormatPDF )
      oDoc:close()
      oWord:Quit()
      oWord:destroy()
      retw:=cSavefile
   endif
elseif ".XLS" $ upper(datei)
   oExcel := CreateObject( 'Excel.Application' )
   if !empty(oExcel)
      oExcel:visible := .F.
      oExcel:Application:DisplayAlerts:=.F.
      ** Dokument schreibgeschützt öffnen, falls in Bearbeitung
      oWorkBook:=oExcel:workbooks:open(datei,,.T.)
      oWorkBook:ExportAsFixedFormat(xlTypePDF,cSaveFile)
      oExcel:Quit()
      oExcel:Destroy()
      oExcel:=nil
      retw:=cSavefile
   endif
endif
return retw
Viele Grüße
Wolfgang
Benutzeravatar
Tom
Der Entwickler von "Deep Thought"
Der Entwickler von "Deep Thought"
Beiträge: 9343
Registriert: Do, 22. Sep 2005 23:11
Wohnort: Berlin
Hat sich bedankt: 100 Mal
Danksagung erhalten: 358 Mal
Kontaktdaten:

Re: Drucken in PDF

Beitrag von Tom »

Die PDF-Spezifikationen sind etwas komplizierter als die RTF-Spezifikationen. :wink:

Ich benutze hierfür drei Tools:

TX Text Control kann fast jeden Text in alle möglichen Formate konvertieren - HTML, DOC(x), PDF u.v.a.m. Ich verwende TX Text Control als AX-Komponente.

List & Label kann entstandene Dokumente über das Storage-System ebenfalls in viele Formate konvertieren. Ein RTF-Text, der auf einem Formular platziert wurde, kann auf diese Weise sehr leicht in ein PDF umgewandelt werden. Das sind zwei Zeilen Code.

Der VS PDF-Viewer, den ich ebenfalls als Komponente verwendet, kann Office-Dokumente einlesen und dabei in PDF konvertieren.

Außerdem ist das hier möglicherweise interessant:

https://de.wikipedia.org/wiki/Liste_von_PDF-Software

PDF direkt zu schreiben, wie man das mit RTF machen kann, ist so gut wie unmöglich.
Herzlich,
Tom
Antworten