Donkick Posted October 6, 2009 Posted October 6, 2009 I have a script that creates a PDF invoice to be e-mailed to my customer. I am using this script step: Save Record as PDF (Restore; No dialog; "$exportPath"; Records being browsed) Then the script attaches the PDf to an e-mail using the Send Mail script step. The problem is that many people are reporting that they cannot open the pdf, however if I manually save the pdf and then attach it to an e-mail they can open the PDF just fine. What is the difference? Any suggestions?
Donkick Posted October 6, 2009 Author Posted October 6, 2009 1 more point, the problem seems to be in "Save Record as PDF" because even if I manually save the file the script has created to another e-mail it won't open for my customers. It's only when I manually save the PDF that it works.
Donkick Posted October 6, 2009 Author Posted October 6, 2009 Set Variable... Get ( DocumentsPath )& "Invoices/" & "Inv_" & (Line Item::ID | Job) & ".pdf " Does that look right?
bcooney Posted October 6, 2009 Posted October 6, 2009 (edited) I think it should be: Get (DocumentsPath) & "Invoices/" & "Inv_" & Line Item::ID & " | Job.pdf" I'm not sure if the pipe is causing a problem. You could use Get (TemporaryPath) rather than storing all these pdfs. Edit: What is the name of the field in Line Item? I've assumed it's ID, and that you wish to append " |Job.pdf" to the file name. If the field name contains a pipe, I'd definitely change that to an underscore. InvoiceDemo.fp7.zip Edited October 6, 2009 by Guest
Donkick Posted October 6, 2009 Author Posted October 6, 2009 Let me try that and see if that helps That's a great idea about the temporary path!...
IdealData Posted October 7, 2009 Posted October 7, 2009 The temporary folder is SUPPOSED to get cleared when FM quits - however this did not happen until FM10. I tested this myself in FM9, and presume the same is true in FM8 - the version you are running.
bcooney Posted October 7, 2009 Posted October 7, 2009 It's my impression that the Temporary folder was cleared by the OS, when it feels like it, prior to FM10.
David Jondreau Posted October 7, 2009 Posted October 7, 2009 If the field name contains a pipe, I'd definitely change that to an underscore. Is it suboptimal to use a pipe instead of an underscore in a field / relationship name?
LaRetta Posted October 7, 2009 Posted October 7, 2009 "The problem is that many people are reporting that they cannot open the pdf" If you have pipe in the file name AND if any of your Users are on Windows, it would be a problem ... pipe is an invalid file name character for Windows.
comment Posted October 7, 2009 Posted October 7, 2009 Get ( DocumentsPath )& "Invoices/" & "Inv_" & (Line Item::ID | Job) & ".pdf " If I read this correctly, the pipe character is part of a FIELD name, not of the result. AFAIK, it shouldn't cause any problems - at least not within Filemaker.
LaRetta Posted October 7, 2009 Posted October 7, 2009 (edited) Well obviously none of us really knows ... I saw the parentheses which make no sense either in this type of field name concatenation because it would need to be quoted out. Is the field name ID | Job? If the pipe ends up being part of the file name, it will break on Windows. That was my point and my only point. It didn't appear that the problem was within FileMaker but rather when attempting to open the final PDF file. And if the final file name was the field DATA 327 | JOB, it would certainly create a problem on Windows. :wink2: Edited October 7, 2009 by Guest Corrected field name to field data
LaRetta Posted October 7, 2009 Posted October 7, 2009 "Invoices/" & "Inv_" And neither is frontslash valid.
comment Posted October 7, 2009 Posted October 7, 2009 Is the field name ID | Job? That's what it looks like to me. But we don't know what's inside that field - and that definitely goes out to the file name. I believe it would be best if Donkick posted one of those problematic files.
comment Posted October 7, 2009 Posted October 7, 2009 "Invoices/" & "Inv_" And neither is frontslash valid. I believe that's a folder, not part of the file name.
Donkick Posted October 7, 2009 Author Posted October 7, 2009 Thank you all for so much help on this. The pipe is part of the field name and can easily be changed to an underscore. How do I post my file up on the forum?
Lee Smith Posted October 7, 2009 Posted October 7, 2009 How do I post my file up on the forum? See if this recent post doesn't help. Link
Donkick Posted October 7, 2009 Author Posted October 7, 2009 (edited) Okay, I have posted the file here. Open the file as a guest, you will have full access. You can go straight to The problem script it's the top one in the Scripts: E-Mail Invoice or Click the Job Number 7054 to open the Order There is an Invoice Tab, in the "Job Detail" Layout. That will have a button to activate the script (highlighted in orange). Let me know if you have any problems... Invoicing.fp7.zip Edited October 7, 2009 by Guest
comment Posted October 7, 2009 Posted October 7, 2009 I meant post one of the PDF files that some people cannot open.
LaRetta Posted October 7, 2009 Posted October 7, 2009 We may not need it, Michael. When the email is created, the icon on the attachment line of the email doesn't turn into the PDF icon. If we look closely at the variable, we will see a space after the pdf: Get (DesktopPath) & "Inv" & Line Item::ID_Job & ".pdf " Remove that space and it properly creates the pdf (and you will know it works because the file icon on the attachment line turns into the pdf icon (at least on Windows this is how it displays).
Donkick Posted October 7, 2009 Author Posted October 7, 2009 (edited) That's funny! Actually, this is interesting... The forum will not allow me attach the problem pdf. In other words the message says that it contains an invalid file extension, but it does have the same exact .pdf extenion as the one that works. (just a note, the pdf that is created manually will attach just fine!) Edited October 7, 2009 by Guest
Donkick Posted October 7, 2009 Author Posted October 7, 2009 YOU ARE AMAZING LaRetta! Yes, that space after the .pdf was the problem.... it works now! All this frustration over a tiny little error. Thank you so much for all the time and help you have all put into this! -Thank You - Don Kick
bcooney Posted October 7, 2009 Posted October 7, 2009 "YOU ARE AMAZING LaRetta!!!!" No surprises there!
IdealData Posted October 8, 2009 Posted October 8, 2009 cleared by the OS, when it feels like it I'll accept that as plausible, albeit rather un-scientific or for that matter even proveable.
Recommended Posts
This topic is 5600 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now