Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-02

wkhtmltopdf - trying use h2pas...

10 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marcos Douglas

Hi,
I'm trying to use h2pas in wkhtmltopdf's headers... but I'm found many erros. Could you help me to translate the headers to use in Pascal?

Command: h2pas libwkhtmltox-0.10.0_rc2\include\wkhtmltox\pdf.h -l wkhtmltox0.dll -o wkhtmltox0.pas -p
Enviroment: WinXP SP3 and FPC 2.4.3.
Project: http://code.google.com/p/wkhtmltopdf/
Files: http://code.google.com/p/wkhtmltopdf/downloads/detail?name=libwkhtmltox-0.10.0_rc2.zip&can=2&q=

Thank you very much.

Marcos Douglas

Reply by email

Michael Van Canneyt
to Marcos Douglas
Marcos Douglas wrote 9 lines
Hi, I'm trying to use h2pas in wkhtmltopdf's headers... but I'm found many erros. Could you help me to translate the headers to use in Pascal? Command: h2pas libwkhtmltox-0.10.0_rc2\include\wkhtmltox\pdf.h -l wkhtmltox0.dll -o wkhtmltox0.pas -p Enviroment: WinXP SP3 and FPC 2.4.3. Project: http://code.google.com/p/wkhtmltopdf/ Files: http://code.google.com/p/wkhtmltopdf/downloads/detail?name=libwkhtmltox-0.10.0_rc2.zip&can=2&q=

With an editor, open pdf.h, and replace the CAPI macro with an empty string.

Then, run

h2pas libwkhtmltox-0.10.0_rc2\include\wkhtmltox\pdf.h -l wkhtmltox0.dll -o wkhtmltox0.pas -D -p

(do not forget the -D)

If you're on windows, open the file and do a search and replace: cdecl
with
{$ifdef MSWINDOWS}stdcall{$else}cdecl{$endif}

Then it should function.

Michael.

Reply by email

ik
to Marcos Douglas: I'm trying to use h2pas in wkhtmltopdf's headers... but I'm found many erros. Could you…

I'm using webkit for it, in pure pascal and the Qt binding. No need to translate this program, it's not very hard to do it. However because that my program is running in commercial environment and created for specific client, I can not release it as open source.

Ido
LINESIP - Opening the source for communication
http://www.linesip.com
http://www.linesip.co.il

Marcos Douglas wrote 19 lines
Hi, I'm trying to use h2pas in wkhtmltopdf's headers... but I'm found many erros. Could you help me to translate the headers to use in Pascal? Command: h2pas libwkhtmltox-0.10.0_rc2\include\wkhtmltox\pdf.h -l wkhtmltox0.dll -o wkhtmltox0.pas -p Enviroment: WinXP SP3 and FPC 2.4.3. Project: http://code.google.com/p/wkhtmltopdf/ Files: http://code.google.com/p/wkhtmltopdf/downloads/detail?name=libwkhtmltox-0.10.0_rc2.zip&can=2&q= Thank you very much. Marcos Douglas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Marcos Douglas
to Michael Van Canneyt: With an editor, open pdf.h, and replace the CAPI macro with an empty string. Then, run…
Michael Van Canneyt wrote
With an editor, open pdf.h, and replace the CAPI macro with an empty string.

I thought that, but I'm not good on C so... what do this macro?

Show quoted text 13 lines
Then, run h2pas libwkhtmltox-0.10.0_rc2\include\wkhtmltox\pdf.h -l wkhtmltox0.dll -o wkhtmltox0.pas -D -p (do not forget the -D) If you're on windows, open the file and do a search and replace: cdecl with {$ifdef MSWINDOWS}stdcall{$else}cdecl{$endif} Then it should function.

OK, no errors. I can't test the code now, but I will and tell you later. Thanks!

Marcos Douglas

Reply by email

Marcos Douglas
to ik: I'm using webkit for it, in pure pascal and the Qt binding. No need to translate this…
ik wrote
I'm using webkit for it, in pure pascal and the Qt binding. No need to translate this program, it's not very hard to do it. However because that my program is running in commercial environment and created for specific client, I can not release it as open source.

I do not know the webkit lib. I saw this project, tested and it is really good to convert html to pdf.
The wkhtmltopdf is not a large dependency. Just a lib or binary...

Did you code all call to webkit in Pascal? Any tips?

Marcos Douglas

Reply by email

ik
to Marcos Douglas
Marcos Douglas wrote 12 lines
On Sat, Feb 5, 2011 at 7:46 AM, ik wrote: > I'm using webkit for it, in pure pascal and the Qt binding. > No need to translate this program, it's not very hard to do it. > However because that my program is running in commercial environment and > created for specific client, I can not release it as open source. I do not know the webkit lib. I saw this project, tested and it is really good to convert html to pdf. The wkhtmltopdf is not a large dependency. Just a lib or binary... Did you code all call to webkit in Pascal? Any tips?

Webkit already translated to
Pascal<http://users.telenet.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html>, and you use the API, and the amount of time to use the API is shorter then the amount of time to translate the header files imho.

You need to load the page to the browser and use the printer api to print it to pdf (you can also control how exactly it is done), and tell it where to store the pdf.

