Haru Free PDF Library

Haru Free PDF Library

Postby anserkk » Wed Feb 10, 2010 8:44 am

Haru Free PDF Library
http://libharu.sourceforge.net/index.html

Haru is a free, cross platform, open-sourced software library for generating PDF written in ANSI-C. It can work as both a static-library (.a, .lib) and a shared-library (.so, .dll). When you use it as static-library, It can be used by C and a C++.

It supports the following features.

1. Generating PDF files with lines, text, images.
2. Outline, text annotation, link annotation.
3. Compressing document with deflate-decode.
4. Embedding PNG, Jpeg images.
5. Embedding Type1 font and TrueType font.
6. Creating encrypted PDF files.
7. Using various character set (ISO8859-1~16, MSCP1250~8, KOI-8R).
8. Supporting CJK fonts and encodings.

You can add the feature of PDF creation by using HARU without understanding complicated internal structure of PDF.

Download
http://sourceforge.net/projects/libharu/files/

Supporting platforms
HARU is written in ANSI-C and should compile easily with any compliant C compiler.
Tested HARU in the following environment and make files for these environments are included in a package.

1. Cygwin + GCC (Microsoft Windows)
2. Cygwin + MinGW (Microsoft Windows)
3. Microsoft VC++ (Microsoft Windows)
4. Borland C++ (Microsoft Windows)
5. GCC (Linux, FreeBSD, NetBSD...)

Also on platforms except the above, it is easy to build HARU.
In addition, ZLIB and PNGLIB are required when you want to use the features of compression and embedding PNG images. (In the case of Windows, static library files for several compilers are included in the package for Windows. In the case of most of UNIX, these libraries are usually installed.)

Regards
Anser
User avatar
anserkk
 
Posts: 1329
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Haru Free PDF Library

Postby Lautaro » Wed Feb 10, 2010 12:53 pm

Spanish :
Hola,

En harbour existe una contribucion que usa harupdf esta en .\contrib\hbhpdf.

English:

Hello,

In harbour exist in .\contrib\hbhpdf the port of harupdf.


Saludos,

Lautaro Moreira
User avatar
Lautaro
 
Posts: 322
Joined: Fri Oct 07, 2005 2:44 pm
Location: Osorno, Chile

Re: Haru Free PDF Library

Postby thefull » Wed Feb 10, 2010 1:08 pm

ARG!!! Y yo que empece a portar la librería !!!!
Al menos en GNU/Linux funciona sin problemas.

En fin.. miraré como esta, y si falta portar alguna cosa.
Muchas gracias por el aviso.
Saludos
Rafa Carmona ( rafa.thefullARROBAgmail.com___quitalineas__)
User avatar
thefull
 
Posts: 729
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona

Re: Haru Free PDF Library

Postby Lautaro » Wed Feb 10, 2010 1:27 pm

Hola,

Que bueno que sirvio el aviso :D .


Saludos,

Lautaro Moreira
User avatar
Lautaro
 
Posts: 322
Joined: Fri Oct 07, 2005 2:44 pm
Location: Osorno, Chile

Re: Haru Free PDF Library

Postby thefull » Wed Feb 10, 2010 5:22 pm

Ostras, pero el sistema de coordenadas , [ posición 0,0], va desde la esquina inferior izquierda, basado en DPI... ( un poco rollo )

Bueno, esto lo podemos hacer más sencillo con una funcion;

Code: Select all  Expand view
function cm2dpi( nCM, page, lHeight )
   Local nHeight,nDpi := 72
   Local nRes

   if empty( lHeight )
      lHeight := .F.
   endif

   if lHeight
      nHeight := HPDF_Page_GetHeight(page)    
      nRes := nHeight - ( nCM * nDpi / 2.54 )
   else
      nRes := ( nCM * nDpi / 2.54 )
   endif

return nRes
 


Entonces ya podemos trabajar directamente con CMS, solamente teniendo en cuenta si la coordenada va a ser la vertical
// Poner a 5,5 cms desde arriba, como los cristianos ;-)
HPDF_Page_TextOut( page, cm2dpi(5,page), cm2dpi(5,page,.T.), "<Standerd Type1 fonts samples>" )

Ahora voy a tratar de convertir esto en una clase más manejable ;-)
Saludos
Rafa Carmona ( rafa.thefullARROBAgmail.com___quitalineas__)
User avatar
thefull
 
Posts: 729
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona

Re: Haru Free PDF Library

Postby Marcelo Via Giglio » Thu Feb 11, 2010 3:39 pm

Holas,

me pregunto, esto se ve como un DC relacionado a una impresora, entonces se podra crear una clase que simule la clase Tprinter (con sus datas y metodos) y utilizarla en lugar de ella, y de esa manera podriamos tener tener los reportes directos en PDF en lugar de EMF, sera posible?

saludos

Marcelo
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: Haru Free PDF Library

