[Module] pbPDF-Module

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] pbPDF-Module

Post by Thorsten1867 »

Version 2.0

I completely changed the internal structure of the module and adapted it to the structure of PDF documents (individual objects). Instead of taking the detour through countless LinkedLists, (most) data is now written directly into the objects.
The sourcecode has not only become more logical, easier to understand and clearer, but can now also be extended much more easily.

New:
  • Support of form fields (e.g. text field, checkbox, radio button & combo box)
  • AddGotoLabel() for navigation in the PDF document. (e.g. jump from the command overview via link to the corresponding page)
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: [Module] pbPDF-Module

Post by luis »

Interesting, thanks for sharing it.
"Have you tried turning it off and on again ?"
A little PureBasic review
morosh
Enthusiast
Enthusiast
Posts: 293
Joined: Wed Aug 03, 2011 4:52 am
Location: Beirut, Lebanon

Re: [Module] pbPDF-Module

Post by morosh »

thanks for sharing, really useful
I tried to put some arabic characters, it's got transformed to ??????, unicode isn't supported?
PureBasic: Surprisingly simple, diabolically powerful
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] pbPDF-Module

Post by Thorsten1867 »

At the moment only Unicode characters up to 65536 are supported. Accessing characters above 65536 is very complicated.

Gesendet von meinem BAH2-W19 mit Tapatalk
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
infratec
Always Here
Always Here
Posts: 6866
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: [Module] pbPDF-Module

Post by infratec »

Hi,

I just tested your module for the first time and ... failed.

Because I always use #PB_Any for creations. (PDF = PDF::Create(#PB_Any))
I don't know exactly why it fails, but the document is empty when I use this.
Maybe it is not allowed to use 0 as ID. And when I use the code above PDF is 0.

Here is my small addition to your code:

Code: Select all

  Procedure.i Create(ID.i, Orientation.s="P", Unit.s="", Format.s="")  ; [*]
    Define objRes.i, Result.i
    
    If ID = #PB_Any
      Repeat
        ID = Random(99999, 1000)
      Until Not FindMapElement(PDF(), Str(ID))
    EndIf
With this small addition and ID as return value (or 0 if AddMapElement() fail) I'm able to use my normal coding style.

And thanks for your many coding stuff during the last months.

Bernd
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] pbPDF-Module

Post by Thorsten1867 »

You can add following code after 'Define ....'.

Code: Select all

If ID = #PB_Any : ID = MapSize(PDF()) + 1 : EndIf
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
infratec
Always Here
Always Here
Posts: 6866
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: [Module] pbPDF-Module

Post by infratec »

Yes, of course.
But in my version, like in PB, the lower numbers are still free for 'normal' use :mrgreen:
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] pbPDF-Module

Post by Thorsten1867 »

infratec wrote:Yes, of course.
But in my version, like in PB, the lower numbers are still free for 'normal' use :mrgreen:
They are not gadget numbers and the numbers are used exclusively for pbPDF.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
infratec
Always Here
Always Here
Posts: 6866
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: [Module] pbPDF-Module

Post by infratec »

A file is also no gadget.
But if you not want to include it: simply write 'I don't want to do this in my code'
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] pbPDF-Module

Post by Thorsten1867 »

infratec wrote:A file is also no gadget.
But if you not want to include it: simply write 'I don't want to do this in my code'
No, I just meant that pbPDF doesn't use gadget numbers or file numbers and you don't have to care about it.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] pbPDF-Module

Post by Thorsten1867 »

Added: #PB_Any

Code: Select all

If ID = #PB_Any
  ID = 1 : While FindMapElement(PDF(), Str(ID)) : ID + 1 : Wend
EndIf
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
loulou2522
Enthusiast
Enthusiast
Posts: 501
Joined: Tue Oct 14, 2014 12:09 pm

Re: [Module] pbPDF-Module

Post by loulou2522 »

Hi all,
Can someo one know how to generate PDF/X-3 with this excelent programm or with Gs (ghostscript) ?
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] pbPDF-Module

Post by Thorsten1867 »

Bugfix: Embed PNG images
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] pbPDF-Module

Post by Thorsten1867 »

Bugfix: AutoPageBreak
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] pbPDF-Module

Post by Thorsten1867 »

Update:
  • Bugfix: Preferences for footer (AutoPageBreak)
  • Bugfix: AddPage (Fonts)
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Post Reply