Pdf attachment to email

Hi
An association want to send bills to its members (annual quota). This should be done by email. Ideally, the bill should be an attachment to the e-mail.

I was thinking of WP Pro for this, but I’m struggling to get started.

If someone knew about a description that shows how to create the virtual / invisible WP document, enter text and export the document it would be very nice.

Hello,

I suggest you take a look at the HDI database available here:
https://blog.4d.com/easily-send-a-4d-write-pro-document-containing-images-as-the-body-of-an-email/

Regards
Yannick

Hello Yannick
Thanks for answering. My problem is not to send the mail but to generate the correct document. I have tried this (simplified for this example):

My_WP_Pro_Dok:= WP New

$range:= WP Create range (My_WP_Pro_Dok;1;9)

WP SET TEXT ($range;“MyNewText”;wk append)

WP SET ATTRIBUTES ($range;wk font size;28;wk font bold;wk true;wk font family;“Helvtica”)

WP PRINT (My_WP_Pro_Dok)

The document print with correct text size, but I have tried several attributes/commands to change the font to Helvetica. I am also struggeling with tabs, but one problem at a time…

Is there som example code somewhere.

Hello,

You should export your 4D Write Pro doc in PDF and send this file in the mail (attachment)

See the code to send email here:
https://blog.4d.com/a-new-way-to-send-mails/

For using 4D Write Pro the problem is that it depend for which 4D Version ?
Follow this link and make your market :wink:

Regards
Manuel

Hi Manuel
Thanks for reply. I am very aware that my question is poorly formulated. It was sent at a frantic moment when customers were asking for results and I felt that I was not making progress. I see that the mail method used is elegant, but my problem is not sending the document it is creating it.

The status now is that I have managed to create a header plus a bit more:

My_WP_Pro_Dok:= WP New

$rangeHead:= WP Create range (My_WP_Pro_Dok;1;20)

WP SET TEXT ($rangeHead;"Bill No.: ";wk append)

WP SET TEXT ($rangeHead;“3256”;wk append) // Example will be extracted from data

WP SET ATTRIBUTES ($rangeHead;wk font size;28) // Working

WP SET ATTRIBUTES ($rangeHead;wk font;“Helvetica Neue”) // Working

WP SET ATTRIBUTES ($rangeHead;wk font bold;wk true) // Working

WP SET ATTRIBUTES ($rangeHead;wk text align;wk center) // Working

WP SET ATTRIBUTES ($rangeHead;wk border style;wk double) // Working, but

WP SET ATTRIBUTES ($rangeHead;wk border color;Blue)

$rangeSenderName:= WP Create range (My_WP_Pro_Dok;20;40)

WP SET TEXT ($rangeSenderName;“OrganizationName”;wk append) // Err. This is added on same line as heading

WP PRINT (My_WP_Pro_Dok)

Thank a lot again! Regards
Bjørn Arve Iversen

The problem remain (It is not only your fault), we still not know for which 4D version we are talking about ? :roll_eyes:

IF 4D READ THIS THREAD : How could we now know for which version (& build) of 4D we talk ? There is no more Sub Forum for 4D version :thinking:

For my part, I don’t know if it is good practice or not, but it works

I use this method:

My_WP_Pro_Dok:= WP New

and for each text I have to add:

$My_WP_Pro_Tempo:= WP New
$MyAddText:= “blaBla”
WP SET TEXT ($My_WP_Pro_Tempo;$MyAddText;wk append)
$range:= WP Create range (My_WP_Pro_Dok;wk start text;wk end text)
WP SET ATTRIBUTES ($range;wk font bold;wk true;wk font;“Helvetica Neue”)
WP INSERT DOCUMENT (My_WP_Pro_Dok; $My_WP_Pro_Tempo;wk append)

Sorry
I am using 4D 17.4.

Bjørn Arve Iversen

It’s to me to be sorry…
For ME, for versions below the v18.x, I don’t recommend to use 4D Write Pro.

You can, but you have to be very careful if you want to convert old 4D Write documents.