Thanks. I'll take a look at it.KDJ wrote: ↑Mon Feb 13, 2017 10:24 pm SumatraPDF uses MuPDF library to rendering.
I found something on this subject:
https://www.codeproject.com/Articles/49 ... -Invoke-in
https://www.codeproject.com/Articles/57 ... er-Control
PDF Viewer DLL?
Moderator: Rathinagiri
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: PDF Viewer DLL?
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: PDF Viewer DLL?
Hi RobertoRoberto Lopez wrote: ↑Mon Feb 13, 2017 10:28 pm The only possible issue is that the user could click outside Sumatra window, being overlapped by HMG app, but, This could be solved using: EXECUTE FILE ... WAIT
you can use -plugin switch which give the ability to make SumatraPDF a child window of a given window, f.e. a window of your application.
In this way you have absolute control!
please see here
https://github.com/sumatrapdfreader/sum ... -arguments
(scroll down to "Developer options")
I have done it for one of my minigui applications and works ok.
I'm pretty sure you will easily realize how to make it,
![Wink ;-)](./images/smilies/icon_e_wink.gif)
however, If you need any details, about the way I have implemented it, I 'd be happy to provide them.
P.S. yes, SumatraPDF it's a very good piece of opensource software!
best regards,
---
Pete
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
PDF Viewer DLL?
Yeah nice news !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: PDF Viewer DLL?
Thanks!
This morning I've was reading the document you point (Sumatra at GitHub) and (for some reason) I've missed '-plugin' option
![Smile :)](./images/smilies/icon_e_smile.gif)
As you said, this way, we are in full control of the users experience, without caring about PDF support available on their systems.
Thanks again!
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: PDF Viewer DLL?
And... a step further...
Since I like that ny apps be self-contained (a single exe file) I'm thinking on embed Sumatra portable on my source code and create it (if it does not exists) in the destination machine (a crazy idea... I know
).
I guess that I should create an utility that reads the binary file (Sumatra exe) and creates the source code of a Harbour array, containing an element for each byte in the binary (maybe using HEX).
Since I'm trying to not reinvent the wheel (if not strictly needed) my question is: Does such utility exists?
TIA.
Since I like that ny apps be self-contained (a single exe file) I'm thinking on embed Sumatra portable on my source code and create it (if it does not exists) in the destination machine (a crazy idea... I know
![Smile :)](./images/smilies/icon_e_smile.gif)
I guess that I should create an utility that reads the binary file (Sumatra exe) and creates the source code of a Harbour array, containing an element for each byte in the binary (maybe using HEX).
Since I'm trying to not reinvent the wheel (if not strictly needed) my question is: Does such utility exists?
TIA.
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- srvet_claudio
- Posts: 2193
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: PDF Viewer DLL?
Roberto,Roberto Lopez wrote: ↑Wed Feb 15, 2017 1:24 am And... a step further...
Since I like that ny apps be self-contained (a single exe file) I'm thinking on embed Sumatra portable on my source code and create it (if it does not exists) in the destination machine (a crazy idea... I know).
I guess that I should create an utility that reads the binary file (Sumatra exe) and creates the source code of a Harbour array, containing an element for each byte in the binary (maybe using HEX).
Since I'm trying to not reinvent the wheel (if not strictly needed) my question is: Does such utility exists?
TIA.
1) embed your file as raw resource ( resource type ID are defined in i_controlmisc.ch ):
MyRawRes RT_RCDATA MyfileX.exe
2) load resource:
cData := HMG_LoadResourceRawFile ( "MyRawRes", RT_RCDATA )
3) save the resource:
hFile := FCreate("MyFile.exe")
Fwrite( hFile, cData )
FClose( hFile )
Re: PDF Viewer DLL?
Hola a todosby Roberto Lopez » Tue Feb 14, 2017 6:24 pm
Since I like that ny apps be self-contained (a single exe file) I'm thinking on embed Sumatra portable on my source code and create it (if it does not exists) in the destination machine (a crazy idea... I know).
Yo ya tenía un tiempo que no participaba...
Roberto
Esa "loca idea" yo también la tuve hace algún tiempo y después de probar y probar y probar,
logre hacerlo de esta forma. (NOTA: solo que el archivo pesaba 529 kb)
Espero que les sirva
-------------------------------------------------------------------------------------------------------------------
Hello everyone
I already had a time that did not participate ...
Robert
That "crazy idea" I also had it some time ago and after trying and testing and trying,
Can do it this way. (NOTE: only the file weighed 529 kb)
I hope it works for you
MiArchivo.RC
-------------------------------------------
MIARCH TXT miarchivo.exe
-------------------------------------------
en mi programa...
-------------------------------------------
FUNCTION CreaExe( )
LOCAL xData1
xData1 := HMG_LoadResourceRawFile( "MIARCH", "TXT" )
HB_MEMOWRIT( "miarchivo.exe", xData1 )
RETURN nil
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
Re: PDF Viewer DLL?
Attach small working sample when it will be ready, please ![Smile :-)](./images/smilies/icon_e_smile.gif)
![Smile :-)](./images/smilies/icon_e_smile.gif)
Re: PDF Viewer DLL?
No need to reinvent "this wheel"!Roberto Lopez wrote: ↑Wed Feb 15, 2017 1:24 am Since I'm trying to not reinvent the wheel (if not strictly needed) my question is: Does such utility exists?
TIA.
I would never stop to say that "harbour has it all" (or almost all, anyway)
![Smile :-)](./images/smilies/icon_e_smile.gif)
Personally, I do use a #pragma trick to attach binaries (or anything) to the final executable.
f.e. in one application that makes use of "curl.exe" I did:
Code: Select all
#include "fileio.ch"
-------------------------------------------------------------------------------------------------
IF ! hb_vfExists( "curl.exe" )
hb_MemoWrit( "curl.exe", CurlExe() )
// give OS a little time to "see" the newly created file
hb_IdleSleep( 0.5 )
// hide the file from user's sight to protect it from "accidents"
hb_vfAttrSet( "curl.exe", HB_FA_HIDDEN + HB_FA_READONLY + HB_FA_SYSTEM )
ENDIF
STATIC FUNCTION CurlExe()
#pragma __binarystreaminclude "CURL.EXE" | RETURN %s
--------------------------------------------------------------------------------------------------
NOTE 2: it's obvious that the attached file is piling up onto the final executable, and in the case of sumatraPDF (latest portable version is about ~6.5MiB), this attaching-technic will significantly affect the size of the executable with all the contingent consequences that such a growth may have during runtime.
best regards,
---
Pete