many thanks for your job.
>Page counter is not exported in Haru, maybe the reason is: you can count the pages while creating in your code. Below I've included something that "abuses"
>HPDF_GetPageByIndex(), but i'm not sure if we should add it.
About HPDF_GetPageByIndex() this is my little opinion:
I think everyone need to retrieve a page, as example to place page number.Little example as CLipper
FOR iK := 0 TO pageCount-1
pPage := getPageByIndex( iK )
setCurrentPage( pPage )
? "Pag. " + hb_NtoS(iK) + "/" + hb_NtoS(pageCount)
NEXT
Without any additional lib (in my lib I'm using a hbArray for this scope, but not only) AFAIK there is no another way to move up and down or localize a page.
So, for this reason I thought "why not use internal Haru?".
About HB_HPDF_GETPAGECOUNT as a newbe (so, I'm sorry) I thought "wow it's a complicated code, I'm surprised there isn't an easy way to get such useful information".
anyway, thank you very much.Luigi
Il giorno giovedì 17 luglio 2025 alle 16:32:49 UTC+2 Aleksander Czajczynski ha scritto:
Hello!
Page counter is not exported in Haru, maybe the reason is: you can count the pages while creating in your code. Below I've included something that "abuses"
HPDF_GetPageByIndex(), but i'm not sure if we should add it.
Best regards, Aleksander
Luigi Ferraris wrote:Hi friends and Pritpal
I thought it might be useful to add these functions to the source harbour/contrib/hbhpdf/core.c
I'm not a C programmer, so I do copy&paste code but I don't know if they are right!Basically, Haru stores the created pages in an internal vector.
Using the function:
/* HPDF_GetPageByIndex( hDoc, index ) --> hPage */
HB_FUNC( HPDF_GETPAGEBYINDEX )
{
hb_retptr( ( void * ) HPDF_GetPageByIndex( hb_HPDF_Doc_par( 1 ), ( HPDF_UINT ) hb_parni( 2 ) ) );
}
it is possible to retrieve a page using an index (IOW page number) from Haru vector "pdf->page_list".I think index follow C style IOW from 0 to pdf->cur_page_num - 1
Next function is used to set current page to operate on. See previous function but not only.
/* HPDF_Doc_SetCurrentPage( hDoc, page ) --> nStatus */
HB_FUNC( HPDF_SETCURRENTPAGE )
{
hb_retnl( ( long ) HPDF_Doc_SetCurrentPage( hb_HPDF_Doc_par( 1 ), ( HPDF_Page ) hb_parptr( 2 ) ) );
}
Another function that might be useful, is to return the number of pages (see pdf->cur_page_num), but I didn't find this function in the HARU library.So I can only show a brief templateHB_FUNC( HPDF_CURRPAGE )
{
hb_retni( ???????? );
}
--
You received this message because you are subscribed to the Google Groups "Harbour Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-deve...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-devel/5e2b6aac-9c5e-40fd-bab7-4ce5441f4e0an%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Harbour Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/harbour-devel/T-HT86RpSuY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to harbour-deve...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-devel/687A82CE.2080608%40fki.pl.