Is there any samples of printing to pdf using harupdf lib. I tried the TPdf print class from my newest version of Harbour but this does not work. I then created the code below by using the functions used in the class:
function main()
local hPdf := HPDF_New()
local hPage := HPDF_AddPage( hPdf )
HPDF_Page_BeginText( hPage )
HPDF_Page_TextOut( hPage,10,10,"Hello PDF" )
HPDF_Page_EndText( hPage )
HPDF_SaveToFile ( hPdf, "Hello.pdf" )
return NIL
This runs without errors, but cannot find the hello.pdf anywhere on the server.
Thanks,
Byron
Create PDF in Mod_Harbour.
-
- Posts: 254
- Joined: Sun Nov 06, 2005 3:55 pm
- Location: Southern California, USA
- Contact:
Create PDF in Mod_Harbour.
Thanks,
Byron Hopp
Matrix Computer Services
Byron Hopp
Matrix Computer Services
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Create PDF in Mod_Harbour.
Byron,
Please change this line this way:
? HPDF_SaveToFile ( hPdf, "Hello.pdf" )
and lets see what return code you get
Please change this line this way:
? HPDF_SaveToFile ( hPdf, "Hello.pdf" )
and lets see what return code you get
-
- Posts: 254
- Joined: Sun Nov 06, 2005 3:55 pm
- Location: Southern California, USA
- Contact:
Re: Create PDF in Mod_Harbour.
The function returns 4133.
Thanks,
Byron Hopp
Matrix Computer Services
Byron Hopp
Matrix Computer Services
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Create PDF in Mod_Harbour.
Byron,
This way it works fine:
You can check the error codes here:
https://github.com/harbour/core/blob/ma ... hpdferro.h
This way it works fine:
Code: Select all
function main()
local hPdf := HPDF_New()
local hPage := HPDF_AddPage( hPdf )
HPDF_Page_SetFontAndSize( hPage, HPDF_GetFont( hPdf, "Helvetica" ), 24 )
HPDF_Page_BeginText( hPage )
HPDF_Page_TextOut( hPage, 10, 10, "Hello PDF" )
HPDF_Page_EndText( hPage )
? hb_NumToHex( HPDF_SaveToFile( hPdf, "c:\temp\Hello.pdf" ) )
return nil
https://github.com/harbour/core/blob/ma ... hpdferro.h
-
- Posts: 254
- Joined: Sun Nov 06, 2005 3:55 pm
- Location: Southern California, USA
- Contact:
Re: Create PDF in Mod_Harbour.
I pasted this code into my program and run. The ? hb_NumToHex( HPDF_SaveToFile( hPdf, "c:\temp\Hello.pdf" ) ) returns 0, there is a Temp directory on my c: drive but no file is created. I am using IIS version of Mod_Harbour.
Thanks,
Thanks,
Thanks,
Byron Hopp
Matrix Computer Services
Byron Hopp
Matrix Computer Services
-
- Posts: 21
- Joined: Mon Mar 02, 2020 12:00 am
Re: Create PDF in Mod_Harbour.
Byron,
Try replacing c:\temp with c:\inetpub\wwwroot or the folder that your application is running or a sub folder under that....
Try replacing c:\temp with c:\inetpub\wwwroot or the folder that your application is running or a sub folder under that....