Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Customers can't open my PDF's

Featured Replies

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?

  • Author

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.

Does $exportPath end in ".pdf"?

  • Author

Set Variable...

Get ( DocumentsPath )& "Invoices/" & "Inv_" & (Line Item::ID | Job) & ".pdf "

Does that look right?

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 by Guest

  • Author

Let me try that and see if that helps

That's a great idea about the temporary path!...

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.

It's my impression that the Temporary folder was cleared by the OS, when it feels like it, prior to FM10.

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?

"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.

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.

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 by Guest
Corrected field name to field data

"Invoices/" & "Inv_"

And neither is frontslash valid.

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.

"Invoices/" & "Inv_"

And neither is frontslash valid.

I believe that's a folder, not part of the file name.

  • Author

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?

How do I post my file up on the forum?

See if this recent post doesn't help. Link

  • Author

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 by Guest

I meant post one of the PDF files that some people cannot open.

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).

  • Author

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 by Guest

  • Author

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

Great catch!

"YOU ARE AMAZING LaRetta!!!!"

No surprises there!

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.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.