Hi
Can anyone has modified rpreview.prg to capture emf files and send them to IMAGE2PDF .
I need to create a PDF from Preview and automatically gives it a path and Name
Best regards
Hi
Can anyone has modified rpreview.prg to capture emf files and send them to IMAGE2PDF .
I need to create a PDF from Preview and automatically gives it a path and Name
Best regards
DEFINE BUTTON RESOURCE "ACROBAT" OF oBar GROUP ;
MESSAGE "Crea PDF" ;
ACTION SavePDF( ::oDevice ) ;
TOOLTIP "Crea PDF"
...
...
Function SavePdf( oDevice, lEmail )
LOCAL imageFilename := " "
LOCAL ix
LOCAL iErr := 0
LOCAL error
LOCAL i, hLibImg2PDF
local cPdffilename := oV:arc_dir + "TEMP\" + "WP"+DTOS(DATE())+"-"+STRTRAN( TIME(), ":", "" ) + "_" + ov:work_st + ".pdf" // "Test.pdf"
local aFiles:={}
LOCAL oMail, oFontT, cMailText
DEFAULT lEmail := .F.
IF !FILE( "image2PDF.dll" )
msgStop("MANCA FILE CREAZIONE PDF", APP_NAME )
RETURN NIL
ENDIF
aFiles := oDevice:aMeta
IF LEN( aFiles ) = 0
RETURN NIL
ENDIF
hLibImg2PDF:=LoadLib32( "image2PDF.dll")
if ValType( aFiles ) == "A"
//IF lAnd( WP_GEST_PDF, oV:nModuloWP )
//I2PDF_License("xxxxxxxxxxxxxxx")
//ELSE
I2PDF_License("DEMO")
//ENDIF
iErr := IPMeta( ) // Flag that his is a meta file
iErr := IPSize( ) // Reset the size
iErr := IPMetaAdjustText()
IF !lAnd( WP_GEST_PDF, oV:nModuloWP )
xI2PDF_BatesFormat( "Microsystem - VERSIONE DIMOSTRATIVA" )
xI2PDF_BatesLocation( 2, 2, 0 )
xI2PDF_BatesFont_Int( 30, "Times-Roman", 30, 60, 90, 1, 40, 50, 60 )
xI2PDF_BatesBackground_Int( 1, 192, 192, 192 )
ENDIF
// here, first convert the first image.
iErr := IPSetDPI(0) // Set DPI to the default for PDF's. It works better.
FOR ix := 1 TO LEN( aFiles ) // Build the pages using the array of temp files
imageFilename := aFiles[ix]
iErr := IPAddImg(imageFilename)
NEXT
better.
iErr := IPMakePDF(cPdffilename, 0, error, 40 ) // Create the PDF.
ENDIF
FreeLib32( hLibImg2PDF )
IF !EMPTY( oFontT )
oFontT:end()
ENDIF
if ! file(cPdfFileName)
Msginfo("Errore nella creazione del file PDF")
return nil
Endif
IF !lEmail
ShellExecute( ,"open",cPdfFileName,"",".\",.t. )
ELSE
cMailText := MEMOREAD( "testomail.txt" )
cMailText := IIF( EMPTY( cMailText ), " ", cMailText )
DEFINE MAIL oMAIL;
SUBJECT APP_NAME + " "; // Invio Documento: "+TIME()
TEXT cMailText + " "; // Invio Documento - "+ DTOC( DATE() )+' '+TIME()
TO oV:cEmailDefaultPDF + " ";
FILES ( cPdffilename ), cFileName( cPdfFileName ) ;
FROM USER
ACTIVATE MAIL oMail
ENDIF
RETURN NIL
*
** eof SavePDFHi Pymsoft
Tanks for your reply.
2 more things:
Can you attach the classe "MAIL "
How you put the icon in prev32.dll , You open it with what?
best regards
Buenos dias
y que libreria se debe enlazar, ya que al compilar salen funciones que no existen
desde ya gracias
to Pedro Faro:
the class mail is the standard with FWH
the icon i use is in my rc
Regards
para Patricio:
es una libreria de pago Image2PDF.dll que puedes probar gratuitamente.
Las funciones que faltan vienen en un .prg cuando descargas la dll.
http://www.utilitywarrior.com/Image-to-PDF.htm
Saludos
Gracias pedro
Funciono increible, pero sale "EVALUATION MODE",
veremos si adquerimos la licencia ![]()
Hi PymSoft
I include the Acrobat BitMap in my RC but it doesn't appear in the preview.
The icons of preview are in prev32.dll . It don't have to be in prev32.dll too.
Best regards
Saludos Colegas:
Solo tengo unas cuantas dudas...
He revisado y ya baje el archivo zip que contiene el demo de la DLL, as铆 como un archivo Image2PDF.PRG donde vienen funciones para su uso, tambien he agregado las lineas de c贸digo que se encuetran citadas anteriormente, pero, al agregar el archivo prg al proyecto y compilarlo muestra mensajes de que siguen faltando algunas funciones, me pregunto si lo estoy probando de forma equivocada.?
Y si fuera posible y si no es mucho pedir que nos muestren las funciones que faltan para poder completar esta prueba..
_HB_FUN_IPMETA
_HB_FUN_IPSIZE
_HB_FUN_IPMETAADJUSTTEXT
_HB_FUN_XI2PDF_BATESFORMAT
_HB_FUN_XI2PDF_BATESLOCATION
_HB_FUN_XI2PDF_BATESFONT_INT
_HB_FUN_XI2PDF_BATESBACKGROUND_INT
_HB_FUN_IPSETDPI
_HB_FUN_IPADDIMG
_HB_FUN_IPMAKEPDF
Saludos..
DLL32 STATIC FUNCTION I2PDF_License( code AS LPSTR) AS LONG;
PASCAL FROM "I2PDF_License" LIB "IMAGE2PDF.dll"
DLL32 STATIC FUNCTION IPMeta( ) AS LONG;
PASCAL FROM "I2PDF_MetaToNativePDF" LIB "Image2PDF.dll"
DLL32 STATIC FUNCTION IPMetaAdjustText() AS LONG;
PASCAL FROM "I2PDF_MetaTextFitBoundingRect" LIB "Image2PDF.dll"
DLL32 STATIC FUNCTION IPSize( ) AS LONG;
PASCAL FROM "I2PDF_UseEMFDeviceSize" LIB "Image2PDF.DLL"
// static unsigned int I2PDF_AddImage(char *image);
DLL32 STATIC FUNCTION IPAddImg( cImage AS LPSTR ) AS LONG;
PASCAL FROM "I2PDF_AddImage" LIB "Image2PDF.dll"
// static unsigned int I2PDF_SetDPI(unsigned int dpi);
DLL32 STATIC FUNCTION IPSetDpi( nDpi AS LONG ) AS LONG;
PASCAL FROM "I2PDF_SetDPI" LIB "Image2PDF.dll"
// static unsigned int I2PDF_MakePDF(char *output, int options, char *errorText, unsigned int maxErrorTextSize);
DLL32 STATIC FUNCTION IPMakePDF( cOutFile AS LPSTR, nOptions AS LONG, cErrTxt AS LPSTR, nMaxESize AS LONG ) AS LONG;
PASCAL FROM "I2PDF_MakePDF" LIB "Image2PDF.dll"
DLL32 FUNCTION COPYFILE( cExistName AS LPSTR, cNewName AS LPSTR, nFailIfExist AS LONG ) AS BOOL;
PASCAL FROM "CopyFileA" LIB "kernel32.dll"
DLL32 FUNCTION xI2PDF_BatesFormat( format AS LPSTR ) AS LONG;
PASCAL FROM "I2PDF_BatesFormat" LIB "Image2PDF.dll"
DLL32 FUNCTION xI2PDF_BatesLocation( verticalPosition AS LONG, horizontalPosition AS LONG, orientation AS LONG, margin AS DOUBLE) AS LONG;
PASCAL FROM "I2PDF_BatesLocation" LIB "Image2PDF.dll"
DLL32 FUNCTION xI2PDF_BatesFont_Int( iSize AS LONG, FontID AS LPSTR, fillRed AS LONG, fillGreen AS LONG, fillBlue AS LONG, iStyle AS LONG, otherRed AS LONG, otherGreen AS LONG, otherBlue AS LONG) AS LONG;
PASCAL FROM "I2PDF_BatesFont_Int" LIB "Image2PDF.dll"
DLL32 FUNCTION xI2PDF_BatesBackground_Int( shape AS LONG, bkRed AS LONG, bkGreen AS LONG, bkBlue AS LONG, borderRed AS LONG, borderGreen AS LONG, borderBlue AS LONG ) AS LONG;
PASCAL FROM "I2PDF_BatesBackground_Int" LIB "Image2PDF.dll"Saludos de nuevo:
Ok ya no muestra los mensajes de que faltan funciones, ahora me surge una duda, para que tipos de reportes funciona..?? TReport, TPrint o TTxtPrev, ya que en los reportes con TReport truena al momento de exportar a PDF, porque no reconoce la variable oDevice y por lo consiguiente oDevice:aMeta
Se ve prometedor y ojala y nos puedan dar un ejemplito practico en base a todo lo que esta expuesro aki para podernos darnos una idea del resultado que se obtiene, y talvez, aventarnos a comprar la licencia para su uso completo..
Saludos y Gracias anticipadas..
![]()
creo que funciona para todos los reportes que usen rpreview, visto que ahi fue hice los cambios.
saludos
METHOD BuildButtonBar() CLASS TPreview
..
..
IF lImage2PDF
DEFINE BUTTON RESOURCE "ACROBAT" OF oBar GROUP ;
MESSAGE "Crea PDF" ;
ACTION SavePDF( ::oDevice ) ;
TOOLTIP "Crea PDF"
DEFINE BUTTON RESOURCE "SENDMAIL" OF oBar ;
MESSAGE "Invia per Email" ;
ACTION SavePDF( ::oDevice, .T. ) ; // ::Zoom() ;
TOOLTIP "Invia per Email"
ENDIF
..IF lAnd( WP_GEST_PDF, oV:nModuloWP )
//I2PDF_License("xxxxxxxxxxxxxxx")
ELSE
msginfo("Poniendo Licencia")
I2PDF_License("DEMO") // aki truena por Error de protecci贸n general.-
msginfo("Licencia en Demo Ok")
ENDIF
Victor, espero te sirvan estos comentarios.
Al descargar Image2PDF se obtienen dos DLLs, Image2PDF.Dll que al usarla genera GPFs, renombra y usa Image2PDF StdCall.Dll.
Agregu茅 a RPreview el c贸digo de la funci贸n SavePDF() y las DLL32 publicadas, despues de algunas compilaciones todo funciona.
No hago p煤blico el c贸dogo de RPreview porque la tengo totalmente modificada a mis necesidades, con lo que expuso Pedo me fue suficiente.
Gracias Pedro.
Solo me falta adquirir la licencia y listo!