VecVi - Create and output documents using VectorDrawing lib

Share your advanced PureBasic knowledge/code with the community.
Andesdaf
User
User
Posts: 63
Joined: Sun Mar 22, 2009 2:53 pm
Location: GER, Saxony

VecVi - Create and output documents using VectorDrawing lib

Post by Andesdaf »

Hi,

I've written this for another project where I needed a print preview and some advances features for creating
documents (and later print them or save them to pdf) like automatic page breaks, headers, footers etc.

Main features:
  • creating a document once and later output it to CanvasGadet, Window, Image, printer, pdf (not windows) or svg (only Linux)
  • text and image cells with custom border, filling, text alignment, font etc.
  • horizontal, vertical and free lines
  • rectangles, curves, ellipses and ellipse segments
  • auto-invoked headers and footers, for the whole document or for a single page
  • auto page breaks
  • avoiding page breaks within connected element blocks
  • auto page numbers with free start value, excluding of pages from numbering, total number of pages etc.
  • possibility to display the document as single pages or as a list of pages (for print preview, see example code)
It's still work in progress and not tested in all cases, but I think I'ts already useable.

code: https://raw.githubusercontent.com/hgzh/ ... r/VecVi.pb
example: https://raw.githubusercontent.com/hgzh/ ... preview.pb

Image
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: VecVi - Create and output documents using VectorDrawing

Post by collectordave »

Nice work.

Did you try

http://www.purebasic.fr/english/viewtop ... 12&t=67703

The purePDF module on the forum can also be used to create PDF documents on windows systems.

Regards

CD
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: VecVi - Create and output documents using VectorDrawing

Post by Kwai chang caine »

Thanks a lot for sharing this great code 8)
Works fine here W7 x86 / V5.61 x86
ImageThe happiness is a road...
Not a destination
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: VecVi - Create and output documents using VectorDrawing

Post by Andre »

Very interesting! Runs fine here on Win10, thank you :D
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Andesdaf
User
User
Posts: 63
Joined: Sun Mar 22, 2009 2:53 pm
Location: GER, Saxony

Re: VecVi - Create and output documents using VectorDrawing

Post by Andesdaf »

After a long time, I uploaded a new version with some smaller bug fixes and
a new output channel (image on canvas) to improve performance.

I've also written a fork of VecVi that uses PurePDF to create pdf files on windows,
if someone is interested in this, I can publish it, too.
User avatar
skywalk
Addict
Addict
Posts: 3972
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: VecVi - Create and output documents using VectorDrawing

Post by skywalk »

This has potential as a Report Generator. 8)
Not sure why pdf would not work on Windows?
This version does not have a save to pdf option?
v.1.06 (2019-01-31)
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
CELTIC88
Enthusiast
Enthusiast
Posts: 154
Joined: Thu Sep 17, 2015 3:39 pm

Re: VecVi - Create and output documents using VectorDrawing

Post by CELTIC88 »

very good project, thank you for sharing :D
 
interested in Cybersecurity..
Andesdaf
User
User
Posts: 63
Joined: Sun Mar 22, 2009 2:53 pm
Location: GER, Saxony

Re: VecVi - Create and output documents using VectorDrawing

Post by Andesdaf »

skywalk wrote:Not sure why pdf would not work on Windows?
I use PB's PdfVectorOutput() which is not supported on Windows. On Linux and MacOS,
you can use VecVi::OutputPDF(). For PDF output on Windows, there is the fork with
PurePDF usage mentioned in my previous post.
Andesdaf
User
User
Posts: 63
Joined: Sun Mar 22, 2009 2:53 pm
Location: GER, Saxony

Re: VecVi - Create and output documents using VectorDrawing

Post by Andesdaf »

Updated to v.1.10, mainly for improving the performance of the print preview with larger data.
Now only the elements that need to be displayed will be calculated before. In addition some
minor improvements, clarifications and bugfixes.

Code: Select all

;   v.1.10 (2020-07-24)
;    - completely reworked processing and drawing engine
;    - added Process()
;    - added GetBackColor() / SetBackColor()
;    - added reset possibility to SetFillColor(), SetTextColor(),
;      SetLineColor(), SetLineStyle()
;    - renamed *Page*() commands to *Section*() for clarification
;    - renamed GetRealPageCount() to GetPageCount()
;    - renamed GetRealPageStartOffset() to GetPageStartOffset()
;    - renamed *SinglePageOutput() commands to *MultiPageOutput()
;    - fixed bug in GetLineStyle()
;    - fixed various bugs in processing and drawing engine
;    - drawing of bigger documents is now much faster
Versions with PurePDF and pbPDF implementation (on Windows without PDF support) also available
https://raw.githubusercontent.com/hgzh/ ... PurePDF.pb
https://raw.githubusercontent.com/hgzh/ ... i_pbPDF.pb
Post Reply