PurePDF Version 2.0

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
luis
Addict
Addict
Posts: 3722
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Post by luis »

Hi Klaus, you certainly already knows this, but in any case....

Currently the library does a lot of memory allocation without testing for an out of memory condition.

I did modify the code for the images-related routines because I use only that part in my code (I made a purepdf "light" of some kind actually, thanks to the source availability), so it would be probably useless to post a "patch" this time in this thread because all the library in reality would require such a treatment.

Basically, I added some

Code: Select all

        
        pdfError = 99
        pdfErrorMessage$ = "Out of memory."
        vReturn = #False
if the return value of MEM_DataInit() is False.

What do you think ?

Bye and thank you.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

Thanks again luis,

changes are in :wink:
- added new error code 17 = out of memory
- fixed ipf_Escape() for special characters like BS TAB LF FF CR ( )
- fixed GetTimeZoneInformation_() thanks to Rescator for his tip
Download for PB4.2 : http://www.purebasicpower.de/downloads/ ... 4_PB42.zip
Download for PB4.30B4 : http://www.purebasicpower.de/downloads/ ... B43X86.zip
User avatar
luis
Addict
Addict
Posts: 3722
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Post by luis »

ABBKlaus wrote: - added new error code 17 = out of memory
Wow, great, thank you :-)
KIKI
Enthusiast
Enthusiast
Posts: 145
Joined: Thu Dec 28, 2006 11:49 am
Location: FRANCE

Post by KIKI »

Hi ABBKLAUS,
Did you plan to use forms with PDF ?
Thanks,
User avatar
fsw
Addict
Addict
Posts: 1496
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

There is a bug in this lib, when the second document is created the new orientation is ignored.

Code: Select all

;###############################################
pdf_Create("L","mm",#PDF_PAGE_FORMAT_LETTER)
pdf_AliasNbPages();
pdf_AddPage()
pdf_Save("PageFormat Landscape.pdf")

;###############################################
pdf_Create("P","mm",#PDF_PAGE_FORMAT_LETTER)
pdf_AliasNbPages();
pdf_AddPage()
pdf_Save("PageFormat Portrait.pdf")
Using PB4.3beta5 with the PB4.3PurePDF library.

Thanks for looking into it.
fsw
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

fsw wrote:There is a bug in this lib, when the second document is created the new orientation is ignored.
Thanks i found the bug, it was a missing ClearList(PagesF()).

Its now fixed, you have to redownload :wink:
User avatar
luis
Addict
Addict
Posts: 3722
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Post by luis »

Hi Klaus, the proc below

Code: Select all

  Procedure.b MEM_DataInit(*aData.MEM_DataStructure, aSize)
  Protected vReturn.b
  Protected vCurSize
  Protected vTmp
  
  ;aSize = (Int(aSize/64000)+1)*64000
  aSize=((aSize/64000)+1)*64000
  
  If *aData\pData = 0
    vCurSize = 0
    *aData\pData = AllocateMemory(aSize)
  Else
    vCurSize = *aData\lCurSize
    vTmp = ReAllocateMemory(*aData\pData, aSize)
    If vTmp <> 0 ; *aData\pData
      *aData\pData = vTmp
    EndIf  
  EndIf
    
  If *aData\pData = 0
    pdfError = 17
    vReturn = #False
  Else  
    *aData\lMaxSize = aSize
    *aData\lCurSize = vCurSize
    vReturn = #True
  EndIf  
  
  ProcedureReturn vReturn
EndProcedure
should be changed this way, I believe

Code: Select all

Procedure.b MEM_DataInit(*aData.MEM_DataStructure, aSize)
  Protected vReturn.b
  Protected vCurSize
  
  ;aSize = (Int(aSize/64000)+1)*64000
  aSize=((aSize/64000)+1)*64000
  
  If *aData\pData = 0
    vCurSize = 0
    *aData\pData = AllocateMemory(aSize)
  Else
    vCurSize = *aData\lCurSize
    *aData\pData = ReAllocateMemory(*aData\pData, aSize)
  EndIf
    
  If *aData\pData = 0
    pdfError = 17 
    vReturn = #False
  Else  
    *aData\lMaxSize = aSize
    *aData\lCurSize = vCurSize
    vReturn = #True
  EndIf  
  
  ProcedureReturn vReturn
EndProcedure

In the original code if the incoming *aData\pData is already allocated (not 0) and Realloc fails, the

Code: Select all

pdfError = 17 
vReturn = #False 
is not executed.
User avatar
fsw
Addict
Addict
Posts: 1496
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Post by fsw »

ABBKlaus wrote:
fsw wrote:There is a bug in this lib, when the second document is created the new orientation is ignored.
Thanks i found the bug, it was a missing ClearList(PagesF()).

Its now fixed, you have to redownload :wink:
@ Klaus:
It works again.
Thank you very much.

fsw
Tranquil
Addict
Addict
Posts: 942
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post by Tranquil »

Howdy Forum!

Ive got a little question regarding PurePDF. Is it possible to include "StringFields" which can be modified IN the PDF File as a form? (Like the StringGadget in PB for example)
Tranquil
GG
Enthusiast
Enthusiast
Posts: 225
Joined: Tue Jul 26, 2005 12:02 pm
Location: Lieusaint (77), France

Post by GG »

Hi all,

Is PurePDF 4.31 Pb compatible ?
Purebasic 5.72 64 bits - Windows 10 Pro 64 bits 2004
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

GG wrote:Hi all,

Is PurePDF 4.31 Pb compatible ?
PB 4.31 is only a bugfix release, so yes it should work.

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

Post by ABBKlaus »

Hi all,

i compiled PurePDF with the new PB4.40Beta1 (only to stop errors like 'SYS_AllocateString' :twisted: )

Please download here : http://www.purebasicpower.de/?download= ... B44X86.zip

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

Re: PurePDF Version 2.0

Post by ABBKlaus »

Update : PurePdf version 2.15 for PureBasic 4.4x x86
  • fixed startxref now points at xref
Regards Klaus
KIKI
Enthusiast
Enthusiast
Posts: 145
Joined: Thu Dec 28, 2006 11:49 am
Location: FRANCE

Error when compiling with PB 4.50 Beta 2

Post by KIKI »

Problem encountered with PB 450 beta 2 when compiling

POLINK Errror Unresolved external Symbol 'PB_CallFunctionFast'
POLINK Errror Unresolved external Symbol 'PB_CallFunctionFast2'
POLINK Errror Unresolved external Symbol 'Sys_FreeArray'
POLINK Errror Unresolved external Symbol 'Sys_AllocateArray'
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PurePDF Version 2.0

Post by ABBKlaus »

Update : PurePdf version 2.15 for PureBasic 4.5x x86

Regards Klaus
Post Reply