Everyone,
I want to convert one html file to pdf and then attach that pdf to outlook email.
Here is the code:
//So the below code will create a html file to my file sytem.
var sbody = "mytext";
var fso = new ActiveXObject("Scripting.FileSystemObject");
var tf = fso.CreateTextFile(htmlFile, true);
tf.Write (sbody);
tf.Close();
//Now I want to create a pdf of that html and save it , I am stuck as how to proceed further.
var AcroApp = new ActiveXObject("AcroExch.App");
var AVDoc = new ActiveXObject("AcroExch.AVDoc");
var PDDoc = new ActiveXObject("AcroExch.PDDoc");
var IsSuccess = false;
IsSuccess = AVDoc.Open(htmlFile , "");
AVDoc = AcroApp.GetActiveDoc();
if(IsSuccess)
{
AVDoc = AcroApp.GetActiveDoc(); //AVDoc always return null
}
Any Help is appreciated
Your VBA script would open a known PDF that opens the selected web site. The URL can be passed from your VBA scirpt into the PDF script through the JS object on the "PDDoc" object. Look up the getJSObject function.
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script