Postby thefull » Fri Feb 12, 2010 9:28 pm

Esa sería una buena idea, y si, mi idea va en ese camino, generar un PDF , sin impresoras virtuales , ni nada por el estilo,
el preview lo podemos hacer a partir del mismo Adobe, empotrado en la aplicación, y la impresión, ya se ocupará el también ;-)
Saludos
Rafa Carmona ( rafa.thefullARROBAgmail.com___quitalineas__)
User avatar
thefull
 
Posts: 729
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona

Re: Haru Free PDF Library

Postby Manuel Valdenebro » Mon Feb 15, 2010 8:27 am

thefull wrote:Esa sería una buena idea, y si, mi idea va en ese camino, generar un PDF , sin impresoras virtuales , ni nada por el estilo,
el preview lo podemos hacer a partir del mismo Adobe, empotrado en la aplicación, y la impresión, ya se ocupará el también ;-)


Rafa, eso sería un puntazo.

Vengo utilizando, desde hace mucho tiempo, tus clases tImprime y tUtil.

Si te sirve de ayuda, en xHarbour\contribuciones esta la clase Tpdf, de Rafael Luiz que funciona bastante bien, pero limitada, ya que le faltan muchos comandos SCRIPT que si tiene la libreria Haru.

Animo y espero con muchas ganas esa nueva clase.
Un saludo

Manuel
User avatar
Manuel Valdenebro
 
Posts: 706
Joined: Thu Oct 06, 2005 9:57 pm
Location: Málaga-España

Re: Haru Free PDF Library

Postby thefull » Mon Feb 15, 2010 12:40 pm

Pues... mi gozo en un pozo!! ;-(
En GNU/Linux no he tenido problemas en montármelo yo, a través del código fuente de sourceforge, pero no tengo ni idea de
como crear la librería que están en contrib y también la png.lib, que debe ser la que esta también en las /contrib.

¿ Alguien lo ha compilado para BC55 puede explicar o pasar el Make para generar dicha librería ?
Saludos
Rafa Carmona ( rafa.thefullARROBAgmail.com___quitalineas__)
User avatar
thefull
 
Posts: 729
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona

Re: Haru Free PDF Library

Postby Bayron » Mon Feb 15, 2010 2:43 pm

thefull wrote:Pues... mi gozo en un pozo!! ;-(
En GNU/Linux no he tenido problemas en montármelo yo, a través del código fuente de sourceforge, pero no tengo ni idea de
como crear la librería que están en contrib y también la png.lib, que debe ser la que esta también en las /contrib.

¿ Alguien lo ha compilado para BC55 puede explicar o pasar el Make para generar dicha librería ?


Yo baje la libreria y la compile, pero no encontre ninguna carpeta /contrib.

Pero si te refieres a la libreria libpng.lib, yo creo que seria esta, el make esta en SCRIPTS\MAKEFILE.BC32

http://sourceforge.net/projects/libpng/ ... p/download

Y como parte de libpng.lib, el make esta en el mismo directorio SCRIPTS\MAKEFILE.BC32


http://www.zlib.net/
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Haru Free PDF Library

Postby thefull » Mon Feb 15, 2010 3:19 pm

No me refería a bajarme el código fuente, y crearme la librería, si no, COMO crearla a partir de las /contrib.
Porque entonces ¿ que sentido tiene poner el código fuente de HPDF en el repositorio de Harbour ?

Pero gracias por el enlace.
Saludos
Rafa Carmona ( rafa.thefullARROBAgmail.com___quitalineas__)
User avatar
thefull
 
Posts: 729
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona

Re: Haru Free PDF Library

Postby thefull » Mon Feb 15, 2010 3:43 pm

Por cierto, las librerías de png y zlib están ya linkadas en el directorio \libharu-2.0.8\win32\bcc32.
Después, solamente coger el fichero harupdf.c de las /contrib, que es el que contiene los wrappers.
la verdad, es que no esta nada sencillo, hay que ir tocando y haciendo chapus para montar la librería para poder ejecutar el test.
Saludos
Rafa Carmona ( rafa.thefullARROBAgmail.com___quitalineas__)
User avatar
thefull
 
Posts: 729
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona

Re: Haru Free PDF Library

Postby frose » Fri Nov 25, 2011 7:44 am

Hello,

has someone an example how to use the library with xHarbour?
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: Haru Free PDF Library

Postby StefanHaupt » Fri Nov 25, 2011 8:42 am

Frank,

it´s working fine with xHarbour, I´m using it to create pdf-invoices. You can find a sample in the source of xHarbour in the contrib\hbhpdf\tests folder

If you need further assistance, drop me a mail.
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: Haru Free PDF Library

Postby frose » Fri Nov 25, 2011 9:42 am

Stefan,

thanks for the tip, that's exactly what I was looking for, so I'll try it...
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Next

Return to Utilities / Utilidades

Who is online

Users browsing this forum: No registered users and 1 guest