AutoHotkey Community

It is currently May 27th, 2012, 6:36 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: May 11th, 2009, 12:16 pm 
Offline

Joined: May 12th, 2008, 2:23 pm
Posts: 30
Location: Germany
libHaru Wrapper
Quote:
libHaru is a free, cross platform, open source library for generating PDF files.
It supports the following features:
- Generating PDF files with lines, text, images.
- Outline, text annotation, link annotation.
- Compressing document with deflate-decode.
- Embedding PNG, Jpeg images.
- Embedding Type1 font and TrueType font.
- Creating encrypted PDF files.
- Using various character sets (ISO8859-1~16, MSCP1250~8, KOI8-R).
- Supporting CJK fonts and encodings.

Documentation
Download (ahk-lib)
Download (required dlls)

you want the latest msvc8 windows binary release (libhpdf.dll, libpng13.dll and zlib.dll)

Examples
Known Bugs:
    Annotations - not working
    Dashed Lines - not working

PDFs generated from the examples (zip, 397kb)
Download (lib + examples, zip, 229kb)


Last edited by Thrawn on June 3rd, 2009, 2:11 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 11th, 2009, 2:54 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
Great library and great wrapper! 8)

One minor issue with the thumbnails example under Win9x: there is no User Shell Folders > My Pictures key, unless maybe there are more users set up, which is not so usual for a Win9x installation.

A small addition would make it work correctly under 9x - all other examples work perfectly:
Code:
shfld := ( (A_OSType in WIN32_WINDOWS) ? "" : "User " ) . "Shell Folders"
   RegRead, path, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\%shfld%, My Pictures

Hopefully this doesn't affect other OS versions. I've also enhanced the thumbnails script a bit, adding other picture types. Others can easily be added:
Code:
   Loop, %path%\*, 0, 0
   if A_LoopFileExt in jpg,jpeg,png,bmp,gif

The only problem I have is with a small 96x96 PNG image that for some reason appears corrupt when upscaled. Dunno whose fault is, since libpng13.dll doesn't seem to be used (tried an old version I already had installed in %system% as well as the VC2005-dependant found in the VC8 binary zip - since the VC6 zip misses the actual binaries). Also tried with 2 different versions of zlib.dll - no change.

Anyway, this is not wrapper's problem so no sweat. Thanks again and keep up the good work! ;)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 11th, 2009, 6:15 pm 
Offline

Joined: May 12th, 2008, 2:23 pm
Posts: 30
Location: Germany
Thanks Drugwash.
I've implemented your improvements.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 12th, 2009, 4:57 am 
Offline

Joined: September 20th, 2006, 2:05 pm
Posts: 73
Thank you very much for this :D
Would try making a front end for my work


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 12th, 2009, 10:44 am 
Offline

Joined: May 12th, 2008, 2:23 pm
Posts: 30
Location: Germany
Drugwash wrote:
The only problem I have is with a small 96x96 PNG image that for some reason appears corrupt when upscaled. Dunno whose fault is, since libpng13.dll doesn't seem to be used (tried an old version I already had installed in %system% as well as the VC2005-dependant found in the VC8 binary zip - since the VC6 zip misses the actual binaries). Also tried with 2 different versions of zlib.dll - no change.
libpng13.dll is not being used in the thumbnails example, because every image is being resampled and converted to jpeg prior to embedding it into the pdf. :roll:
So, if you take out the resizing part and let it handle png images separately with HPDF_LoadPNGImageFromFile() it uses libpng13.dll.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 12th, 2009, 5:08 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
I'm more curious about who corrupts the PNG. From what you say, it could be gdiplus, but I replaced the previous XP-SP2 version (5.1.3102.2180) with XP-SP3 (5.1.3102.5660) and corruption still occurs. :cry:

When I let libpng13 to handle the PNG files (as you mentioned above), they all come out fine, without corruption. Whadda heck is goin' on here... :?:

Image <-> Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2009, 5:19 pm 
Offline

Joined: May 12th, 2008, 2:23 pm
Posts: 30
Location: Germany
you could adapt the resampling function so the converted pictures won't be deleted and see if they get corrupted before they are embedded in the pdf.
if they are corrupted -> it's gdi+ or the resampling code
if they are fine > its libharus fault


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2009, 8:21 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
It gets corrupted right after GDIplus conversion. Guess I gotta find a version that works.. if there's any. :(
Thanks for the suggestion, got me closer to the (bitter) truth.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2009, 10:34 pm 
Offline

Joined: May 12th, 2008, 2:23 pm
Posts: 30
Location: Germany
as a workaround you could use this (ImageMagick Wrapper) to convert the png to jpeg, although it would bloat the example with additional dlls.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2009, 11:12 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
Frankly I kinda dislike the JPEG format due to its lossy nature. PNG has good quality and small size, its only disadvantage would be unsupported alpha layer on 9x systems. I think I'll keep conversion disabled for PNGs in this particular case.

Thanks for providing that link though, hopefully it will be of help for someone.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 27th, 2009, 7:53 am 
Offline

Joined: May 23rd, 2009, 4:48 am
Posts: 363
Location: north bay, california
thanks for a great wrapper, i'm having fun playing with it.

quick question, zlib and libpng13 DLLs are needed, but i like to keep my dlls in %A_ScriptDir%\Resources\*.dll but its not finding them unless they are in %A_ScriptDir%\*.dll or %windir%\system32\*.dll

know how to affect those dlls being called? or is buried inside the libharu .dll

thanks
- gwarble

edit: never could find the call, so temporarily changing SetWorkingDir to the dll folder was the only solution i could find


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 11th, 2010, 12:29 am 
Offline

Joined: September 20th, 2006, 2:05 pm
Posts: 73
Ok, I finally felt the need to use this excellent library for making pdfs from my scanned images. This is so fast. I mean its instantaneous. It converted a set of 1000 images (a mix of HiRes jpegs and pngs) on my lowly dual core in under a second!

Thanks again for this nifty wrapper and excellent examples!

And yes, I used HPDF_LoadPngImageFromFile and not ImageMagick or gdip for the pngs.

Is it possible to embed more formats like bmp, gifs and tiffs without using gdip to convert for this?

EDIT:
I realized I was using libHPDF v2.0.8.0 which never prompted me for libPNG and works like a charm.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 23rd, 2010, 10:56 pm 
Hello
I start my first program in AutoHotkey. I use LibHaru to create PDFs.
But I have a problem. Accented characters (é, è, à ...) don't appear correctly in the PDF. They are replaced by Ø.
Do you know how to solve this problem ?
In advance, thank you.

PS: Sorry for my English, I'm French and I'm very bad at English and programming.


Report this post
Top
  
Reply with quote  
PostPosted: April 5th, 2011, 11:24 am 
Hi ..

I am trying to get LibHaru Windows Binaries 2.1.0 VC8 but the link on http://libharu.org/wiki/Downloads is broken (site down and will be unavailable until the server has been rebuilt)

If any one already has them.. I do appreciate helping me to get them

Thanks


Report this post
Top
  
Reply with quote  
PostPosted: April 5th, 2011, 7:07 pm 
Offline

Joined: May 12th, 2008, 2:23 pm
Posts: 30
Location: Germany
Guest4 wrote:
Hi ..

I am trying to get LibHaru Windows Binaries 2.1.0 VC8 but the link on http://libharu.org/wiki/Downloads is broken (site down and will be unavailable until the server has been rebuilt)

If any one already has them.. I do appreciate helping me to get them

Thanks

http://thrawn.einfachonline.net/downloa ... 8-dlls.zip


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group