PurePDF 2.0 Update

Just starting out? Need help? Post your questions and find answers here.
normeus
Enthusiast
Enthusiast
Posts: 492
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

PurePDF 2.0 Update

Post by normeus »

For those looking to start creating PDFs using PB, I sugest using Thorsten1867's pbPDF-Module:
https://www.purebasic.fr/english/viewto ... 27&t=72031

This update is for those who cannot change their program to pbPDF from PurePDF 2.0.
It contains all the sugestions and fixes from the forum, and it compiles with PB6.11x64 and PB6.03x64. I also included the original examples.I placed the files here:

https://normeus.com/purepdf/

When loading fonts, PurePDF will load the font from the font directory. If you are trying to use Bold or Italic there should be a separate font file for the style, for example in the fonts folder, there is a verdana.ttf,verdanab.ttf, and also verdanai.ttf



Thank you.
Norm
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
User avatar
Lord
Addict
Addict
Posts: 914
Joined: Tue May 26, 2009 2:11 pm

Re: PurePDF 2.0 Update

Post by Lord »

Hi normeus

Thank you for updating PurePDF to v2.27!
Works great with PB v6.11LTS(x64).

Lord
Image
BarryG
Addict
Addict
Posts: 4343
Joined: Thu Apr 18, 2019 8:17 am

Re: PurePDF 2.0 Update

Post by BarryG »

Don't forget that from 6.10 the Vector lib can create PDF files. May be a useful alternative for new apps.
normeus
Enthusiast
Enthusiast
Posts: 492
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: PurePDF 2.0 Update

Post by normeus »

@BarryG, Thanks for the info. I installed 6.11x64 last month and had not kept up with the new commands. Looks like PdfVectorOutput() uses "Haru Free PDF Library 2.4.4". I think it would be great for regular PDFs, but if you need Bookmarks or other specialty PDF items Like attaching files or creating notes then you are better off with pbPDF-Module.

@Lord, you are welcome. Remember, any new projects use pbPDF-Module and if it is a simple PDF project then you might want to try the Vector library of PB6.10 and greater

Happy Coding!
Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
User avatar
Lord
Addict
Addict
Posts: 914
Joined: Tue May 26, 2009 2:11 pm

Re: PurePDF 2.0 Update

Post by Lord »

Hi normeus!
normeus wrote: Tue Jul 09, 2024 9:48 pm ...
@Lord, you are welcome. Remember, any new projects use pbPDF-Module and if it is a simple PDF project then you might want to try the Vector library of PB6.10 and greater
...
I appreciate your tips, but I will stay with your PurePDF as it is
an elemental part of my program since 2011.
And because this program is only for my personal use, nobody is hurt
if something is not working as expected, except me.
All other implementations of pdf for PB don't fit my needs.
(Or I didn't dive deep enough in them)
Image
normeus
Enthusiast
Enthusiast
Posts: 492
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: PurePDF 2.0 Update

Post by normeus »

I modified line 3442 on PUREPDF:
It used to be:

Code: Select all

 If ipdf_TTF_Handle_Head(Fonts(),*head)
and it should be

Code: Select all

 If ipdf_TTF_Handle_Head(Fonts(),*head)  And Fonts()\numglyphs>1
This is for those who use Windows and use PB loadfont to select a font for PUREPDF ( in case the font cannot be loaded )

I did change the source on my downloads page, but I figured since it is just one line, it would be easier to change it yourself instead of downloading the file again.
https://normeus.com/data/uploads/pb/pb227/PurePDF.pb

Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5709
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: PurePDF 2.0 Update

Post by Kwai chang caine »

Thanks for sharing your works 8)
I always wondering why it's different to create a PDF and read an existing PDF ?
This is a probem of license ? It's forbiden because ADOBE rights ?
Or a technical problem, because the documents PDF is much hard to manage that the image PDF :|
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
normeus
Enthusiast
Enthusiast
Posts: 492
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: PurePDF 2.0 Update

Post by normeus »

KCC,
In the simplest terms, a PDF is just a text file with instructions in how to display the objects contained on each page.

PUREPDF and also PBPDF create PDFs they are not meant to open an existing PDF.
To create a PDF you only need the data, text,fonts, images, etc.. and their location on the page ( actually a bit more info, but you get the idea). you put all those objects together and you are done.

For opening a PDF to be edited, you have to read all those objects and assuming you want to add text you have to create an object for text and figure out the position so that you do not mess up with the position of the other objects.

The simplest most generic program would open a PDF create a text object overlay and always place it at a certain location, or you can adjust the object location depending on the parameters you give it.

You see, each case would be different so depending on the requierements that's how you would have to create the program.

Infratec has a nice sample of reading text from a PDF using PDFIUM:
viewtopic.php?p=553210#p553210

This is another question about PDFIUM ( and some instructions in how to get it to work):
viewtopic.php?p=614328#p614328

Finally, Acreis created an include file with all the functions of PDFIUM: ( I did not try it but it looks good )
viewtopic.php?p=496177#p496177

Let PDFIUM do the work of opening and reading the objects of a PDF and you can do whatever you need to those and save the output as a new PDF

Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5709
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: PurePDF 2.0 Update

Post by Kwai chang caine »

Thousands thanks for this kindness and detailled explanations 8)
I take a look on your links :wink:
Have a very good day
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
Post Reply