Jump to content
Fivewin Brasil

Onde encontro? FWSavePreviewToPDF


joaosolution

Recommended Posts

João

Já havia pesquisado no google.

Obrigado, mas em nenhum desses tópicos me informou onde baixar a função, ou em qual lib a mesma se encontra ou se está disponível em uma versão mais nova da FW.

Att

João Bosco

foto.jpg

Contagem/MG

FWH 10.6b xHb 1.2.1 WorkShop 4.5

PellesC SQLLIB SQLRDD xDev MySql MS-Sql

Link to comment
Share on other sites

Olá, amigo.

Na RPreview inclua a função abaixo e crie um botão para acioná-la. Uso com 100% de sucesso. Você vai precisar também da "Image2PDF StdCall.DLL"


//----------------------------------------------------------------------------//

Function Img2Pdf(aFiles)

LOCAL ImageFileName := " ", ix, iErr := 0, ErrorText := " "

Local cString

Local cDestino := CurDrive()+":\"+GetCurDir()+"PDF" + StrTran(TIME(),":","") + ".pdf"

Local cFile := ""

Local x:=0

Local cTexto:=""

LOCAL cLicCod := SPACE(35) // Requerer o código de licença de uso da Image2Pdf

cLicCod := GetPvProfString( "IMPRESSAO", "Image2PdfCode", "IPD-BB3Z-SF6BZ-MB0T8K-00V66XC", ALLTRIM(cPasta)+"\CONFIG.INI") // "IPD-BB3Z-SF6BZ-MB0T8K-00V66XC"

IF EMPTY(cLicCod)

IF MsgGet("Código de licença de Image2Pdf.dll","Código de licença de Image2Pdf.dll",@cLicCod)

WritePProString( "IMPRESSAO", "Image2PdfCode", ALLTRIM(cLicCod), ALLTRIM(cPasta)+"\CONFIG.INI")

ENDIF

ENDIF

IF EMPTY(cLicCod)

cLicCod := "VERSAO_TRIAL"

ENDIF

cFile := cGetFile("Arquivo PDF (*.pdf) | *.pdf |","Salvar como...", NIL, nil, .T., .T. )

IF EMPTY(cFile)

RETURN NIL

ENDIF

cFile := LOWER(STRTRAN(UPPER(cFile+".PDF"), ".PDF.PDF", ".pdf"))

If Len(aFiles) > 0

// Lembrando q. a dll tem q. estar no raiz do seu sistema

hLib := LoadLib32( ".\dll32\Image2PDF StdCall.DLL" )

iErr := I2PDF_License( ALLTRIM(cLicCod) )

// ensure that any EMF files are converted at highest quality

iErr := I2PDF_MetaToNativePDF( )

iErr := I2PDF_UseEMFDeviceSize( )

iErr := I2PDF_SetDPI(300) // Set PDF DPI to the same as the image

// Build the pages using the array of image files

FOR ix := 1 TO LEN( aFiles )

ImageFileName := aFiles[ix]

IF (iErr := I2PDF_AddImage(ImageFileName)) # 0

EXIT

ENDIF

NEXT

// Create the PDF.

iErr := I2PDF_MakePDF(Rtrim(cFile), 0, ErrorText, 40 )

IF (iErr := I2PDF_AddImage(ImageFileName)) = 0

nOption := ALERT("PDF gerado com sucesso. O que deseja fazer?",{"&1=Visualizar", "&2=Enviar e-mail"},"PDF criado",1,32515)

if nOption = 1

MsgRun("Abrindo o documento. Aguarde...","Abrindo o documento. Aguarde...",{||WebBrowser(cFile,.t.)})

elseif nOption = 2

_Subj := "Relatório anexo"

_Msge := "Prezado cliente,"+CRLF+CRLF+;

"Anexo a este e-mail voce esta recebendo o arquivo "+cFileName(cFile)+;

". Para maiores esclarecimentos, favor nos catactar."+CRLF+CRLF+ALLTRIM(mEmp)

MailMain(SPACE(60), _Subj, _Msge, cFile)

endif

ENDIF

FreeLib32( hLib )

Endif

Return Nil

// DLL API proptotypes (declarações)

DLL32 STATIC FUNCTION I2PDF_License( cLicCode AS LPSTR) AS LONG;

PASCAL FROM "I2PDF_License" LIB hLib

DLL32 STATIC FUNCTION I2PDF_MetaToNativePDF( ) AS LONG;

PASCAL FROM "I2PDF_MetaToNativePDF" LIB hLib

DLL32 STATIC FUNCTION I2PDF_UseEMFDeviceSize( ) AS LONG;

PASCAL FROM "I2PDF_UseEMFDeviceSize" LIB hLib

DLL32 STATIC FUNCTION I2PDF_AddImage( cImage AS LPSTR ) AS LONG;

PASCAL FROM "I2PDF_AddImage" LIB hLib

DLL32 STATIC FUNCTION I2PDF_SetDPI( nDpi AS LONG ) AS LONG;

PASCAL FROM "I2PDF_SetDPI" LIB hLib

DLL32 STATIC FUNCTION I2PDF_MakePDF( cOutFile AS LPSTR, nOptions AS LONG, cErrTxt AS LPSTR, nMaxESize AS LONG ) AS LONG;

PASCAL FROM "I2PDF_MakePDF" LIB hLib

id=code>id=code>

ariston.jpg

Conheça o http://www.arsoft-ap.com.br

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...