FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Utilities / Utilidades Haru Free PDF Library
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Haru Free PDF Library
Posted: Wed Feb 10, 2010 08: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
Posts: 337
Joined: Fri Oct 07, 2005 02:44 PM
Re: Haru Free PDF Library
Posted: 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

Hola,

Soy un Contador que por necesidad aprendio a programar y se quedo programando.
Posts: 731
Joined: Fri Oct 07, 2005 07:42 AM
Re: Haru Free PDF Library
Posted: Wed Feb 10, 2010 01: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__)
Posts: 337
Joined: Fri Oct 07, 2005 02:44 PM
Re: Haru Free PDF Library
Posted: Wed Feb 10, 2010 01:27 PM

Hola,

Que bueno que sirvio el aviso :D .

Saludos,

Lautaro Moreira

Hola,

Soy un Contador que por necesidad aprendio a programar y se quedo programando.
Posts: 731
Joined: Fri Oct 07, 2005 07:42 AM
Re: Haru Free PDF Library
Posted: Wed Feb 10, 2010 05: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 (fw): Select all Collapse
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__)
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Haru Free PDF Library
Posted: Thu Feb 11, 2010 03: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

Posts: 731
Joined: Fri Oct 07, 2005 07:42 AM
Re: Haru Free PDF Library
Posted: Fri Feb 12, 2010 09: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__)
Posts: 711
Joined: Thu Oct 06, 2005 09:57 PM
Re: Haru Free PDF Library
Posted: Mon Feb 15, 2010 08: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
Posts: 731
Joined: Fri Oct 07, 2005 07:42 AM
Re: Haru Free PDF Library
Posted: 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__)
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: Haru Free PDF Library
Posted: Mon Feb 15, 2010 02: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
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 731
Joined: Fri Oct 07, 2005 07:42 AM
Re: Haru Free PDF Library
Posted: Mon Feb 15, 2010 03: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__)
Posts: 731
Joined: Fri Oct 07, 2005 07:42 AM
Re: Haru Free PDF Library
Posted: Mon Feb 15, 2010 03: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__)
Posts: 392
Joined: Tue Mar 10, 2009 11:54 AM
Re: Haru Free PDF Library
Posted: Fri Nov 25, 2011 07: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
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: Haru Free PDF Library
Posted: Fri Nov 25, 2011 08: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
Posts: 392
Joined: Tue Mar 10, 2009 11:54 AM
Re: Haru Free PDF Library
Posted: Fri Nov 25, 2011 09: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