PurePDF Version 2.0

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Klaus,
and I thought that when the help file says this:
  • Style$
    Font style. Possible values are (case insensitive):
    - empty string: regular
    - B: bold
    - I: italic
    - U: underline
    or any combination.
the dash is part of the parameter.
Shame on me :oops:

Thanks for clearing this up.
fsw

BTW: thank you for this cool library.
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

Question about pdf_ImageMem:
why is there a need for a file name?
The help file says:
  • Puts an image in the page.
    In general this is the same as pdf_Image(), except that it loads the image from memory.
I've tested it and it seems without the file name no image is loaded.
Even if a wrong memory pointer is used the image is loaded as long a file name is used.
This suggests that the image is loaded from the name and not by it's pointer.

Is it possible to use the only the memory pointer (with ImageID) ?

Thanks
fsw
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

The names are stored internally, so if you add an image with the same name its not loaded twice :wink:
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

Hi ABBKlaus,

using pdf_MultiCell() in a footer-procedure causes an IMA (write error at address -42)... :cry:
I'm using PB4.20beta2 and PurePDF209....
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

walker wrote:using pdf_MultiCell() in a footer-procedure causes an IMA (write error at address -42)... :cry:
I'm using PB4.20beta2 and PurePDF209....
I see : Tutorial03.pb is crashing in ChapterBody() on the ProcedureReturn !

Sorry, its related to this PB4.20B2 bug http://www.purebasic.fr/english/viewtopic.php?t=30840
There´s nothing i can do in the moment :oops:
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

Code: Select all

Procedure.s pdf_SkipCell(w.f, h.f, Text$, border.w=0, Ln.f=0, Align$=#PDF_ALIGN_LEFT, Fill.f=0)
  Protected Cwidth, SkipLen.l, skip$
  Cwidth = w - (ipf_GetCMargin()*2)
  If pdf_GetStringWidth(Text$) <= Cwidth
    pdf_Cell(w, h, Text$, border, Ln, Align$, Fill)
  Else
    SkipLen = Len(Text$)
    Repeat
      SkipLen - 1
      skip$ = Left(Text$, SkipLen)+"..."
    Until pdf_GetStringWidth(skip$) <= Cwidth
    pdf_Cell(w, h, skip$, border, Ln, Align$, Fill)
    ProcedureReturn Right(Text$, Len(Text$)-SkipLen)
  EndIf
EndProcedure
[Edit]Bugfix: Calc cell marigins[/Edit]

Perhaps this function can be included in PurePDF.
Last edited by Thorsten1867 on Thu May 01, 2008 12:42 pm, edited 1 time in total.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

Thanks Thorsten1867 :D

New version PurePDF v2.10 : http://www.purebasicpower.de/?PurePDF
PurePDF V2.10 for PB4.10
PurePDF V2.10 for PB4.20B4
-new pdf_SkipCell (made by Thorsten1867)
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

Great!

I found a bug. Now the text width should be correct (cell margins!).
It's a should be better named 'TruncCell' (truncted cell).

Code: Select all

; works only as PurePDF library (Don't use it direct)

Procedure.s pdf_TruncCell(w.f, h.f=0, Text$="", Border.w=0, Ln.f=0, Align$="", Fill.f=0, Link.w=-1)
  Protected wMax.f, TLen.l, trunc$
  wMax = w - (2 * pdfCMargin) 
  If pdf_GetStringWidth(Text$) <= wMax
    pdf_Cell(w, h, Text$, Border, Ln, Align$, Fill, Link)
  Else
    TLen = Len(Text$)
    Repeat
      TLen - 1
      trunc$ = Left(Text$, TLen)+"..."
    Until pdf_GetStringWidth(trunc$) <= wMax
    pdf_Cell(w, h, trunc$, Border, Ln, Align$, Fill, Link)
    ProcedureReturn Right(Text$, Len(Text$)-TLen)
  EndIf
EndProcedure
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
walker
Enthusiast
Enthusiast
Posts: 634
Joined: Wed May 05, 2004 4:04 pm
Location: Germany

Post by walker »

Hi ABBKlaus,

thanks for the new version :D :D

one issue... the #PUREPDF_VERSION is still 4.10 ... (at least in the sourcefile.. so i guess in the lib too)
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

thanks i noticed that too :oops:
This time i tested it myself :wink:

New version PurePDF v2.11 : http://www.purebasicpower.de/?PurePDF
PurePDF V2.11 for PB4.10
PurePDF V2.11 for PB4.20B4
-new pdf_TruncateCell (made by Thorsten1867)
-fixed pdf_Link was broken
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

Example code:

Code: Select all

;{ ========== StartPDFDoc ==========
pdf_Create("P", "mm", #PDF_PAGE_FORMAT_A4)
pdf_SetTitle("TestPDF")
pdf_SetTopMargin(15)  
pdf_SetLeftMargin(15)  
pdf_SetRightMargin(15)  
pdf_SetAutoPageBreak(1, 15)  
pdf_AddPage("P")
pdf_SetFont("Arial", "", 11)
;} ==============================

pdf_Cell(35,6, "That is a long text to test it.", 1, 1)
pdf_TruncateCell(35,6, "That is a long text to test it.", 1, 1)
pdf_Ln(3)
pdf_Cell(43,6, "That is a long text to test it.", 1, 1)
pdf_TruncateCell(43,6, "That is a long text to test it.", 1, 1)

;{ ========== EndPDFDoc ==========
pdf_Save("E:\Temp\Ausgabe.pdf")
;} =============================
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

i don't know if i said this before, but thanks a lot for this library. We use it every single day at the company for a little program to generate reports :)
User avatar
Thorsten1867
Addict
Addict
Posts: 1372
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Post by Thorsten1867 »

In V2.11 seems to be a bug. pdf_MultiCell() causes a memory error.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

Thanks, i fixed that bugs. Some examples where not working either.
Thorsten i added your example as Tutorial19.pb.

The PB4.20 version crashes in some example, please do not post this as bug ! (They are all string related)

Please redownload V2.11 : http://www.purebasicpower.de/?PurePDF
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Klaus, is the threadsafe version of this library really threadsafe considering the number of global linked-lists being used etc?
I may look like a mule, but I'm not a complete ass.
Post Reply