PDF CONVERTIR

HMG en Español

Moderator: Rathinagiri

User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

PDF CONVERTIR

Post by SALINETAS24 »

Hola a todos, hay alguna manera de convertir un formato .RTF a formato .PDF..?
Muchas gracias y vamos con la cervecita...
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: PDF CONVERTIR

Post by serge_girard »

I use 'Doxillion Document Converter'. It can be called by your HMG program.
Just create a batch file which will do the conversion, execute it, then comes in the trick: wait until conversion job is done (successfull - error - ..), read the logging to see the result.

Serge
There's nothing you can do that can't be done...
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: PDF CONVERTIR

Post by SALINETAS24 »

Muchas gracias Serge.
Lo tengo en cuenta y veré de implementarlo.
Para ti una copa de buen vino... :lol:
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: PDF CONVERTIR

Post by andyglezl »

Quizá de esta forma... (No lo he probado)
*----------------------------------
Maybe in this way ... (I have not tried it)

Code: Select all

@ 010, 010 RICHEDITBOX EDB_01 WIDTH 580 HEIGHT 400 VALUE "" 
...............
Form_1.EDB_01.RTFLoadFile( "MiRTF.rtf", 4, .F.)
...............
SELECT PRINTER PDF 'MiPDF.pdf' TO lSuccess 
	IF lSuccess
		START PRINTDOC
			START PRINTPAGE
				Form_1.EDB_01
			END PRINTPAGE
		END PRINTDOC
		EXECUTE FILE 'MiPDF.PDF'
	ENDIF
Andrés González López
Desde Guadalajara, Jalisco. México.
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: PDF CONVERTIR

Post by EduardoLuis »

Hi Salinetas:

Take a look at procedure "V_PRINT" on Miniwriter sample, you'll get a preview of rtf and if you press "save button", you'll get the chance to generate a PDF file with the content you are previsualizing.
Hope this helps you.
Regards
Eduardo

Hola Salinetas:

Hechale una vista al procedure "V_PRINT" que tienes en el sample MINIWRITER, allí obtendras el acceso al preview del rtf y si presiona el boton "SAVE", tendrás la opción de generar un archivo pdf.
Espero te sirva de ayuda.
Cordialmente
Eduardo
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: PDF CONVERTIR

Post by SALINETAS24 »

Hola y gracias por responder.
Es más o menos lo que busco, pero el problema es que en los procesos que indicáis "V_PRINT" tiene que intervenir el usuario, seleccionando y grabando, y lo que me gustaría es que se obviase esa intervención.., que se generase en PDF sin necesidad de seleccionar la impresora y grabar, evitando que estos dos pasos.
Agradecido de antemano.., vamos con una cervecita
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
PeteWG
Posts: 176
Joined: Sun Mar 21, 2010 5:45 pm

Re: PDF CONVERTIR

Post by PeteWG »

In case you have LibreOffice or OpenOffice installed (if not, install it, it's the best for the (no)money it costs! ;) )
you can convert (export) quite easily any supported file to a PDF, by just calling soffice.exe from command line.

here is the generic syntax:
%LibreOfficeInstallationPath%\soffice.exe --headless --convert-to pdf[:calc/writer/draw/_pdf_Export] <sourceFile> [--outdir x:\destinationDir]

- example (xls convert/export):
"C:\Program Files\LibreOffice\program\soffice.exe" --headless --convert-to pdf:calc_pdf_Export mySheet.xls --outdir x:\temp
this will create <mySheet.pdf> and put it into x:\temp

- example (rtf convert/export):
"C:\Program Files\LibreOffice\program\soffice.exe" --headless --convert-to pdf:writer_pdf_Export myRTF.rtf --outdir x:\temp
this will create <myRTF.pdf> inside x:\temp

And of course, you can always execute this command line from your application (hb_Run() etc.)

PS: alternatively you can use win_Ole***() but that's another more complicated
(but more flexible in terms of output configuration etc) story.

regards,
Pete
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: PDF CONVERTIR

Post by andyglezl »

Hola

No he tenido tiempo de revisar a fondo esta prueba,
les dejo el ejemplo por si alguien le quiere seguir.
*---------------------------------------------------------------------
Hello

I have not had time to thoroughly review this test,
I leave the example in case someone wants to follow him.

RTF2PDF.rar
(2.3 KiB) Downloaded 179 times

De esta otra forma, habría que ver como evitar el dialogo de PREVIEW
*-----------------------------------------------------------------------------------------
In this other way, we should see how to avoid the PREVIEW dialogue

Code: Select all

/*_______________________________________________________________________________________________________*/
/*[•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•]*/
/*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯*/
#include "hmg.ch"

FUNCTION Main() 

		DEFINE WINDOW xForm AT 000,000 WIDTH 800 HEIGHT 600 MAIN TITLE "GRABA a PDF" BACKCOLOR { 51, 156, 255 } 

			@ 005,010 BUTTON LB_Tx  OF xForm CAPTION "Covertir RTF a PDF"  WIDTH 250 HEIGHT 22 FONT "Consolas" SIZE 12  ;
					  ACTION PrintREB(  ) 
	
			@ 030, 000 RICHEDITBOX EDB_x WIDTH 800 HEIGHT 570 VALUE ""
			xForm.EDB_x.RTFTextMode := .T. 

		END WINDOW
		CENTER WINDOW xForm  
		ACTIVATE WINDOW xForm
RETURN Nil	   
**********************************************************
FUNCTION PrintREB(  )
	LOCAL lSuccess, nRow := 55, nCol := 70, nPag := 0, PrintPageCodeBlock := { || @ nRow , nCol PRINT "Pag. " + HB_NTOS( nPag++ ) CENTER }

	*SELECT PRINTER PDF 'MiPDF.pdf' TO lSuccess
	SELECT PRINTER DEFAULT TO lSuccess SAVEAS "MiPDF.PDF"
	IF lSuccess
		xForm.EDB_x.RTFLoadFile( "Lorem Ipsum.rtf", 4, .F.)
		*START PRINTDOC
		*	START PRINTPAGE
		*		@ 0,0 PRINT xForm.EDB_x.Value
		*	END PRINTPAGE
		*END PRINTDOC
		xForm.EDB_x.RTFPrint( { 0, -1 } , 20 , 20 , 20 , 20 , PrintPageCodeBlock )
		
		HMG_PressKey( VK_CONTROL+VK_S, VK_ALT+VK_G, VK_CONTROL+VK_C, VK_ALT+VK_F4 )
		
		
		EXECUTE FILE 'MiPDF.PDF'
	ENDIF
RETURN nil
Andrés González López
Desde Guadalajara, Jalisco. México.
Post Reply