Converting reports to PDF using hbvpdf

1,289 views
Skip to first unread message

Ash

unread,
May 11, 2014, 4:00:10 PM5/11/14
to harbou...@googlegroups.com
Hello,

My application prints many reports using a PCL library that uses Clipper-like row/column coordinates for printing. I came across hbvpdf that I think is worth investigating further. Would anyone care to share their experience?

Regards.
Ash
 

Klas Engwall

unread,
May 11, 2014, 8:40:38 PM5/11/14
to harbou...@googlegroups.com
Hi Ash,

> My application prints many reports using a PCL library that uses
> Clipper-like row/column coordinates for printing. I came across *hbvpdf*
> that I think is worth investigating further. Would anyone care to share
> their experience?

This lib was a revolution ten years ago when it was donated to the
Clipper community by Victor K (a different Victor, with a "c", than the
one we know here). It was then called Clippdf. It was usable but had som
quirks. At the time it was procedural code only.

Pritpal converted it to OOP and included it in xHarbour. Both versions
(procedural and OOP) were included in Harbour six years ago, but the OOP
version was later removed, so only the procedural version remains
(although the OOP version still exists in xHarbour as
contrib\pdflite\pdf1.prg - but it has been mixed up with pdflite and I
am not sure if it is complete anymore).

The (procedural) Harbour version seems complete, and according to the
changelog it has been cleaned up many times in many ways by Viktor (with
a "k"). Based on my experience from the original Clipper version I would
say that it can be used successfully for basic PDF creation, including
adding JPG and TIFF pictures (the xHarbour version has some additional
capabilities), and with some tweaking it is possible to create PDFs that
are 100% identical to what you do in PCL. There is a demo in the tests
directory that you can run to see what it does.

But for heavier use it is probably better to look at the hbhpdf contrib,
which is based on HaruPdf.

Regards,
Klas

Qatan

unread,
May 12, 2014, 2:41:09 AM5/12/14
to harbou...@googlegroups.com
Hello Ash,
 
I would use hbhpdf (HaruPDF) that is pretty easy and powerful.
I used and I had no problems. Works like a charm.
You will find a example of use with it (with lots of possible ways of using it).
 
Qatan
--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Qatan

unread,
May 13, 2014, 9:22:58 AM5/13/14
to harbou...@googlegroups.com
Hello EDS,
 
Thanks for your offering.
M.,Ronaldo also shared a free alternative to a printing system class called “Class: MR-Print ( Harbour Print System )” and a “Boleto” generator called “Class: MR-Boleto ( Boleto Bancario em Harbour )” (Brazilian bank slip) here: https://github.com/MRonaldo/MR-Tools/downloads
This nice source code was shared by M.,Ronaldo on this list some time ago. (10/06/2013)
 
Hope someone will find it useful.
 
Qatan
 
 
Sent: Tuesday, May 13, 2014 2:54 PM
Subject: [harbour-users] Re: Converting reports to PDF using hbvpdf
 
Hi Ash,
See my lib PRN2PDF, she makes the conversion of CHR (Bold, etc) and binding characters to generate the PDF:
prnToPDF (cFileNamePRN, cFileNamePDF)
www.magaldi.eti.br/downloads
Any questions post on my forum.

This feature is now part of the lib for print and preview: PageScript, Fivewin, Hwgui, etc..


[],
EDS
--

develope...@yahoo.com

unread,
May 13, 2014, 10:30:04 AM5/13/14
to harbou...@googlegroups.com
Qatan, I have fun with you making a fool everywhere I'm posting.
For years you try to get some information from my work for free, last month pretending they wanted to buy something, accessing area to hire my services.
Now shifted its focus, thinking that bothers me, so you get only burn.


Em terça-feira, 13 de maio de 2014 10h22min58s UTC-3, Qatan escreveu:
Hello EDS,
 
Thanks for your offering.
... 

Ash

unread,
May 13, 2014, 10:44:22 AM5/13/14
to harbou...@googlegroups.com
Hello Everybody,

