In DBForms try where possible to use -E for Trusted Connections rather than hard coded usernames and passwords.
Use dbsvpdf.exe to output V1 outputs to PDF
For multi page, multi document outputs use a variable to control the end of page such as END_OF_DOC using a field you know will appear on the last page (For example Order totals in Sage Line 1000 are normally on the last page only).
Below are sniplets so may be missing supporting variables or extracts
Section [INPUT] VARIABLE=ISQL_CMD , , "-s ^| -w 999 -h-1 -S -E" VARIABLE=ISQL_CMD_SAGE VARIABLE=END_OF_DOC , , 0 Section [EXTRACT] LET END_OF_DOC=0 FIELD=XX, XX, XX, ORD_TOT IF LENGTH( TRIM(ORD_TOT)) <> 0 THEN { LET END_OF_DOC=1 } Section [DELIVERY] "MAILME": { DEBUG "Got To MAIL" LET EMAIL="" LET SYSTEM_CMD="" LET SYSTEM_CMD=ISQL_CMD_SAGE + QUOTED(("select mail from table where sage_user ='" + SAGE_USER) + "'") REM DEBUG "SYSTEM_CMD=>"+whole(SYSTEM_CMD)+"<" LET EMAIL= TRIM(EMAIL[1]) DEBUG "EMAIL = " + EMAIL IF ( LENGTH( TRIM(EMAIL)) <> 0) AND ( TRIM(EMAIL) <> "XX") THEN { DEBUG "Going to MAIL_OUTPUT" PDF_OUTPUT MAILME_PDF_OUTPUT } ELSE { PRINT_OUTPUT } } Section [OUTPUT] OUTPUT=PDF_OUTPUT INVOCATION=" \\dbsvpdf" PARAMETERS= { OUTPUT_FILE PDF_FILENAME } MASK= { LET PDF_FILENAME=((PDF_BASE + "Order_") + REPLACE_STRING(ORD_NO," ","_")) + ".pdf" DEBUG ("PDF_FILENAME=>" + WHOLE(PDF_FILENAME)) + "<" IF LENGTH( TRIM(SUPP_CODE)) <> 0 THEN { DEFAULT_REFORMAT IF END_OF_DOC = 1 THEN { INVOKE } } } OUTPUT=MAILME_PDF_OUTPUT INVOCATION=" \\dbmailsend" PARAMETERS= { "-f" QUOTED FROM_NAME "-r" QUOTED "-s" QUOTED SUBJECT "-a" PDF_FILENAME "-t" QUOTED EMAIL OUTPUT_FILE } MASK= { IF LENGTH( TRIM(SUPP_CODE)) <> 0 THEN { LET FROM_NAME=EMAILCC LET SUBJECT="Order " + ORD_NO IF END_OF_DOC = 1 THEN { FORMAT_MAIL_MSG INVOKE } LET DUMMY= EXECUTE("del " + PDF_FILENAME) } }