Last edit on this one. I had a chance to work on this so it should now work Unicode, ASCII
and string replacement is functional (i.e. using {nb} ) I didn't change this post so that the chain of posts after it makes sense. For code see post:
http://www.purebasic.fr/english/viewtop ... 65#p495665
[EDIT 10/10/2016]
1. use Chr(14) instead of Chr(16)
2. I also changed the code on the HACK please download it again.
(This will work with Unicode ASCII Unicode font and ASCII font )
( I don't have the time to fix Unicode string compare and that's why a single char replacement string
is currently the workaround )
see edit 9/25/2016
[EDIT 9/25/2016]
For the footer to be displayed with any font you'll have to change the replacement string to a single char.
Add this to your pdf create page: ( I am using chr(14) as the replacement string
Code: Select all
pdf_AliasNbPages(Chr(14))
Code: Select all
Procedure Footer()
Protected ftext.s="Page "+Str(pdf_GetPageNo())+"/"+Chr(14)
pdf_SetY(-15);
pdf_SetFont("MS Sans Serif","I",10)
pdf_Cell(0,10,ftext,0,0,#PDF_ALIGN_CENTER);
EndProcedure
[EDIT]
After reading all 28 pages of messages, I saw that unicode works.
You have to use a font which contains the characters you are going to use.
here is a fix ( more like a hack ) for footer numbers not printing right in unicode. Replace this procedure in "PurePDF.pb" which forces footer numbers to be ascii:
[EDIT CODE FROM 10/10/2016]
Code: Select all
Procedure MEM_DataReplace(*aData.MEM_DataStructure, aSource.s, aDest.s)
Protected vSourceLen,vDestLen,vCurSize,vMaxSize,vCount,vFind,*tmp,vReturn,i,j,*vaSource
Protected vLen,*vaDest,vaDestString ; Needed to HACK unicode to ASCII
vSourceLen = StringByteLength(aSource); changed to StringByteLength for unicode
*vaSource = AllocateMemory(vSourceLen); created a temp buffer for unicode
PokeS(*vaSource,aSource,vSourceLen,#PB_String_NoZero|#PB_Ascii);saved string to mem to compare mem not string ; HACK - copy string to buffer IN ASCII because MEM_DataStructure is ASCII
vLen = SizeOf(Character) ; find out if unicode or ASCII to HACK code
vSourceLen=vSourceLen/vlen ; HACK - if unicode cutdown size to ascii
vDestLen = StringByteLength(aDest) ; changed to StringByteLength
*vaDest=AllocateMemory(vDestLen) ; HACK - needed to change number to ASCII
PokeS(*vaDest,aDest,vDestLen)
vCurSize = *aData\lCursize
vMaxSize = *aData\lMaxsize
vFind = 0
vReturn = #True
If (vDestLen > vSourceLen)
For i = vCurSize To 0 Step -1
vCount= 0
For j = 0 To vSourceLen-1
If PeekB(*aData\pData + i - vSourceLen + j ) = PeekB(*vaSource+j)
vCount = vCount + 1
EndIf
Next
If vCount = vSourceLen
vFind = vFind + 1
EndIf
Next
If (vFind > 0)
vReturn = MEM_DataInit(*aData, vMaxSize + (vFind*(vDestLen - vSourceLen))) ; = #False
EndIf
EndIf
If vReturn = #True
*tmp = AllocateMemory((vDestLen + vCurSize) - vSourceLen)
If *tmp
For i = vCurSize To 0 Step -1
vCount= 0
For j = 0 To vSourceLen-1
If PeekB(*aData\pData + i - vSourceLen + j ) = PeekB(*vaSource+j)
vCount = vCount + 1
EndIf
Next
If vCount = vSourceLen
CopyMemory(*aData\pData + i, *tmp, *aData\lCurSize - i)
; CopyMemory(@aDest, *aData\pData + i - vSourceLen , vDestLen) ; this one will work when the unicode issue gets solved
CopyMemory(*vaDest, *aData\pData + i - vSourceLen , vDestLen ) ; HACK - using new ASCII sized location
CopyMemory(*tmp, *aData\pData + (i-(vLen-1)) - vSourceLen + vDestLen, *aData\lCurSize - i) ; COPY according to ASCII or UNICODE
*aData\lCurSize = *aData\lCurSize + (vDestLen-vSourceLen)
EndIf
Next
FreeMemory(*tmp)
Else
vReturn = #False
EndIf
EndIf
FreeMemory(*vaSource) ; used to search as memory and not string
FreeMemory(*vaDest) ; HACK to change to ASCII
ProcedureReturn vReturn
EndProcedure