PurePDF Version 2.0
The easiest approach i could think of is this :
Code: Select all
Global Mutex.l
Procedure Header()
pdf_Image("logo_purepdf.png",10,8,33)
pdf_SetFont("Arial","B",15)
pdf_Cell(80)
pdf_Cell(30,10,"Title",1,0,#PDF_ALIGN_CENTER)
pdf_Ln(20)
EndProcedure
Procedure Footer()
pdf_SetY(-15)
pdf_SetFont("Arial","I",8)
pdf_Cell(0,10,"Page "+Str(pdf_GetPageNo())+"/{nb}",0,0,#PDF_ALIGN_CENTER)
EndProcedure
Procedure Thread_A(Dummy.l)
Debug "Thread_A started"
LockMutex(Mutex)
Debug "Thread_A running"
pdf_Create()
pdf_SetProcFooter(@Footer())
pdf_SetProcHeader(@Header())
pdf_AliasNbPages();
pdf_AddPage();
pdf_SetFont("Times","",12);
For i = 1 To 40
pdf_Cell(0,10,"Printing line number "+Str(i),0,1);
Next
pdf_Save("PDF_Thread_A.pdf")
Debug "Thread_A finished"
UnlockMutex(Mutex)
EndProcedure
Procedure Thread_B(Dummy.l)
Debug "Thread_B started"
LockMutex(Mutex)
Debug "Thread_B running"
pdf_Create()
pdf_SetProcFooter(@Footer())
pdf_SetProcHeader(@Header())
pdf_AliasNbPages();
pdf_AddPage();
pdf_SetFont("Times","",12);
For i = 1 To 40
pdf_Cell(0,10,"Printing line number "+Str(i),0,1);
Next
pdf_Save("PDF_Thread_B.pdf")
Debug "Thread_B finished"
UnlockMutex(Mutex)
EndProcedure
Debug "Starting threads!"
Mutex=CreateMutex()
Thread_A=CreateThread(@Thread_A(),0)
Thread_B=CreateThread(@Thread_B(),0)
While IsThread(Thread_A) Or IsThread(Thread_B)
Delay(16)
Wend
Debug "Threads finished!"
its fixed, you can test it here : http://www.purebasicpower.de/downloads/ ... 2_PB42.zip
Note : you have to delete the old libraries yourself (PurePDFDraw/PurePDFMisc)
Note : you have to delete the old libraries yourself (PurePDFDraw/PurePDFMisc)
- DoubleDutch
- Addict
- Posts: 3219
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Is this a single lib that covers them all (purepdf/pdfmisc/pdfdraw)?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
version PUREPDF 12
All seems to works well
Thanks
Thanks
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
I found a bug in pdf_TruncateCell(), if w = 0. I've changed the code.
Code: Select all
; works only as PurePDF library (Don't use it direct)
Procedure.s pdf_TruncateCell(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$
If w = 0
w = pdfW - pdfRMargin - pdfX
EndIf
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]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Thanks Thorsten1867, the fix is integrated.
Download : http://www.purebasicpower.de/downloads/ ... 2_PB42.zip
Download : http://www.purebasicpower.de/downloads/ ... 2_PB42.zip
- DoubleDutch
- Addict
- Posts: 3219
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
I used to use some of the internal functions, such as : ipf_GetLMargin, ipf_GetRMargin, ipf_GetWidth, etc
Can these be made available as commands as the internal versions are not working (they are really useful).
Can these be made available as commands as the internal versions are not working (they are really useful).
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system