Show quoted text 6 lines
Marcos Douglas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Ido

Reply by email

Marcos Douglas
to ik
ik wrote
Webkit already translated to Pascal, and you use the API, and the amount of time to use the API is shorter then the amount of time to translate the header files imho.

Well... I didn't know that...

You need to load the page to the browser and use the printer api to print it to pdf (you can also control how exactly it is done), and tell it where to store the pdf.

Not. My program receive a HTML file and convert to PDF file. Just it. This program will be used from a site coded in (old) ASP, via an (wrapper) ActiveX.

My first option is use the wkhtmltopdf lib (dll) in my ActiveX. The second option is use the wkhtmltopdf binary together at my program (easy way).

I got the the lib to Win
http://users.telenet.be/Jan.Van.hijfte/qtforfpc/win_bin-qt4pas-V2.1_Qt4.5.3.zip There are many functions in qt4.pas... Could you tell me what functions I can use to do the convertion above?

There is a SVN from sources? Who works in this project?

Marcos Douglas

Reply by email

ik
to Marcos Douglas
Marcos Douglas wrote 18 lines
On Sat, Feb 5, 2011 at 8:59 AM, ik wrote: > > Webkit already translated to Pascal, and you use the API, and the amount of > time to use the API is shorter then the amount of time to translate the > header files imho. Well... I didn't know that... > You need to load the page to the browser and use the printer api to print it > to pdf (you can also control how exactly it is done), and tell it where to > store the pdf. Not. My program receive a HTML file and convert to PDF file. Just it. This program will be used from a site coded in (old) ASP, via an (wrapper) ActiveX.
My first option is use the wkhtmltopdf lib (dll) in my ActiveX. The second option is use the wkhtmltopdf binary together at my program (easy way).

Does the html contain all of the style that requires including images (if existed) ?
Please note that the CSS need to be set for printing that is a bit different then viewing.

Show quoted text 7 lines
I got the the lib to Win http://users.telenet.be/Jan.Van.hijfte/qtforfpc/win_bin-qt4pas-V2.1_Qt4.5.3.zip There are many functions in qt4.pas... Could you tell me what functions I can use to do the convertion above?

It contain examples on how to use webkit (please look at them, they does all you require), but you do not require to use the whole API, only small parts of it of <http://doc.qt.nokia.com/4.7/qprinter.html>webkit and the printing API <http://doc.qt.nokia.com/4.7/qprinter.html>.

There is a SVN from sources? Who works in this project?

There are few people who work on this some are on this and Lazarus malling lists.

Show quoted text 7 lines
Marcos Douglas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Ido
LINESIP - Opening the source for communication
http://www.linesip.com
http://www.linesip.co.il

Reply by email

Marcos Douglas
to ik
ik wrote 5 lines
Does the html contain all of the style that requires including images (if existed) ? Please note that the CSS need to be set for printing that is a bit different then viewing.

The CSS files are in .css extension files.
I don't have concern about this if I use th wkhtmltopdf lib. In my tests everything works fine.

Show quoted text 9 lines
> I got the the lib to Win > > http://users.telenet.be/Jan.Van.hijfte/qtforfpc/win_bin-qt4pas-V2.1_Qt4.5.3.zip > There are many functions in qt4.pas... Could you tell me what > functions I can use to do the convertion above? It contain examples on how to use webkit (please look at them, they does all you require), but you do not require to use the whole API, only small parts of it of webkit and the printing API.

Printing API... sorry, are you sure? The Printing API can convert files at another types?
Could you send (in private) a little example for this, please?

> There is a SVN from sources? Who works in this project? There are few people who work on this some are on this and Lazarus malling lists.

I registered me on the qt-list http://lists.lazarus.freepascal.org/pipermail/qt

Marcos Douglas

Reply by email

Marcos Douglas
to Michael Van Canneyt: With an editor, open pdf.h, and replace the CAPI macro with an empty string. Then, run…
Michael Van Canneyt wrote 32 lines
On Fri, 4 Feb 2011, Marcos Douglas wrote: > Hi, > I'm trying to use h2pas in wkhtmltopdf's headers... but I'm found many > erros. > Could you help me to translate the headers to use in Pascal? > > Command: h2pas libwkhtmltox-0.10.0_rc2\include\wkhtmltox\pdf.h -l > wkhtmltox0.dll -o wkhtmltox0.pas -p > Enviroment: WinXP SP3 and FPC 2.4.3. > Project: http://code.google.com/p/wkhtmltopdf/ > Files: > http://code.google.com/p/wkhtmltopdf/downloads/detail?name=libwkhtmltox-0.10.0_rc2.zip&can=2&q= With an editor, open pdf.h, and replace the CAPI macro with an empty string. Then, run h2pas libwkhtmltox-0.10.0_rc2\include\wkhtmltox\pdf.h -l wkhtmltox0.dll -o wkhtmltox0.pas -D -p (do not forget the -D) If you're on windows, open the file and do a search and replace: cdecl with {$ifdef MSWINDOWS}stdcall{$else}cdecl{$endif} Then it should function.

Hi Michael,
I used the binary, at the end. I didn't have much time so... Thank for the tip.

Marcos Douglas

Reply by email