Page 1 of 2

How to use OPRN and error pdf2.prg sample

Posted: Thu Jun 25, 2020 5:53 pm
by tiagojbi
Hello, I'm trying to run pdf2.prg from your test server: https://www.modharbour.org/modharbour_samples/pdf2.prg.
However I am getting the error:

Error: Can't open #include file 'hbclass.ch'
called from: __PP_PROCESS, line: 0
called from: ../apache.prg, EXECUTE, line: 130

Source:
0128: ENDCLASS
0129:
0130 =>//------------------------------------------------------------------------------
0131:
0132: METHOD New( cFileName, cPassword, cOwnerPassword, nPermission, lPreview ) CLASS TPdf

could they help me? I would like to use this example in my hosting at https://xbhosts.com/.

Re: How to use OPRN and error pdf2.prg sample

Posted: Mon Jun 29, 2020 4:04 am
by Patricio Avalos Aguirre
hello

Code: Select all

// {% hb_SetEnv( "HB_INCLUDE", "C:\hb30web\include" ) %}

STATIC aTtfFontList:= NIL
STATIC cFontDir

//--- problemas con cos,sin

function Main()

   local def_font, tw, i := 0
   local cPageTitle := "Title of the page"
   local font_list := { "Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique",;
                        "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Times-Roman",;
                        "Times-Bold", "Times-Italic", "Times-BoldItalic", "Symbol", "ZapfDingbats" }
   local oPrn

   oPrn := TPdf():New( "list" )
   oPrn:LoadedFonts := font_list
   if Empty( oPrn:hPdf )
      ? "PDFs not available!"
      return NIL
   endif

    oFont1 := oPrn:DefineFont( 'Helvetica',  24 )
   oFont3 := oPrn:DefineFont( 'Helvetica', 16 )
   oFont2 := oPrn:DefineFont( 'Helvetica-Bold', 16 )

   oPrn:StartPage()

   height :=  oprn:nVertSize()
   width  :=  oprn:nHorzSize()
   oPrn:Rect( 10, 10, height-20, width-20 ,  1 )
   oPrn:cmSay(  2, 7, cPageTitle, oFont1 )

   x = 90

   for n = 1 to Len( font_list )
      samp_text = "abcdefgABCDEFG12345!#$%&+-@?"
      oFont2    = oPrn:DefineFont( font_list[ n ], 16 )
      oPrn:Say( x + n * 40,  30, font_list[ n ], oFont2 )
      oPrn:Say( x + n * 40, 220, samp_text, oFont2 )
   next

   oPrn:EndPage()
   oPrn:Save( hb_GetEnv( "PRGPATH" ) + "/test2.pdf" )
   oPrn:end()

   ?? "<iframe src='test2.pdf' style='width:calc( 100% + 16px );height:100%;border:0px;margin:-8px;'></iframe>"

return nil
Image

Re: How to use OPRN and error pdf2.prg sample

Posted: Mon Jun 29, 2020 12:08 pm
by tiagojbi
After use your code:

Error: Unknown or unregistered symbol
operation: TPDF
called from: ../../apache.prg, (b)MAIN, line: 50
called from: HB_HRBLOAD, line: 0
called from: ../../apache.prg, EXECUTE, line: 116
called from: ../../apache.prg, MAIN, line: 61

Re: How to use OPRN and error pdf2.prg sample

Posted: Mon Jun 29, 2020 3:24 pm
by Antonio Linares
Please use this mod_harbour version:

https://github.com/FiveTechSoft/mod_harbour/releases

Re: How to use OPRN and error pdf2.prg sample

Posted: Mon Jun 29, 2020 4:43 pm
by tiagojbi
Please, how to mod_harbour update on xbHosts.com sever?

and how to find release of mod_harbour in 32bits for my local workspace server?

Re: How to use OPRN and error pdf2.prg sample

Posted: Tue Jun 30, 2020 9:21 am
by Antonio Linares
> Please, how to mod_harbour update on xbHosts.com sever?

