How do you save an e-mail attachment as PDF not HTML?

gadzilla1
Member Posts: 316
Hello all,
I'm wondering if anyone out there has modified Report 14000901 - Sales E-Mail to save the attachment as a PDF as opposed to HTML?
There is a section of code in Report 14000901 that I've been playing with but have had limited success:
SaveReportAsHTML(EMailAttachment."Attachment Report ID",TempFilename);
MailOCX.AddAttachment(TempFilename);
I've also installed PDFCreator.
If anyone has been able to accomplish this I'd greatly appreciate any help.
Thank you very much - gad1
I'm wondering if anyone out there has modified Report 14000901 - Sales E-Mail to save the attachment as a PDF as opposed to HTML?
There is a section of code in Report 14000901 that I've been playing with but have had limited success:
SaveReportAsHTML(EMailAttachment."Attachment Report ID",TempFilename);
MailOCX.AddAttachment(TempFilename);
I've also installed PDFCreator.
If anyone has been able to accomplish this I'd greatly appreciate any help.
Thank you very much - gad1
0
Comments
-
The PDFCreator should have installed a virtual printer. Print to that printer and PDFCreator will create a pdf-file.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thanks - but I may be misunderstanding something. I've used the virtual printer for PDFCreator and can print to it...it saves the print out as a PDF.
I still do not understand how to revise the SaveAsHtml code so the attachment as PDF is made automatically?
Sorry for the confusion...0 -
It looks like if your PDF is saved in a set place with a set name that you can add it to the email setup as fixed file. It also allows for a report to be attached already see the section:
// Create and add attachment IF ShowStatus THEN Window.UPDATE(1,'Attachments'); EMailAttachmentTmp.DELETEALL; EMailAttachment.RESET; EMailAttachment.SETRANGE("E-Mail Code",EMailHeader.Code); IF EMailAttachment.FIND('-') THEN BEGIN EMailSetup.TESTFIELD("E-Mail Buffer Directory"); REPEAT CASE EMailAttachment.Type OF EMailAttachment.Type::Report: //ALLOWS A REPORT BEGIN EMailAttachment.TESTFIELD("Attachment Name"); EMailAttachment.TESTFIELD("Attachment Report ID"); TempFilename := EMailSetup."E-Mail Buffer Directory"; IF COPYSTR(TempFilename,STRLEN(TempFilename),1) <> '\' THEN TempFilename := TempFilename + '\'; TempFilename := TempFilename + FieldValue.SubstituteAttachment(EMailAttachment); SaveReportAsHTML(EMailAttachment."Attachment Report ID",TempFilename); MailOCX.AddAttachment(TempFilename); EMailAttachmentTmp := EMailAttachment; EMailAttachmentTmp."Use Attachment File Name" := TempFilename; EMailAttachmentTmp.INSERT; END; EMailAttachment.Type::"Fixed File": //ALLOWS A FIXED FILE BEGIN IF NOT EXISTS(EMailAttachment."Fixed File Name") THEN ERROR('Attachment file %1 do not exists.',EMailAttachment."Fixed File Name"); MailOCX.AddAttachment(EMailAttachment."Fixed File Name"); END; END; UNTIL EMailAttachment.NEXT = 0; END;
0 -
See I'm thinking the report first creates the PDF file c:\MyFile.Pdf
in the email setup of the Sales Order or Invoice - whichever your doing to can tell the email to always get the same attachment (Fixed FIle). then have it delete the file once done. Hope that makes sence..0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions