FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Create and Email PDF's from FWH
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Create and Email PDF's from FWH
Posted: Tue Oct 31, 2006 01:32 AM

The question has been raised several times about being able to email a report / document, from rpreview, as a PDF. There have been some elaborate solutions proposed, but I have finished incorporating a product that works very well for this task.

Essentially, I pass the aFiles array of EMF names to this product ( it is a .DLL ), and it creates the PDF and I then simply attach it to an email. It all happens with the click of an email icon in a Preview using the .dll and pure FWH / xHarbour code.

I had an initial problem with graphic backgrounds ( grey ) but those were fixed within a couple of hours, and now the output is excellent. A special utility capability in the latest version creates PDF from EMF/WMF files that are much smaller, and it works very quickly.

If you are looking for this solution, go to www.utilitywarrior.com and check out Image2PDF, the .DLL version. The price is very reasonable ... $60 / US for a royalty free license for a single application, or $260 / US for a royalty free for an unlimited number of licenses ( one developer of course ). The support is fast, pleasant, and this is a product well worth supporting.

If you need any help implementing it, I'd be happy to provide a copy of my changes to the rpreview.prg as I've modified it. Just send me an email to timstone@masterlinksoftware.com and I'll send it by reply. I will send only the added function(s) and notes on how to implement them into your version of rpreview !

Do check this out. This is a nice person doing a good job ! :D

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
Create and Email PDF's from FWH
Posted: Tue Oct 31, 2006 02:17 AM

Support VRD /Visual report ?

Thanks !

Shuming Wang

http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
Posts: 729
Joined: Tue Oct 18, 2005 06:49 PM
Create and Email PDF's from FWH
Posted: Tue Oct 31, 2006 05:06 PM

Tim,

I agreed 100% with you.

This product is Excellent!!! and Adrian is nice and him answer quickly any question that someone could have about his product.

Regards

George

Posts: 116
Joined: Thu Oct 13, 2005 05:14 PM
Create and Email PDF's from FWH
Posted: Tue Oct 31, 2006 05:22 PM

Bought!

Excellent.

Regards.

Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Create and Email PDF's from FWH
Posted: Sat Nov 04, 2006 04:53 PM

Hi.

I also purchased the .dll version. It is excellent. My users love it.

Tim, thank you very much for the info.

Reinaldo Crespo-Bazán

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Create and Email PDF's from FWH
Posted: Tue Nov 07, 2006 09:59 AM

TImm,
can you pubblish the function to use th eimage2pdf on this forum ?

Best Regards, Saludos



Falconi Silvio
Posts: 729
Joined: Tue Oct 18, 2005 06:49 PM
Create and Email PDF's from FWH
Posted: Tue Nov 07, 2006 04:17 PM
Silvio,

These are the wrappers that I am using with image2pdf.dll

DLL32 Function I2PDF_AddImage(image as LPSTR);
AS LONG PASCAL FROM "I2PDF_AddImage" LIB "IMAGE2PDF.DLL"

DLL32 Function I2PDF_SetProducer(producer as LPSTR);
AS LONG PASCAL FROM "I2PDF_SetProducer" LIB "IMAGE2PDF.DLL"


DLL32 Function I2PDF_GetDLLVersion();
AS LONG PASCAL FROM "I2PDF_GetDLLVersion" LIB "IMAGE2PDF.DLL"


DLL32 Function I2PDF_License(code As LPSTR);
AS LPSTR PASCAL FROM "I2PDF_License" LIB "IMAGE2PDF.DLL"


DLL32 Function I2PDF_MetaImageMaxMP(maxmp as LONG);
AS LONG PASCAL FROM "I2PDF_MetaImageMaxMP" LIB "IMAGE2PDF.DLL"

DLL32 Function I2PDF_DeleteImagesOnConvert();
AS VOID PASCAL FROM "I2PDF_DeleteImagesOnConvert" LIB "IMAGE2PDF.DLL"

DLL32 Function I2PDF_SetDPI(dpi as LONG);
AS LONG PASCAL FROM "I2PDF_SetDPI" LIB "IMAGE2PDF.DLL"

DLL32 Function I2PDF_MakePDF(output As LPSTR, options as LONG, @cBuffer As LPSTR, ;
	maxErrorTextSize As LONG);
AS LONG PASCAL FROM "I2PDF_MakePDF" LIB "IMAGE2PDF.DLL"

DLL32 Function I2PDF_SetPermissionPrint();
AS VOID PASCAL FROM "I2PDF_SetPermissionPrint" LIB "IMAGE2PDF.DLL"

DLL32 Function I2PDF_MetaImageMaxMP_Int(maxmp as LONG);
AS LONG PASCAL FROM "I2PDF_MetaImageMaxMP_Int" LIB "IMAGE2PDF.DLL"

