PDF Viewer DLL?

Moderator: Rathinagiri

KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: PDF Viewer DLL?

Post by KDJ »

Pablo

I divided the project into two files:
- PdfView.prg - with Harbour functions,
- PdfView_C.c - with C functions.
How it compile using HMG IDE?

Test_source.zip
(10.07 KiB) Downloaded 270 times
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: PDF Viewer DLL?

Post by Pablo César »

Hi Krzysztof,

You have prepared into two files, it's a good way to let ready for adopting these C functions at HMG core. :)
By the way, these C functions are useful and there are not similar one at HMG core.
I hope be incorporated to us as well libSumatraPDF library. :)
 
KDJ wrote: Sat Apr 22, 2017 7:38 pm How it compile using HMG IDE?
By habit and practicity we use to put C functions at the same place of prg sources.

But how to do in good order having in mind our IDE ?
As far I know, IDE works in conjunction with Build.bat file and works with three parameters at build proccess:
  1. /option ( [ /n ] [ /d ] [ /c ] )
  2. prgfile (main prg) or hbpfile
  3. hbcfile
But in this case, saving the c file at hbp file, is not good idea because IDE will not be considered and will cut off out... :(

In Harbour is correct to include in hbp file but with different name of PRG file taking this in consideration (to avoid conflict).
Probably our IDE should be changed this behaviour during its re-writing hbp files on building process. :?

What I have been done in this case when C file need to be builded separated from PRG is to put at main PRG file as include file:
Screen195.png
Screen195.png (26.83 KiB) Viewed 6459 times
It's not a elegant way in my view but it will garantee to be linked.

I very much appreciate your concern to leave the compilation universally with the options we have in HMG. :D
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: PDF Viewer DLL?

Post by Pablo César »

In Harbour's ChangeLog there has long been this configuration:
Added -bldflags option which tells hbmk to also
apply user build flags (HB_USER_*FLAGS) used when
building Harbour.

Added new flags to replace -bldflags[-]:
-bldf[-] and -bldf=[p][c][l]. We can pass any combinations
to the latter. '-bldf=' is the same as '-bldf-'.
To consider that at the time of compilation you can inherit flags from the Harbour.
This is not the same case but just for your information.

I've never used it, so I can not give you more details, maybe you can figure it out.

https://www.google.com.br/search?q=bldf ... r+bldflags
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
KDJ
Posts: 243
Joined: Mon Sep 05, 2016 3:04 am
Location: Poland

Re: PDF Viewer DLL?

Post by KDJ »

Hi Pablo

Thank you very much for your explanation.
For compile via IDE, I found another solution - C functions in PdfView_C.prg.

PdfView_source.zip
(15.21 KiB) Downloaded 316 times

In new version:
- added ability to translate the interface,
- added Polish translation.
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: PDF Viewer DLL?

Post by edk »

A Huge "Thank You"
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Re: PDF Viewer DLL?

Post by Pablo César »

You are welcome Krzysztof and happy you give a way putting at PRG for IDE proposes. :)

I also liked the language option which is a good step for the user to create their translations for their own language.
By the way, have you seen my project Google Translate and HMG ?

I've used this at PrintFile thinking to make easier for users at translation process .

I loved the way applied by Google Translator and ActiveX and what they can do together...

Thank you for your new release and congratulations. Excellent job. :P
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
quartz565
Posts: 667
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

Re: PDF Viewer DLL?

Post by quartz565 »

Thank you Krzysztof !!
Best Regards,
Nikos.

os: Windows Server 2019 - 64
User avatar
quartz565
Posts: 667
Joined: Mon Oct 01, 2012 12:37 pm
Location: Thessaloniki, Greece
Contact:

Re: PDF Viewer DLL?

Post by quartz565 »

KDJ wrote: Mon Apr 24, 2017 8:21 pm For compile via IDE, I found another solution - C functions in PdfView_C.prg.
Compiling in IDE, it works perfectly !!

(Tested on windows 10 and Windows Server 2012)

Τhank you again !
Best Regards,
Nikos.

os: Windows Server 2019 - 64
User avatar
vagblad
Posts: 160
Joined: Tue Jun 18, 2013 12:18 pm
DBs Used: MySQL,DBF
Location: Thessaloniki, Greece

Re: PDF Viewer DLL?

Post by vagblad »

I've checked the option "Open pdf at once" and from the toolbar the zoom option "Fit to page" (ctrl+0)
Everytime you scroll down the grid to another file the pdf opens in "Fit Width" mode. So i have to click the Fit to page button again or press Ctrl+0 everytime.
This could be a problem for someone who just wants to make a quick check on the pfd or use the whole thing as a preview browser.

I went and added inside PdfView.prg the following :

Code: Select all

Sumatra_Zoom(cPanel, 2)
in 2 places. At the end of the FIleopen Function and at the end of Filereopen function. It works ok now for me but it does a small flickering of the screen everytime you change files, because at first it opens the pdf in fit to width mode and then goes to fit to page mode again.

Is there any way to use the "Fit to page" mode by default?
Thanks for your great work.
Vagelis Prodromidis
Email: vagblad@gmail.com, Skype: vagblad
User avatar
vagblad
Posts: 160
Joined: Tue Jun 18, 2013 12:18 pm
DBs Used: MySQL,DBF
Location: Thessaloniki, Greece

Re: PDF Viewer DLL?

Post by vagblad »

After a few tries we've decided to do the following:

Added a new line at the end of the pdfview.ini:

Code: Select all

Zoom=fit page
Now inside SumatraPDF.prg we changed the line 74 to:

Code: Select all

EXECUTE FILE '"' + cExeFile + '"' PARAMETERS '-zoom ' + '"' + cZoom + '"' + ' -page ' + HB_NtoS(nPage) + ' -lang ' + cLang + ' -plugin ' + HB_NtoS(GetProperty(cPanel, 'HANDLE')) + ' "' + cPdfFile + '"'
At the PdfView.prg we made the following changes and additions:

Line 33: Added the static czoom variable:

Code: Select all

STATIC cZoom
Line 240,241,242 :

Code: Select all

MENUITEM LangStr("FitPage") + e"\tCtrl+0"        NAME FitPage      ACTION {Sumatra_Zoom(cPanel, 2), cZoom := "fit page"}
MENUITEM LangStr("RealSize") + e"\tCtrl+1"       NAME SizeReal     ACTION {Sumatra_Zoom(cPanel, 3), cZoom := "actual size"}
MENUITEM LangStr("FitWidth") + e"\tCtrl+2"       NAME FitWidth     ACTION {Sumatra_Zoom(cPanel, 4), cZoom := "fit width"}
At the FUNCTION SettingsRead()
line 1029:

Code: Select all

cZoom        := "fit page"
line 1053:

Code: Select all

        CASE "Zoom"        ; cZoom        := cValue          ; EXIT
and finally at the Function SettingsWrite() lines 1109 and 1110:

Code: Select all

           "Lang="        + cLang + CRLF + ;
           "Zoom="        + cZoom + CRLF

With this way we use the fit page as default viewing method and everytime you change it from the menu it saves the new value inside the ini file. That did the trick for us and i thought i should share it.
I am attaching the files as well. Thanks again.
PdfView.zip
(12.71 KiB) Downloaded 269 times
Vagelis Prodromidis
Email: vagblad@gmail.com, Skype: vagblad
Post Reply