Wednesday, April 20, 2011

TIFF to PDF Conversion using .Net - Free



            string infilename = "c:\\temp\\faxsample.tif";
            PdfDocument document = new PdfDocument();
            Bitmap bm = new Bitmap(infilename);
            int total = bm.GetFrameCount(FrameDimension.Page);
            for (Int32 k = 0; k < total; k++)
            {
                Bitmap bm2 = new Bitmap(infilename);
                bm2.SelectActiveFrame(FrameDimension.Page, k);
                XImage image = XImage.FromGdiPlusImage(bm2);
                PdfPage page1 = document.AddPage();
                
                // Get Image width, Height and Resolution and Set output document Width and Height in Inches
                page1.Width = XUnit.FromInch(image.Width / image.HorizontalResolution);
                page1.Height = XUnit.FromInch(image.Height / image.VerticalResolution);
                XGraphics gfx = XGraphics.FromPdfPage(page1, XGraphicsPdfPageOptions.Append);
                gfx.DrawImage(image, 0, 0);
                gfx.Dispose();
                image.Dispose();
                page1.Close();
                bm2.Dispose();
            } 
            document.Save("c:\\temp\\faxsample.pdf");
            Console.WriteLine("Total Pages: " + total);


So Simple as that. Add pdfsharp in the reference nothing else to install.
Pdfsharp can be obtained from PDFSharp.

Monday, April 18, 2011

Tropo ClicktoCall with Conference in PHP - Cloud Telephony



$calloptions['onAnswer'] = 'secondCallInitiator';
$calloptions['callerID'] = 'Calleridhere';
call('+1'.$numbertodial, $calloptions);

function secondCallInitiator($event)
{
$confid = $conferenceid;
$confoptions['mute'] = false;
$confoptions['playTones'] = true;
$confoptions['leaveprompt'] = 'beep';
$sleep(2);
Say('Please hold');
Conference($confid,$confoptions);
}


Pass two variables, numbertodail & conferenceid as POST parameters.
ClicktCall with Conference, That is so Simple to a Complex Infrastructure.

Tropo ClicktoCall PHP Script - Cloud Internet Telephony Made Easy !



$aftercalloptions['onAnswer'] = 'onAnswerCB';
call('+1'. agentnumber, $aftercalloptions);

function onAnswerCB($event)
{
    global $customernumber;
    Sleep(3);
    transfer('+1' . $customernumber);
}



Cool and Pretty for a Complex Need !

Initiate a call with the following URL
https://api.tropo.com/1.0/sessions?action=create&token=yourtoken&agentnumber=agentnum&customernumber=custnum

Ensoy !