How do I name the PDF-file attached to email?

Hi.
On my report I have made a button, so when I preview it, I can choose to send the report as an email, with a PDF attachment.
But in the Designer, on the Button-properties, there is no property for setting the filename of the PDF attachment, it always default to the same name as the filename of the report.
I would like to name the PDF file with the invoice number from the report.
How can I do that?

kind regards
Bjørn Holm
Norway

Dear Bjorn,

thank you for your post.

I would like to refer you to our Programmer’s Reference. Please review the chapter ‘Export Without User Interaction’. There you will find a description of how to set a target, path and filename of the export.

ExportConfiguration expConfig = new ExportConfiguration(LlExportTarget.Pdf,
“”, “”);

Best regards,

Patrick Preuschoff
Technical Support
combit GmbH

Hi, thanks for the reply.
That put me in the right direction, but I have not still crossed the finishline. :slight_smile:
I am using clarion, so I had to prototype all the functions I want to access.
I have to functions I can use:
LlXSetExportParameter SIGNED,*CSTRING,*CSTRING,*CSTRING),SIGNED,PASCAL,RAW,NAME(‘LlXSetExportParameterA’)
LlXSetParameter (SIGNED,SIGNED,*CSTRING,*CSTRING,*CSTRING),SIGNED,PASCAL,RAW,NAME(‘LlXSetParameterA’)

This works:
TargetFilename=‘MyTestFile.pdf’
LL_ExportSetting = ‘Export.File’
LL_Result = LLXSetParameter(LL_hJob, LL_LLX_Extensiontype_Export,LL_Exporttype,LL_ExportSetting,TargetFilename)

But how do I do the same for the llExportTarget.pdf parameter?
This doesn’t work, and gives me a returnvalue=-18.
LLExportSetting = ‘llExportTarget.pdf’
TargetFile=‘c:\temp\test1.pdf’
ProjectFile=
LL_Result = LlXSetExportParameter(LL_hJob, LL_ExportSetting, TargetFile, ProejctFile)

I think I just need to get the parameters for the LlXSetExportParameter correctly. Not sure if ‘llExportTarget.pdf’ is correct, or if the order of the paramteres in the functioncall is correct either.

Dear Bjorn,

thank you for your post.

You just have to set LL_PRNOPTSTR_EXPORT to ‘PDF’ if I understand you correctly. Also you have to set ‘Export.Path’ in the same way as ‘Export.File’.

You will find detailed information in your Programmer’s Reference.

Best regards,

Patrick Preuschoff
Technical Support
combit GmbH

Hi again Patrick. Thanks for your assistance.

This works:

LL_PRNOPTSTR_EXPORT = 2
LL_LLX_Extensiontype_Export = 1
LL_Result = LLPrintSetOptionString(LL_hJob,LL_PRNOPTSTR_EXPORT,‘PDF’)
LL_Result = LLXSetParameter(LL_hJob, LL_LLX_Extensiontype_Export,‘PDF’,‘Export.File’,‘NameOfPDF’)
LL_Result = LLXSetParameter(LL_hJob, LL_LLX_Extensiontype_Export, ‘PDF’, ‘Export.Path’, ‘c:\temp’)

This will set the correct name for the pdf file when I choose to print to PDF.
But, if I try to print to PREVIEW, and then in the preview window choose to ‘Send the current preview as Email’, and in the Mail configuration choose PDF as format, the PDF attachment to the email does not have the correct filename.

So I can set the pdf-filename when I print to PDF directly, but I cannot set the pdf-filename when I use the PREVIEW to email a PDF-attachment.

As I wrote in my previous post, I think I need to use the SetExportParameter method, but I cannot get it to work, I keep getting value -18 in return.

Do you have a list of what returnvalues I can receive from the SetExportParameter?

Dear Bjorn,

thank you for your post.

Please use the LlPrintSetProjectParameter for this task. I would like to refer to your Programmer’s Reference at Chapter ‘8.4.4. Automatic Storage of Form Data’, Page 401.

With the help of these commands you are able to set the desired format, the output file name.

Best regards,

Patrick Preuschoff
Technical Support
combit GmbH