PowerBASIC Peer Support Forums
 

Go Back   PowerBASIC Peer Support Forums > User to user Discussions > Third-Party Addons

Notices

Third-Party Addons User to user discussions of third-party addons and user-recommended links to related web sites. Advertisements are permitted only in this forum, for products designed to work with and enhance PowerBASIC compilers.

Reply
 
Thread Tools Display Modes
  #1  
Old Mar 3rd, 2007, 03:14 AM
José Roca José Roca is online now
Member
 
Join Date: Mar 2004
Location: Valencia, Spain
Posts: 3,440
libharu headers for PowerBASIC

What is Haru Free PDF Library?

HARU is a free, cross platform, open-sourced software library for
generating PDF. 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.

Web site: http://sourceforge.net/projects/libharu/

What is new in version 2.08?

Version 2.08 is a maintenance release that includes the following changes:

* Fixed a problem of HPDF_Circle() that causes buffer overflow.
* Added HPDF_Ellipse().

I have translated the headers and examples and posted them in my forum.

http://www.forum.it-berater.org/index.php?topic=887.0

The attachment contains the translation of the headers and examples
to PowerBASIC. Preserve the directory structure when unzipping.
It doesn't include libhpdf.dll, that must be downloaded from the
sourceforge link above listed.


------------------
Website: http://com.it-berater.org
SED Editor, TypeLib Browser, COM Wrappers.
Forum: http://www.forum.it-berater.org

[This message has been edited by José Roca (edited March 03, 2007).]
__________________
Website: http://www.jose.it-berater.org/index.html
SED Editor, TypeLib Browser.
Forum: http://www.jose.it-berater.org/smfforum/index.php
Reply With Quote
  #2  
Old Mar 3rd, 2007, 03:36 AM
Mike Doty Mike Doty is offline
Member
 
Join Date: Feb 2005
Location: Omaha, Nebraska
Posts: 4,603
Great stuff!
Would be nice to shell to the documents after creation.
Working on it.

------------------
Reply With Quote
  #3  
Old Mar 3rd, 2007, 03:47 AM
Mike Doty Mike Doty is offline
Member
 
Join Date: Feb 2005
Location: Omaha, Nebraska
Posts: 4,603
'"hpdf.inc"
'Added this code:

Code:
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'  ShellDocument     by Don Dickinson
'  opens a document with a registered extension
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB ShellDocument ALIAS "ShellDocument" (BYVAL sFile AS STRING) EXPORT

  ShellExecute 0, BYVAL %null, sFile + $NUL, BYVAL %null, BYVAL %null, _
      %SW_NORMAL

END SUB
               

Then at the end of examples:
ShellDocument fname
------------------
Reply With Quote
  #4  
Old Mar 3rd, 2007, 08:29 AM
Eros Olmi Eros Olmi is offline
Member
 
Join Date: Oct 2001
Location: Milan - Italy
Posts: 1,747
Not yet tested but knowing your "guru" level I'm 110% sure it will be perfect.
Thank you very much.
Eros


------------------
thinBasic forum
mailto:eros.olmi@thinbasic.comeros.olmi@thinbasic.com</A>
__________________
www.thinbasic.com | community.thinbasic.com | psch.thinbasic.com
Win7Pro 64bit - 8GB Ram - i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB
Reply With Quote
  #5  
Old Mar 3rd, 2007, 09:43 AM
Paul Franks Paul Franks is offline
Member
 
Join Date: Mar 2006
Posts: 468
Thanks, Jose.

I did the PB headers for the older C++ version of libHaru (they're
posted here somewhere), but never got around to updating them when
the author rewrote the lib in C.

BTW, it's documented here: http://libharu.sourceforge.net/

------------------

--pdf

[This message has been edited by Paul Franks (edited March 03, 2007).]
__________________

--pdf
Reply With Quote
  #6  
Old Mar 3rd, 2007, 03:11 PM
José Roca José Roca is online now
Member
 
Join Date: Mar 2004
Location: Valencia, Spain
Posts: 3,440
I'm aware of it. Didn't used them because you said that Takeshi was
working in a new version.

BTW users of earlier versions of PBWIN and PBCC will need to change the
names of some members of the structures (e.g. left, right, width),
because they don't allow the use of reserved names as members of UDTs.
Also, in some of the examples, they will have to change ARRAY ASSIGN
and use individual assignments.


------------------
Website: http://com.it-berater.org
SED Editor, TypeLib Browser, COM Wrappers.
Forum: http://www.forum.it-berater.org
__________________
Website: http://www.jose.it-berater.org/index.html
SED Editor, TypeLib Browser.
Forum: http://www.jose.it-berater.org/smfforum/index.php
Reply With Quote
  #7  
Old Mar 3rd, 2007, 07:18 PM
Adrian Verkuil Adrian Verkuil is offline
Member
 
Join Date: Jul 2004
Posts: 132
Jose,

Just simpel thanks unlimited times for the PDF stuff.



------------------
To Ask or Not To Ask ?
__________________
To Ask or Not To Ask ?
Reply With Quote
  #8  
Old Mar 3rd, 2007, 08:30 PM
José Roca José Roca is online now
Member
 
Join Date: Mar 2004
Location: Valencia, Spain
Posts: 3,440
One problem remains. There are several functions that return an UDT.
Sometimes, this can be solved declaring the return type as a DWORD and
the assigning the value to a variable declared as <udt name> PTR to access
the members, but I have tried with one and causes the program to GPF
when it ends. Maybe its an incompatibility of the GCC compiler.
See: http://gcc.gnu.org/onlinedocs/gcc/In...ibilities.html

