Library for Server : problem with file path

If you have any questions regarding Quartam PDF Library for LiveCode, this is the place to get answers from your fellow users - experts and newbies alike.
Post Reply
bangkok
Posts: 3
Joined: Mon Feb 25, 2013 3:08 pm

Library for Server : problem with file path

Post by bangkok » Mon Feb 25, 2013 3:11 pm

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 ?

JanSchenkel
Site Admin
Posts: 110
Joined: Sun Jul 18, 2010 5:21 pm
Location: Aalst, Belgium
Contact:

Re: Library for Server : problem with file path

Post by JanSchenkel » Mon Feb 25, 2013 9:30 pm

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.
Quartam Developer Tools for LiveCode
http://www.quartam.com

bangkok
Posts: 3
Joined: Mon Feb 25, 2013 3:08 pm

Re: Library for Server : problem with file path

Post by bangkok » Tue Feb 26, 2013 7:53 pm

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 ]

bangkok
Posts: 3
Joined: Mon Feb 25, 2013 3:08 pm

Re: Library for Server : problem with file path

Post by bangkok » Tue Feb 26, 2013 7:58 pm

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.

JanSchenkel
Site Admin
Posts: 110
Joined: Sun Jul 18, 2010 5:21 pm
Location: Aalst, Belgium
Contact:

Re: Library for Server : problem with file path

Post by JanSchenkel » Wed Feb 27, 2013 10:10 pm

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.
Quartam Developer Tools for LiveCode
http://www.quartam.com

Post Reply