Page 1 of 2

Saving a PDF file to a new stack?

Posted: Mon Oct 28, 2013 12:41 am
by shawnblc
Can you save a PDF file to a stack or a card? If so how do you go about this. I'm still trying to figure this one out. I can save the path, but not having luck with the file itself.

Re: Saving a PDF file to a new stack?

Posted: Mon Oct 28, 2013 1:17 am
by dunbarx
Hi.

Pretty sure you can store it as a custom property of the stack.

Craig Newman

Re: Saving a PDF file to a new stack?

Posted: Mon Oct 28, 2013 4:30 pm
by Klaus
Hi Shawn,

do this:
1. "Suck" PDF IN:
...
set the cStoredPDF of this stack to url("binfile:" & tPath_to_PDF_here)
## Don't forget to save the stack!
...

2. "Spit" out:
...
put the cStoredPDF of this stack into url("binfile:" & tNew_Path_to_PDF_here)
...


Best

Klaus

Re: Saving a PDF file to a new stack?

Posted: Thu Oct 31, 2013 3:20 am
by shawnblc
Is there a sample of saving a pdf file to a stack? I've searched here and the livecode tutorials and haven't seen anything. Thanks.

Re: Saving a PDF file to a new stack?

Posted: Thu Oct 31, 2013 3:26 am
by FourthWorld
See the post immediately above yours.

Re: Saving a PDF file to a new stack?

Posted: Thu Oct 31, 2013 3:40 am
by shawnblc
FourthWorld wrote:See the post immediately above yours.
Richard, I read that and added it to a button to test out, guess I'm not understanding it though ;)
Still searching and reading though.

Re: Saving a PDF file to a new stack?

Posted: Thu Oct 31, 2013 3:54 am
by Simon
Hi shawnblc,
Do you know how to use custom properties?

Simon

Re: Saving a PDF file to a new stack?

Posted: Thu Oct 31, 2013 3:56 am
by shawnblc
Simon wrote:Hi shawnblc,
Do you know how to use custom properties?

Simon
Maybe that's what I need to read up on. Going to read up on it now. I'll come back to this post. Thanks for the info.

Re: Saving a PDF file to a new stack?

Posted: Thu Oct 31, 2013 4:08 am
by Simon
Using the property inspector use the drop down and select Custom Properties.
Then it's just like making a variable (just add any name you like maybe...cStoredPDF?), you don't have to put anything in it as Klaus's code will do that.

It's easy really, just not immediately obvious.

Simon
Edit: Oh... use the stack inspector

Re: Saving a PDF file to a new stack?

Posted: Thu Oct 31, 2013 5:59 pm
by shawnblc
Maybe I'm making this more complicated than it needs to be.

I'm not drinking either.

Re: Saving a PDF file to a new stack?

Posted: Thu Oct 31, 2013 6:29 pm
by Klaus
HI Shawn,

you're almost there :D
...
answer file "select PDF file"

## "/Users/Shawn/Desktop" ???
## This is NOT the file the user selected but a FOLDER!
## This will not work, means the CP is still empty!
## set the cStoredPDF of this stack to url("binfile:" & "/Users/Shawn/Desktop")

## Set the Custpom Prop to the file that has just selected!
set the cStoredPDF of this stack to url("binfile:" & IT)
...

Best

Klaus

Re: Saving a PDF file to a new stack?

Posted: Fri Nov 01, 2013 1:53 am
by shawnblc
Hmmmmmm. Haven't given up and won't.

Re: Saving a PDF file to a new stack?

Posted: Fri Nov 01, 2013 2:18 am
by Simon
This is better:
put the cStoredPDF of this stack into url("binfile:" & specialFolderPath("desktop") &"/savePDF.pdf")

I found trying to look at the Custom Property of the stack would hang the IDE.

Simon

Re: Saving a PDF file to a new stack?

Posted: Fri Nov 01, 2013 2:33 am
by shawnblc
Simon wrote:This is better:

I found trying to look at the Custom Property of the stack would hang the IDE.

Simon
Using 6.1.2 rc3 bld 2015 and 6.5.0 dp-2 I'm not having that issue. Using Mac OSX w/ Mavericks 10.9.

Let me try what you suggest now. This is driving me crazy. It's insignificant, but yet it's consuming me. lol.

Re: Saving a PDF file to a new stack?

Posted: Fri Nov 01, 2013 11:53 am
by Klaus
shawnblc wrote:Hmmmmmm. Haven't given up and won't.
Success! :D
...
set the cStoredPDF of this stack to url("binfile:" & IT)
save stack "savePDF"
## Don't forget to add the correct SUFFIX -> binfile:/Users/Shawn/Desktop/savePDF.PDF
put the cStoredPDF of this stack into url("binfile:/Users/Shawn/Desktop/savePDF")
...