How to Convert RTF to PDF
How to Convert RTF to PDF
Guys,
Do you know some way to convert RTF files to PDF files without open them ?
Do you know some way to convert RTF files to PDF files without open them ?
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: How to Convert RTF to PDF
Vilian
Have a look at TRichEdit5 class ( triched5.prg in \samples\classes ) METHOD SaveToPDF( cName, cFile, lView ).
Rick Lipkin
Have a look at TRichEdit5 class ( triched5.prg in \samples\classes ) METHOD SaveToPDF( cName, cFile, lView ).
Rick Lipkin
Re: How to Convert RTF to PDF
Yes, but function used for print need ::hWnd of controlRick Lipkin wrote:Vilian
Have a look at TRichEdit5 class ( triched5.prg in \samples\classes ) METHOD SaveToPDF( cName, cFile, lView ).
Rick Lipkin
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Re: How to Convert RTF to PDF
Thank You guys, I will try.
Re: How to Convert RTF to PDF
Create and hide control ?
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Re: How to Convert RTF to PDF
Yes, I will try using something like this
- RAMESHBABU
- Posts: 591
- Joined: Fri Oct 21, 2005 5:54 am
- Location: Secunderabad (T.S), India
Re: How to Convert RTF to PDF
Dear Cristobal,
I have a problem with the oRTF:SaveToPdf(...) Method of TRichEdit5 Class.
It is creating the PDF, but the contents of the PDF File are blurry and not
readable as shown in the picture here.
Pleease help me.
Regards,
-Ramesh Babu P
I have a problem with the oRTF:SaveToPdf(...) Method of TRichEdit5 Class.
It is creating the PDF, but the contents of the PDF File are blurry and not
readable as shown in the picture here.
Pleease help me.
Regards,
-Ramesh Babu P
Re: How to Convert RTF to PDF
Dear Ramesh
The image is not visible.
Please put your image or send me your file pdf
The image is not visible.
Please put your image or send me your file pdf
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
- RAMESHBABU
- Posts: 591
- Joined: Fri Oct 21, 2005 5:54 am
- Location: Secunderabad (T.S), India
Re: How to Convert RTF to PDF
Dear Cristobal,
The image I have posted above is the exact PDF generated
using the "TESTRTF5.PRG" under FWH\Samples.
The Menu Path used to generated the PDF is "File -> To RTF".
And the RTF file is "TESTRTF.RTF"
You can try it yourself.
Regards,
-Ramesh Babu P
The image I have posted above is the exact PDF generated
using the "TESTRTF5.PRG" under FWH\Samples.
The Menu Path used to generated the PDF is "File -> To RTF".
And the RTF file is "TESTRTF.RTF"
You can try it yourself.
Regards,
-Ramesh Babu P
Re: How to Convert RTF to PDF
Dear Ramesh
For me it's OK
Please put or send me your pdf
For me it's OK
Please put or send me your pdf
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: How to Convert RTF to PDF
This is an attempt to use RichEdit5 control to silently convert RTF to PDF without displaying the control.cnavarro wrote:Create and hide control ?
Code: Select all
#include "fivewin.ch"
function Main()
local oWnd, oBar
DEFINE WINDOW oWnd TITLE "MY APPLICATION"
DEFINE BUTTONBAR oBar OF oWnd SIZE 100,32 2010
DEFINE BUTTON OF oBar PROMPT "RTFTOPDF" ;
ACTION RTFTOPDF( "c:\fwh\samples\fiveodbc.rtf" )
ACTIVATE WINDOW oWnd CENTERED
return nil
static function RTFTOPDF( cRTF, cPDF, lOpen )
local oWnd, oRtf, cTxt := ""
if Empty( cRtf ) .or. !File( cRTF ) .or. Lower( cFileExt( cRtf ) ) != "rtf"
return .f.
endif
DEFAULT cPDF := cRTF, lOpen := .t.
cPDF := cFileSetExt( cPDF, "pdf" )
FErase( cPDF )
DEFINE WINDOW oWnd
@ 0,0 RICHEDIT5 oRtf VAR cTxt OF oWnd FILE cRTF
oWnd:oClient := oRtf
ACTIVATE WINDOW oWnd HIDDEN ON INIT ;
( oRtf:SaveToPDF( cFileNoExt( cPdf ), cPDF, lOpen ), oWnd:End() )
return File( cPDF )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- ricbarraes
- Posts: 49
- Joined: Tue Jun 30, 2015 2:26 am
- Location: Brazil
Re: How to Convert RTF to PDF
Hello everyone,
I'm trying to convert a RTF file into a PDF File. I already tried all your code suggestions and it now I'm able to preview it.
Everything works, except that I got some tables in the RTF File, and I don't know why the convertion to PDF is affecting the columns alignment.
Does anybody know what's happening?
I'm trying to convert a RTF file into a PDF File. I already tried all your code suggestions and it now I'm able to preview it.
Everything works, except that I got some tables in the RTF File, and I don't know why the convertion to PDF is affecting the columns alignment.
Does anybody know what's happening?
Code: Select all
RtfToPdf(cNovo)
FUNCTION RtfToPdf( cRTF, cPDF, lOpen )
LOCAL oWnd, oRtf, cTxt := ""
IF Empty( cRtf ) .or. !File( cRTF ) .or. Lower( cFileExt( cRtf ) ) != "rtf"
return .f.
ENDIF
DEFAULT cPDF := cRTF, lOpen := .t.
cPDF := cFileSetExt( cPDF, "pdf" )
FErase( cPDF )
DEFINE WINDOW oWnd
@ 0,0 RICHEDIT5 oRtf VAR cTxt OF oWnd FILE cRTF
oWnd:oClient := oRtf
ACTIVATE WINDOW oWnd HIDDEN ON INIT ;
( oRtf:SaveToPDF( cFileNoExt( cPdf ), cPDF, lOpen ), oWnd:End() )
RETURN File( cPDF )
METHOD SaveToPDF( cName, cFile, lView ) CLASS TRichEdit5
local aMargins := PageGetMargins()
local nLen := ::Len()
local nPrint := 0
local oPrn
//local aPrinters := aGetPrinters()
?::cFileName,cFileNoExt( ::cFileName ) + ".pdf", cName, cFile
DEFAULT cName := cFileNoExt( ::cFileName ) + " Report" //"FWH RichEdit Report"
DEFAULT cFile := cFileNoExt( ::cFileName ) + ".pdf"
DEFAULT lView := .F.
if ::IsSelection()
nPrint := ::GetPos()
nLen := ::GetSelection()[ 2 ] - nPrint
//? nPrint, ::GetSelection()[ 2 ], nLen
endif
if !Empty( cFile )
if lView
PRINT oPrn NAME cName PREVIEW FILE cFile
else
PRINT oPrn NAME cName FILE cFile
endif
if Empty( oPrn:hDC )
MsgStop( "Printer not ready!" )
return nil
endif
CursorWait()
AEval( aMargins, { | x, y | aMargins[ y ] := x * 1440 / 2540 } )
do while nPrint < nLen
PAGE
nPrint := REPreview5( ::hWnd, oPrn:hDC, oPrn:hDCOut, aMargins, nPrint )
ENDPAGE
enddo
CursorArrow()
ENDPRINT
else
MsgStop( "Not file name is implemented", "Error" )
endif
return nil