cd mod_harbour
git pull

> and how to find release of mod_harbour in 32bits for my local workspace server?

Is it for Windows 32 ?

Re: How to use OPRN and error pdf2.prg sample

Posted: Tue Jun 30, 2020 12:29 pm
by tiagojbi
>> after execute:
cd mod_harbour
git pull

some error in access sample: http://54.37.60.42/modharbour_samples/pdf2.prg:

Error: Can't open #include file 'hbclass.ch'
called from: __PP_PROCESS, line: 0
called from: ../source/exec.prg, EXECUTE, line: 64

Source:
0062: DATA LoadedFonts
0063: DATA aPages
0064 => DATA nCurrentPage
0065:
0066: DATA nPageSize INIT HPDF_PAGE_SIZE_A4

and after access http://54.37.60.42/jbiloja/index.prg

Error: Unknown or unregistered symbol
operation: AP_HEADERSIN
called from: HB_HRBLOAD, line: 0
called from: ../source/exec.prg, EXECUTE, line: 70

Source:
0068: endif
0069:
0070 =>
0071:
0072:

>> about mod_harbour32.zip with 3.2.0 where's find this file?

Thank you very much for your attention so far!

Re: How to use OPRN and error pdf2.prg sample

Posted: Tue Jun 30, 2020 2:54 pm
by Antonio Linares
Please create a /url/include/harbour folder and place all Harbour CH files there:

sudo mkdir /url/include/harbour
sudo cp -R /home/user/harbour/include /url/include/harbour

mod_harbour Win32 version:
https://github.com/FiveTechSoft/mod_har ... harbour.so
https://github.com/FiveTechSoft/mod_har ... arbour.dll

Re: How to use OPRN and error pdf2.prg sample

Posted: Tue Jun 30, 2020 5:08 pm
by tiagojbi
I performed the procedures above and when accessing: "http://54.37.60.42/modharbour_samples/pdf2.prg"
He returned:

Error: Can't open #include file 'hbclass.ch'
called from: __PP_PROCESS, line: 0
called from: ../source/exec.prg, EXECUTE, line: 64

Source:
0062: DATA LoadedFonts
0063: DATA aPages
0064 => DATA nCurrentPage
0065:
0066: DATA nPageSize INIT HPDF_PAGE_SIZE_A4

Re: How to use OPRN and error pdf2.prg sample

Posted: Wed Jul 01, 2020 4:27 am
by Antonio Linares
Please modify the header file used in pdf2.prg to use:

#include "/usr/include/harbour/hbclass.ch"
#include "/usr/include/harbour/hboo.ch"

Re: How to use OPRN and error pdf2.prg sample

Posted: Wed Jul 01, 2020 10:42 am
by Otto
Dear Antonio,
Many thanks.
Do you automatically update the examples on GitHub?

Best regards,
Otto

Re: How to use OPRN and error pdf2.prg sample

Posted: Wed Jul 01, 2020 10:56 am
by Antonio Linares
Dear Otto,

yes

Re: How to use OPRN and error pdf2.prg sample

Posted: Wed Jul 01, 2020 12:19 pm
by tiagojbi
I put the suggested information in the header of the file but it generated the error:
------------
Error: Can't open #include file '/usr/include/harbour/hbclass.ch'
called from: __PP_PROCESS, line: 0
called from: ../source/exec.prg, EXECUTE, line: 64

Source:
------------

Would it be possible to "format" the server and create it again with the updated mod_harbour?

Re: How to use OPRN and error pdf2.prg sample

Posted: Thu Jul 02, 2020 7:57 am
by Antonio Linares
> Would it be possible to "format" the server and create it again with the updated mod_harbour?

Yes, sure, we are going to do it

Re: How to use OPRN and error pdf2.prg sample

Posted: Thu Jul 02, 2020 12:11 pm
by acuellar
Estimado Antonio

Hice el cambio sugerido y ahora sale:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Gracias por la ayuda