After days of testing these are my inconclusive results:
I have 5200 images that should go in a pdf .
I load the file names from a csv file which also contains dates and locations.
There is a sqllite database created in memory so that I could sort by location or
other selections (like this location not that location ) so after the csv file is loaded
into the database my memory usage is 63KB.
I used:
Code: Select all
pdf_ImageMem(fname,m,z,l,t,180,135)
Debug pdf_GetErrorMessage()
Debug pdf_GetErrorCode()
Debug fname
and I got no errors but when I tried "Pdf_Image()
I got error "14" on certain jpg files I looked at the files and they were an odd size
(like 3500x1000).
I got rid of the whole resize function and I am just doing a straight
Code: Select all
If ResizeImage(pdf_1_img,544,408) ; original size has to be 1632x1224
;etc..
pdf_ImageMem(fname,m,z,l,t,180,135)
;etc..
EndIf
I realize, that; because I am using UseSQLiteDatabase() I am using extra memory.
I added EmptyWorkingSet() just before pdf_Save("large.pdf") and that gave me the biggest gain in pdf size. ( Thanx IdeasVacuum this piece of code really comes handy)
Code: Select all
EmptyWorkingSet()
pdf_Save("large.pdf")
;
end
Procedure EmptyWorkingSet()
;--------------------------
;Reduce memory use of current process
Protected *EmptyWorkingSet
Protected hDll.i = OpenLibrary(#PB_Any, "Psapi.dll")
If hDll
*EmptyWorkingSet = GetFunction(hDll, "EmptyWorkingSet")
If *EmptyWorkingSet
CallFunctionFast(*EmptyWorkingSet, GetCurrentProcess_())
EndIf
CloseLibrary(hDll)
EndIf
EndProcedure
so after the rezise of images I keep a running total of memory used
until I hit 134,300,069
( a number I came up after deleting a few pictures at a time until it worked.. Hours of JOY! )
then save pdf and start a new one.
This gave me a pdf with a final size of 141 meg. that is a decent size and I figured that because of the
extra memory I am using I would never get to the 198 meg that ABBKlaus got.( Thank you so much ABBKlaus for testing my program and maintaining PurePDF )
once I got the program running, I copied it to a faster computer with more memory ( 8 gig )
I only wanted to see just how fast the program could run.
Well, the PDF it created was bad! while saving it died at around 117meg
so changed my picture memory limit to 114,300,069 bytes and now it works on the faster machine.
The PDF created on the faster machine 122meg.
Same data, same pictures on my slow laptop 120 meg.
That is it, the program works with this 122meg limit.
I might do some more testing ( it takes a LONG... time to do a single test).
Thank you.
Norm.