DLL32 Function I2PDF_UseEMFDeviceSize();
AS VOID PASCAL FROM "I2PDF_UseEMFDeviceSize" LIB "IMAGE2PDF.DLL"

DLL32 Function I2PDF_MetaToNativePDF();
AS VOID PASCAL FROM "I2PDF_MetaToNativePDF" LIB "IMAGE2PDF.DLL"

DLL32 Function I2PDF_Log(logFilename As LPSTR, logLevel as LONG);
AS LONG PASCAL FROM "I2PDF_Log" LIB "IMAGE2PDF.DLL"


The help file that come with "image2pdf.dll" is complete and easy to understand.

Regards



George
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Create and Email PDF's from FWH
Posted: Sun Nov 12, 2006 09:15 AM

George,

Podrias colgar un ejemplo de uso?

Gracias de antemano

William, Morales

Saludos



méxico.sureste
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Create and Email PDF's from FWH
Posted: Sun Nov 12, 2006 02:17 PM

Timm or George:

Could you please upload a little sample using image2pdf.dll ?

Regards, Armando

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
Create and Email PDF's from FWH
Posted: Sat Nov 25, 2006 04:15 AM
This the test.c and include file come from iamge2pdf.dll download package

#include <Windows.h>
#include "Image2PDF.h"


UINT ShowError(char *which, UINT iErr)
{
char message[200];

wsprintf(message, "%s returned error %d", which, iErr);

MessageBox(NULL, message, "Error Returned From Image2PDF DLL", MB_OK | MB_ICONERROR);

return iErr;
}


int PASCAL WinMain(HINSTANCE hCurrentInstance, HINSTANCE hPreviousInstance,
LPSTR lpszCommandLine, int iCommandShow)
{
UINT iErr;
char appDir[MAX_PATH + 1];
char imageFilename[MAX_PATH + 1];
char pdfFilename[MAX_PATH + 1];
char *p;
char errorText[1024];

// determine where app is running
lstrcpy(appDir, GetCommandLine());
if (*appDir == '"')
lstrcpy(appDir, GetCommandLine() + 1);
p = strrchr(appDir, '\\');
if (p) p[1] = 0;

wsprintf(imageFilename, "%stest.jpg", appDir);
wsprintf(pdfFilename, "%stest.pdf", appDir);

iErr = I2PDF_AddImage(imageFilename); if (iErr) return ShowError("I2PDF_AddImage", iErr);
iErr = I2PDF_SetDPI(96); if (iErr) return ShowError("I2PDF_SetDPI", iErr);
iErr = I2PDF_MakePDF(pdfFilename, OPTION_OPEN_PDF, errorText, sizeof(errorText));
if (iErr)
{
if (iErr == 3)
ShowError(errorText, iErr);
else
ShowError("I2PDF_MakePDF", iErr);
}
return 0;
}



2. I write a test.prg

ACTIVATE REPORT oRpt ;
WHILE ( oRpt:Cargo == 1 );
on end save2pdf(orpt)

FUNCTION save2pdf(orpt)
private ctext:=SPACE(4096)
aFiles := orpt:aMeta
for i:=1 TO LEN(afiles)
I2PDF_AddImage(afiles[i])
end
I2PDF_MakePDF("d:\aaa.pdf", 1, @cTEXT, 4096)

return .t.

This do not create pdf file at all.

Best Regard!

Shuming Wang
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
Create and Email PDF's from FWH
Posted: Sat Nov 25, 2006 04:17 AM
This the test.c and include file come from iamge2pdf.dll download package

#include <Windows.h>
#include "Image2PDF.h"


UINT ShowError(char *which, UINT iErr)
{
char message[200];

wsprintf(message, "%s returned error %d", which, iErr);

MessageBox(NULL, message, "Error Returned From Image2PDF DLL", MB_OK | MB_ICONERROR);

return iErr;
}


int PASCAL WinMain(HINSTANCE hCurrentInstance, HINSTANCE hPreviousInstance,
LPSTR lpszCommandLine, int iCommandShow)
{
UINT iErr;
char appDir[MAX_PATH + 1];
char imageFilename[MAX_PATH + 1];
char pdfFilename[MAX_PATH + 1];
char *p;
char errorText[1024];

// determine where app is running
lstrcpy(appDir, GetCommandLine());
if (*appDir == '"')
lstrcpy(appDir, GetCommandLine() + 1);
p = strrchr(appDir, '\\');
if (p) p[1] = 0;

wsprintf(imageFilename, "%stest.jpg", appDir);
wsprintf(pdfFilename, "%stest.pdf", appDir);

iErr = I2PDF_AddImage(imageFilename); if (iErr) return ShowError("I2PDF_AddImage", iErr);
iErr = I2PDF_SetDPI(96); if (iErr) return ShowError("I2PDF_SetDPI", iErr);
iErr = I2PDF_MakePDF(pdfFilename, OPTION_OPEN_PDF, errorText, sizeof(errorText));
if (iErr)
{
if (iErr == 3)
ShowError(errorText, iErr);
else
ShowError("I2PDF_MakePDF", iErr);
}
return 0;
}