Takeshi has added new "2" functions that allow to pass the UDT by reference,
but only for the ones that caused problems to Delphi. Maybe we can
convince him to add new "2" functions for the remaining ones.


------------------
Website: http://com.it-berater.org
SED Editor, TypeLib Browser, COM Wrappers.
Forum: http://www.forum.it-berater.org
__________________
Website: http://www.jose.it-berater.org/index.html
SED Editor, TypeLib Browser.
Forum: http://www.jose.it-berater.org/smfforum/index.php
Reply With Quote
  #9  
Old Aug 17th, 2007, 07:05 AM
Hans-Dieter Veit Hans-Dieter Veit is offline
Member
 
Join Date: Mar 2005
Location: München (Munich)
Posts: 37
Hello José,

i'm very interested in your header/translated examples.

Unfortunately i cannot detect any way to detach the attachment in the posting of your forum you have linked.

thanks

Hans

------------------
Reply With Quote
  #10  
Old Aug 17th, 2007, 08:00 AM
José Roca José Roca is online now
Member
 
Join Date: Mar 2004
Location: Valencia, Spain
Posts: 3,440

The forum has moved to other domain. This is the new link:
http://www.jose.it-berater.org/smffo...hp?topic=373.0

You will need to register first.


------------------
Website: http://com.it-berater.org
SED Editor, TypeLib Browser, COM Wrappers.
Forum: http://www.jose.it-berater.org/smfforum/index.php
__________________
Website: http://www.jose.it-berater.org/index.html
SED Editor, TypeLib Browser.
Forum: http://www.jose.it-berater.org/smfforum/index.php
Reply With Quote
  #11  
Old Aug 17th, 2007, 09:08 AM
Cecil L. Williams Cecil L. Williams is offline
Member
 
Join Date: Mar 2002
Posts: 106
Unless the ANSI C/C++ committee has made a change, all vars are passed by
value. Normally there are two ways to pass a structure by either
assigning a pointer to it or passing it's address with the ampersand
in front of the var.

Now I don't know diddly about GCC or Delphi, But standard C/C++
convention is by value.

Cheers

------------------
Reply With Quote
  #12  
Old Aug 17th, 2007, 10:12 AM
José Roca José Roca is online now
Member
 
Join Date: Mar 2004
Location: Valencia, Spain
Posts: 3,440
The problem is not about passing parameters, but with some functions
that return an structure. While other C compilers copy the data into
an area of static storage and then return the address of that storage,
gcc apparently uses a non-compatible method.

Quote:
The method used by GCC is as follows: a structure or union which is 1, 2, 4 or 8 bytes long is returned like a scalar. A structure or union with any other size is stored into an address supplied by the caller (usually in a special, fixed register, but on some machines it is passed on the stack). The target hook TARGET_STRUCT_VALUE_RTX tells GCC where to pass this address.

------------------
Website: http://com.it-berater.org
SED Editor, TypeLib Browser, COM Wrappers.
Forum: http://www.jose.it-berater.org/smfforum/index.php
__________________
Website: http://www.jose.it-berater.org/index.html
SED Editor, TypeLib Browser.
Forum: http://www.jose.it-berater.org/smfforum/index.php
Reply With Quote
  #13  
Old Aug 25th, 2007, 09:28 PM
Joe Byrne Joe Byrne is offline
Member
 
Join Date: Feb 2000
Location: Central Mn., USA
Posts: 4,911
I'm finding the libharu library to be an excellent alternative to most of the other PDF tools. My humble thanks to Jose for the headers!

I've run into one problem though. If anyone has an answer, I'd appreciate it.

On one half of my page, I need to print a series of dollar amounts. The left boarder contains the fee's description with the dollar amount following. I can't seem to get the amounts to right justify though. I've tried doing a RSET and FORMAT$ but the digits are off depending on the size of the number of value. I'm using a fixed-width font, but that doesn't seem to help either.

Short of calculating the exact left margin for each value, does anyone know of a way to properly right justify the output like this?

TIA

------------------
* Americans: Time for the right party
-------------------------
Read my Blog
__________________
All those in favor of global warming, please raise your hands
Reply With Quote
  #14  
Old Sep 1st, 2007, 05:22 PM
Paul Franks Paul Franks is offline
Member
 
Join Date: Mar 2006
Posts: 468
Joe,

If you haven't already found a solution, search the Source Code forum (it's so nice to have a search feature that actually works now ) for libharu, I'm pretty sure I posted a report example a while ago that has justification options. It would have been for the original version of libharu, but might be adaptable with minimal effort.
__________________

--pdf
Reply With Quote
  #15  
Old Dec 11th, 2007, 04:27 PM
Ken Lyon Ken Lyon is offline
Member
 
Join Date: Jul 1999
Location: Logan, UT USA
Posts: 32
LibHaru ReadFromStream problem

Hi All,

The following declare uses a byte pointer to buf. Is there any way I can call this function from PowerBasic? I do not know how to use a byte pointer.

DECLARE FUNCTION HPDF_ReadFromStream LIB "libhpdf.dll" ALIAS "HPDF_ReadFromStream" ( _
BYVAL HPDF_Doc, _ ' HPDF_Doc pdf
BYREF HPDF_BYTE, _ ' HPDF_BYTE *buf
BYREF HPDF_UINT32 _ ' HPDF_UINT32 *size
) AS HPDF_STATUS ' HPDF_STATUS

Ken
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:50 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright © 1999-2010 PowerBASIC, Inc. All Rights Reserved.
Error in my_thread_global_end(): 1 threads didn't exit