I spent a couple of days trying to find a solution for converting PCL based invoices to PDF via HBHPDF and HBVPDF but didn't get anywhere. Both of these libraries have their own issues - HBHPDF for using x,y and HBVPDF using a mix of dot-based row/column coordinates. Too much work!

Further research revealed a PCL to PDF converter from http://www.columbia.edu/~em36/pcltopdf.html which did the trick. To use, I simply added the following line of code to my application.

 HB_processRUN("WinPCLtoPDF.exe report.pcl report.pdf")

Regards.
Ash

Qatan

unread,
May 13, 2014, 10:51:33 AM5/13/14
to harbou...@googlegroups.com
Hello Ash,
 
>...
> HB_processRUN("WinPCLtoPDF.exe report.pcl report.pdf")
 
Thanks for sharing your solution.
May help someone.
Regards,
 
Qatan

José Quintas

unread,
May 13, 2014, 11:10:51 AM5/13/14
to harbou...@googlegroups.com
You can create a translator from x,y to row,col.
See my class using harupdf for PDF or Matrix.
Conversion is made by RowToPdfRow() and ColToPdfCol()

is change this:
@ 5, 5 SAY code PICTURE "999999"

by this:
DrawText( 5, 5, code, "999999" )

http://www.harbourdoc.com.br/show.asp?seek=description&key=PDFClass

José M. C. Quintas

Qatan

unread,
May 13, 2014, 1:36:03 PM5/13/14
to harbou...@googlegroups.com
Very nice José!
Thanks for sharing.
 
Qatan

Ash

unread,
May 16, 2014, 5:01:07 PM5/16/14
to harbou...@googlegroups.com
Hello José,

You made a difficult job simple. Well done and thank you.

Attached is what I have been able to do using PDFClass.

Regards.
Ash
invoice.pdf

Massimo Belgrano

unread,
May 17, 2014, 5:55:14 AM5/17/14
to harbou...@googlegroups.com
Hi José 
Very very nice guide for using harbour
http://www.harbourdoc.com.br/
a little suggestione In udefine the search must start from missing function like EDITORNEXTLINE

I use for descoperthe unresolved external  the nice harbour tutorial in the complete harbour function and use find
http://www.elektrosoft.it/tutorials.asp


