Page 1 of 1

Library for Server : problem with file path

Posted: Mon Feb 25, 2013 3:11 pm
by bangkok
I've installed the PDF library on a LiveCode Server.

Works very well. I worked with the "email with attachement" example you provided.

I have one small problem.

Files are created in /tmp/ directory.

I tried to modify the tTempFile, but no effect.

Is it possible to change the path ? So the library can create the PDF file within the current directory ?

Re: Library for Server : problem with file path

Posted: Mon Feb 25, 2013 9:30 pm
by JanSchenkel
Hi,

I guess you're referring to the following snippet from demo 19.

Code: Select all

      ## close the PDF document and save it to a temporary file
      local tTempFile
      put the tempName & ".pdf" into tTempFile
      qrtPDF_CloseDocument tDocRef
      qrtPDF_SaveDocument tDocRef, tTempFile
The tricky part is that the PDF output file needs to be stored in a directory the Apache HTTP Daemon can write to and the SendMail application can read from.
You can always try tweaking the above to the following variant:

Code: Select all

      ## close the PDF document and save it to a temporary file
      local tTempFile
      put "./output.pdf" into tTempFile
      qrtPDF_CloseDocument tDocRef
      qrtPDF_SaveDocument tDocRef, tTempFile
And then the code might be able to save the document in the same directory as your LiveCode Server script. However, a further complication is that there may be a small window in time where the output.pdf file is overwritten by the next request if two people hit the submit button in their browser at the same time.

What exactly are you trying to accomplish? Are you looking to save the PDF files for future reference? You could always send them to yourself in CC or BCC.

Jan Schenkel.

Re: Library for Server : problem with file path

Posted: Tue Feb 26, 2013 7:53 pm
by bangkok
JanSchenkel wrote: The tricky part is that the PDF output file needs to be stored in a directory the Apache HTTP Daemon can write to and the SendMail application can read from..
I was afraid to hear that.
:)

So i guess I need to play with Apache in order to set the proper rights... My idea was to put the PDF files within the same directory that contains my LC scripts, in order to ease future files manipulations (sending, deleting etc.) with LC scripts.

[so excited about Kickstarter... almost to the 350 000 mark :D ]

Re: Library for Server : problem with file path

Posted: Tue Feb 26, 2013 7:58 pm
by bangkok
OK solved. Thank you for the hint !

I just made a 777 permissions on a new directory within the directory that contains the LC script that creates the PDF library.

It's working fine now.

So now, I can continue to explore your -looking good- PDF library.

Re: Library for Server : problem with file path

Posted: Wed Feb 27, 2013 10:10 pm
by JanSchenkel
Re Kickstarter:
Seems I was a bit of a fore-runner when I decided to make a number of libraries available as LGPL/AGPL ;-)
But you're absolutely right, it's been an exciting campaign; and just when I thought it wasn't going to work, the pledges surged and now we're on to some fantastic stretch goals!

Anyway, have fun with the library! And if you have more questions, make sure to post them here...

Jan Schenkel.