2. I write a test.prg

ACTIVATE REPORT oRpt ;
WHILE ( oRpt:Cargo == 1 );
on end save2pdf(orpt)

FUNCTION save2pdf(orpt)
private ctext:=SPACE(4096)
aFiles := orpt:aMeta
for i:=1 TO LEN(afiles)
I2PDF_AddImage(afiles[i])
next
I2PDF_MakePDF("d:\aaa.pdf", 1, @cTEXT, 4096)

return .t.


DLL32 Function I2PDF_AddImage(image as LPSTR);
AS LONG PASCAL FROM "I2PDF_AddImage" LIB "IMAGE2PDF.DLL"


DLL32 Function I2PDF_MakePDF(output As LPSTR, options as LONG, @cBuffer As LPSTR, ;
maxErrorTextSize As LONG);
AS LONG PASCAL FROM "I2PDF_MakePDF" LIB "IMAGE2PDF.DLL"

This do not create pdf file at all.

Best Regard!

Shuming Wang
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
Create and Email PDF's from FWH
Posted: Tue Nov 28, 2006 01:59 AM

George,

Your wraps require Adobe Acrobat software for creation?
why mines not create a pdf file?

Best regard!

Shuming Wang

http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
Posts: 474
Joined: Sun Oct 30, 2005 06:37 AM
Create and Email PDF's from FWH
Posted: Tue Nov 28, 2006 02:04 AM

George,

> These are the wrappers that I am using with image2pdf.dll
Why my prg not create pdf ?

ctext:=space(1024)

I2PDF_AddImage("logo.jpg")
I2PDF_SetDPI(96)
I2PDF_MakePDF("d:\abc.pdf", 1, @ctext,1024)
Best regard!
Shuming Wang

http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
Posts: 729
Joined: Tue Oct 18, 2005 06:49 PM
Create and Email PDF's from FWH
Posted: Fri Dec 01, 2006 11:02 PM
Sorry my friends; I was a month without my computer :-)

FUNCTION SaveAsPDF(cRepName)
LOCAL result
LOCAL cBuffer:=space(300)
    hLib = LOADLIBRARY( "image2pdf.dll" )
	 
	 nRc :=  I2PDF_Log(".\log.txt", 3) // To save a LOG 
	
	 I2PDF_MetaTextFitBoundingRect()

	  nRc := I2PDF_UseEMFDeviceSize()
    
	  nRc := I2PDF_MetaToNativePDF()
	
	   nRc := I2PDF_SetDPI(300)   //- or to whatever value you require
	 

                DECLARE aEmf := {}
	aEmf := directory("*.emf") // Multiples pages

	FOR nX := 1 TO  len(aEmf)
	            nRc := I2PDF_AddImage(alltrim(aEmf[nX, F_NAME]))
	NEXT

	nResult := I2PDF_MakePDF(cRepName, 0, @cBuffer ,300)
	 	
	 FreeLibrary(hLib)

RETURN (.T.)


Regards


George
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Create and Email PDF's from FWH
Posted: Sat Dec 02, 2006 06:43 AM
George wrote:Sorry my friends; I was a month without my computer :-)

FUNCTION SaveAsPDF(cRepName)
LOCAL result
LOCAL cBuffer:=space(300)
    hLib = LOADLIBRARY( "image2pdf.dll" )
	 
	 nRc :=  I2PDF_Log(".\log.txt", 3) // To save a LOG 
	
	 I2PDF_MetaTextFitBoundingRect()

	  nRc := I2PDF_UseEMFDeviceSize()
    
	  nRc := I2PDF_MetaToNativePDF()
	
	   nRc := I2PDF_SetDPI(300)   //- or to whatever value you require
	 

                DECLARE aEmf := {}
	aEmf := directory("*.emf") // Multiples pages

	FOR nX := 1 TO  len(aEmf)
	            nRc := I2PDF_AddImage(alltrim(aEmf[nX, F_NAME]))
	NEXT

	nResult := I2PDF_MakePDF(cRepName, 0, @cBuffer ,300)
	 	
	 FreeLibrary(hLib)

RETURN (.T.)


Regards


George


Georce,

The next function not exist

I2PDF_Log()
I2PDF_MetaTextFitBoundingRect()
I2PDF_UseEMFDeviceSize()
I2PDF_MetaToNativePDF()
I2PDF_SetDPI()
I2PDF_AddImage()
I2PDF_MakePDF()

something any idea?

William

PD. sorry by bad english
William, Morales

Saludos



méxico.sureste