Re: PurePDF Version 2.0
Posted: Sat Sep 24, 2016 3:58 pm
[EDIT 9/25/2016]
so the easiest way around it is to change the replacement string to a single character or better yet, an unused control code like Chr(16)
This works on 5.42 LTS X64 unicode.
Norm.
so the easiest way around it is to change the replacement string to a single character or better yet, an unused control code like Chr(16)
Code: Select all
;Unicode example
;===============
#PurePDF_Include=1
xIncludeFile "\purepdf\Examples\PurePDF.pb" ; <-------- REPLACE THIS FILES LOCATION
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Linux
#ZLIB_IMPORT_PATH = #PB_Compiler_Home + "purelibraries/linux/libraries/zlib.a"
CompilerCase #PB_OS_Windows
#ZLIB_IMPORT_PATH = "zlib.lib"
CompilerCase #PB_OS_MacOS
#ZLIB_IMPORT_PATH = "/usr/lib/libz.dylib"
CompilerEndSelect
ImportC #ZLIB_IMPORT_PATH
compress.l(*dest, *destlen, *source, sourcelen)
EndImport
Procedure.l PDFCompress(*aData.MEM_DataStructure)
Protected zerr,CompMem,SourceLen,SourceMem,CompLen,lbError
lbError = #False
SourceLen = *aData\lCurSize
SourceMem = *aData\pData
CompLen = (Int(SourceLen/8000)+1)*8000 + 16
CompMem=AllocateMemory(CompLen)
If CompMem
zerr=compress(CompMem,@CompLen,SourceMem,SourceLen)
If zerr = 0
*aData\pData = CompMem
*aData\lMaxSize = CompLen
*aData\lCurSize = CompLen
;FreeMemory(Sourcemem) ; <- Crash with enabled purifier if run as TailBiten library
lbError = #True
EndIf
EndIf
ProcedureReturn lbError
EndProcedure
Procedure Footer()
pdf_SetY(-15);
pdf_SetFont("Arial","I",8);
pdf_Cell(0,10,"Page "+Str(pdf_GetPageNo())+"/"+Chr(16),0,0,#PDF_ALIGN_CENTER);
EndProcedure
Define File$
Define String$,StringWidth.d,i
File$=GetFilePart(#PB_Compiler_File)
File$=Mid(File$,1,Len(File$)-Len(GetExtensionPart(File$))-1)
pdf_Create()
pdf_SetProcFooter(@Footer())
pdf_AliasNbPages(Chr(16)); you need this to match your Footer procedure currently chr(16)
pdf_SetAuthor("PurePDF")
pdf_SetTitle(File$)
pdf_SetSubject("Unicode Text")
pdf_SetCreator("PurePDF")
pdf_SetKeywords(StringField(File$,1," "))
pdf_SetProcCompression(@PDFCompress())
pdf_AddPage()
pdf_SetFont("Lucida Sans Unicode","",28)
pdf_Text(20,30,"PUЯЭPƉƑ ǐs ҪʘʘΊ")
pdf_BookMark("Page 1a")
pdf_Text(20,50,"☺☻☼♀♂♠♣♥♦♪♫")
pdf_Text(20,70,Chr($107)+Chr($108)+Chr($109)+Chr($10A)+Chr($10B)+Chr($10C)+Chr($10D))
pdf_AddPage()
pdf_SetFont("Lucida Sans Unicode","",28)
pdf_Text(20,30,"PUЯЭPƉƑ ǐs ҪʘʘΊ")
pdf_Text(20,50,"☺☻☼♀♂♠♣♥♦♪♫")
pdf_Text(20,70,Chr($107)+Chr($108)+Chr($109)+Chr($10A)+Chr($10B)+Chr($10C)+Chr($10D))
pdf_Save(File$+".pdf")
RunProgram(File$+".pdf")
Norm.