Page 5 of 32

Posted: Tue Mar 04, 2008 5:27 pm
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.

Posted: Sat Mar 08, 2008 6:49 am
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

Posted: Sat Mar 08, 2008 3:01 pm
by ABBKlaus
The names are stored internally, so if you add an image with the same name its not loaded twice :wink:

Posted: Mon Mar 17, 2008 10:07 pm
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....

Posted: Mon Mar 17, 2008 11:10 pm
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:

Posted: Wed Apr 30, 2008 6:22 pm
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.

Posted: Thu May 01, 2008 12:32 pm
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)

Posted: Thu May 01, 2008 12:44 pm
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

Posted: Thu May 01, 2008 10:18 pm
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)

Posted: Thu May 01, 2008 11:11 pm
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

Posted: Fri May 02, 2008 1:01 pm
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")
;} =============================

Posted: Fri May 02, 2008 1:15 pm
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 :)

Posted: Fri May 02, 2008 1:31 pm
by Thorsten1867
In V2.11 seems to be a bug. pdf_MultiCell() causes a memory error.

Posted: Fri May 02, 2008 7:51 pm
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

Posted: Fri May 02, 2008 8:03 pm
by srod
Klaus, is the threadsafe version of this library really threadsafe considering the number of global linked-lists being used etc?