Massimo Belgrano
Delta Informatica S.r.l. (Cliccami per scoprire 

José Quintas

unread,
May 17, 2014, 9:35:36 AM5/17/14
to harbou...@googlegroups.com

Em 17/05/2014 06:55, Massimo Belgrano escreveu:
Hi José 
Very very nice guide for using harbour
http://www.harbourdoc.com.br/
a little suggestione In udefine the search must start from missing function like EDITORNEXTLINE

Sorry, I do not known if I understand.
-Undefined are functions that I do not fill category/subcategory, group by library.

I mix Harbour and all library.
To create the tree I use order: alt-category/alt-subcategory/library/alt-group.
This "alt" is to not change original Harbour classification.

As example, Date/Time functions.
Is usefull to see all available Date/Time functions, but is usefull to known where found each one.
Then, inside Date/Time are grouped by core, hbct.hbc, hbmisc.hbc, hbnf.hbc, xhb.hbc
If invert order: library + category, then need to open each library to see if it have Date/Time functions.

Note:
All data is on a MySql database, tree and text come from the database.
When update a record, tree is updated.
In first database creation, I use output of hbmk2 -find *
Be sure that I have no idea about the correct category to several functions in -Undefined.
At this moment, database have 5.976 records, all records are in the tree.



I use for descoperthe unresolved external  the nice harbour tutorial in the complete harbour function and use find
http://www.elektrosoft.it/tutorials.asp


in harbourdoc.com.br you can use "open all" and make a find too.


José M. C. Quintas

Massimo Belgrano

unread,
May 17, 2014, 10:02:22 AM5/17/14
to harbou...@googlegroups.com

2014-05-17 15:35 GMT+02:00 José Quintas <josed...@mandic.com.br>:
Sorry, I do not known if I understand.
-Undefined are functions that I do not fill category/subcategory, group by library.

IMo most user who want resolve a provblem undefined after a compilatione
so if possible search for speficific undefined like ctcexit and found in hbct
Only as suggestione

Still compliment for project

José Quintas

unread,
May 17, 2014, 10:31:23 AM5/17/14
to harbou...@googlegroups.com
Hi

Em 17/05/2014 11:02, Massimo Belgrano escreveu:
>
> IMo most user who want resolve a provblem undefined after a compilatione
> so if possible search for speficific undefined like ctcexit and found
> in hbct

hbmk2 makes this very well.

d:\temp>hbmk2 test
Harbour 3.2.0dev (r1404021046)
Copyright (c) 1999-2014, http://harbour-project.org/
Compiling 'test.prg'...
Lines 3, Functions/Procedures 1
...
hbmk2: Hint: Add option 'hbct.hbc' for missing function(s): ctexit()

José M. C. Quintas

José Quintas

unread,
May 17, 2014, 10:37:01 AM5/17/14
to harbou...@googlegroups.com
I use wrong function, but same result with ctcexit().

d:\temp>hbmk2 test
Harbour 3.2.0dev (r1404021046)
Copyright (c) 1999-2014, http://harbour-project.org/
Compiling 'test.prg'...
Lines 3, Functions/Procedures 1
...
hbmk2: Hint: Add option 'hbct.hbc' for missing function(s): ctcexit()


And using "open all", find, attached image.

José M. C. Quintas
find.png

Ernad Husremovic

unread,
May 19, 2014, 9:04:03 AM5/19/14
to harbou...@googlegroups.com
Ash, 
Is it possible to share the source code of invoice with us ?

Ash

unread,
May 20, 2014, 10:24:58 AM5/20/14
to harbou...@googlegroups.com
Hello Ernad,

Here we go.

I made a couple of code changes:
LETTER size paper
Replace :Page with :oPage.

Regards.
Ash

---<Begin Code>---


FUNCTION main()
   LOCAL oPDF
   oPDF := PDFClass():New()
   oPDF:Begin()
   InvoiceMask( oPDF )
   oPDF:End()
   RETURN

FUNCTION InvoiceMask(oPDF)
LOCAL x
   oPDF:PageHeader()
   oPDF:DrawText( 2, 67, 'INVOICE', , 14,"Helvetica-Bold" )
   // Salesperson, Invoice date
   oPDF:DrawRetangle( 5.4, 60, 35, 01,,3, {0.75, 0.75, 0.75})   //Shaded Heading
   oPDF:DrawText( 6, 61, 'Salesperson/PKSlip No.','@!', 7, "Courier-Bold" )
   oPDF:DrawText( 6, 81, 'Date of Invoice','@!', 7, "Courier-Bold" )
   oPDF:DrawRetangle( 5.4, 60, 35, 2 ) // Whole Box
   oPDF:DrawLine( 5.4, 77, 7.1, 77)    // Vertical Line
   oPDF:DrawText( 8.5,  1, 'Bill To',     '@!', 6, , 270 )
   oPDF:DrawText( 8.5, 52, 'Ship To',    
'@!', 6, , 270 )
   oPDF:DrawText( 62, 0, '05/2014',    
'@!', 6 )
   // Draw Masks
   oPDF:DrawRetangle( 15.35, 0, 95, 1, , 3, {0.75, 0.75, 0.75} )    // Header
   oPDF:DrawRetangle( 17.35, 0, 95, 1, , 3, {0.75, 0.75, 0.75} )    // Detail
   for x = 1 to 32 STEP 2
      oPDF:DrawRetangle( x + 18.3, 0, 95, 1.1, , 3, {0.95, 0.95, 0.95} )
   next x
   // Box around header and details
   oPDF:DrawRetangle( 15.35, 00, 95, 55 )
   //Header Columns
   oPDF:DrawLine( 15.35, 09, 17.3, 09)
   oPDF:DrawLine( 15.35, 21, 17.3, 21)
   oPDF:DrawLine( 15.35, 39, 17.3, 39)
   oPDF:DrawLine( 15.35, 55, 17.3, 55)
   oPDF:DrawLine( 15.35, 72, 17.3, 72)
   oPDF:DrawText( 16, 01, 'Account No.',    
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 16, 11, 'Date Shipped',   
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 16, 23, 'Shipped Via',    
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 16, 40, 'F.O.B. Point',   
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 16, 59, 'Terms',          
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 16, 75, 'P.O. Number',    
'@!', 7, "Courier-Bold" )
   // Detail columns
   oPDF:DrawLine( 17.35, 06, 51.3, 06 )
   oPDF:DrawLine( 17.35, 12, 51.3, 12 )
   oPDF:DrawLine( 17.35, 18, 51.3, 18 )
   oPDF:DrawLine( 17.35, 30, 51.3, 30 )
   oPDF:DrawLine( 17.35, 75, 51.3, 75 )
   oPDF:DrawLine( 17.35, 85, 51.3, 85 )
   oPDF:DrawText( 18, 01, 'Qty Ord',        
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 18, 07, 'Qty Shp',        
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 18, 13, 'Qty B/O',        
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 18, 20, 'Product Code',   
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 18, 46, 'Description',    
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 18, 76, 'Unit Price',     
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 18, 89, 'Amount',         
'@!', 7, "Courier-Bold" )
    // Trailer
   oPDF:DrawLine( 51.3, 0, 51.3, 95 )
   oPDF:DrawText( 52, 1, 'Comments',    
'@!', 6 ) //, , 270 )
   oPDF:DrawRetangle( 51.4, 65, 20, 11.7, ,3 , {0.75, 0.75, 0.75} ) //Total Box
   oPDF:DrawText( 52, 75, 'Subtotal',  
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 53, 75, 'GST/HST',   
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 54, 75, 'PST',       
'@!', 7, "Courier-Bold" )
   oPDF:DrawText( 61, 75, 'Total',     
'@!', 12, "Helvetica-Bold" )
RETURN nil


---<End Code>---

Qatan

unread,
May 21, 2014, 7:41:52 AM5/21/14
to harbou...@googlegroups.com
>Hello José,
>You made a difficult job simple. Well done and thank you. 
>Attached is what I have been able to do using PDFClass.
 
Nice job. It’s a very nice class that comes to help us!
I did something similar but not with class and less powerful / flexible than what José did but worked for me.
Look what I get from it (PDF attached).
The differential is that it generates the PDF based on a TXT file that contains instructions (also attached).
Not a so good idea but it was handy to me in a certain specific situation.
I have to admit that José’s class seems a better idea and seems to be better done (I mean the code and it’s structure).
Anyway I share here for fun.
If someone is interested I can share the whole code and even an unrevised manual that goes with the program (as is).
It’s an unfinished tool – mainly because it was good enough for what I was doing so I didn’t invest too much time on it...
Harbour rocks!
Regards,
 
Qatan
 
 
Invoice.txt
Invoice.pdf

Wilson Gamboa

unread,
May 21, 2014, 12:59:21 PM5/21/14
to harbou...@googlegroups.com
Qatan, excelent job!
can you please share this source ?
many thanks in advance

Wilson


--

Ernad Husremovic

unread,
May 21, 2014, 1:07:59 PM5/21/14
to harbou...@googlegroups.com
Hello Ash,
Thank you for your contribution.

I have put that source into my github repository harbour_playground:


There are some small changes, mostly for bosnian diacritics support (šŠ ćĆ žŽ etc)

Generated sample is also pushed into repos:

 
Regards,
Ernad


--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

---
You received this message because you are subscribed to a topic in the Google Groups "Harbour Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/harbour-users/XZd8IQzzL24/unsubscribe.
To unsubscribe from this group and all its topics, send an email to harbour-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Ernad Husremovic

Ernad Husremovic

unread,
May 21, 2014, 1:12:05 PM5/21/14
to harbou...@googlegroups.com
Qatan,  without doubt your contribution would bi valuable to the community.

Regards,
Ernad

Qatan

unread,
May 25, 2014, 5:56:16 AM5/25/14
to harbou...@googlegroups.com
Hello Wilson,
 
>Qatan, excelent job!
>can you please share this source ?
>many thanks in advance
 
Thanks!
I shared it on this list.
Did you get the files?
 
Qatan
 
Reply all
Reply to author
Forward
Message has been deleted
0 new messages