This project has moved. For the latest updates, please go here.

Scan multiples pages to one pdf

Jun 17, 2014 at 5:35 PM
Hello,

Thanks a lot for this very good DLL :)
Actually, i'm succed to scan multiples pages with your dll and it's very good :)

I just want to know if there is a way to scan all my pages in a one PDF document.

I could use another dll in order to merge all my JPG to One pdf, yes, but is there a native way with your dll please ?

Thanks a lot,

Best regards,

Nix
Coordinator
Jun 17, 2014 at 5:50 PM
Hello,Nixeus!
All I can recommend is to use, for example, iTextSharp.
Marked as answer by SARAFF on 6/23/2014 at 12:21 PM
Jun 18, 2014 at 10:25 AM
Thanks a lot,

It's perfect.

For informations here is the code in order ton convert multiples pages scanned into a one pdf (using iTextSharp) :
 private void AcquireCompletedEventHandler(object sender, EventArgs e)
{
    try
    {
        try
        {
            if (Scanners.Twain.ImageCount > 0)
            {
                Document doc = new Document();
                PdfWriter.GetInstance(doc, new System.IO.FileStream(this._fileName, System.IO.FileMode.Create));
                doc.Open();
                for (int i = 0; i <= Scanners.Twain.ImageCount - 1;i++ )
                {
                    iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(Scanners.Twain.GetImage(i), System.Drawing.Imaging.ImageFormat.Jpeg);  
                    doc.SetPageSize(new iTextSharp.text.Rectangle(0, 0, img.Width, img.Height));
                    doc.NewPage();
                    doc.Add(img);
                }
                doc.Close();   
            }
        }
        finally
        {
            Scanners.Twain.AcquireCompleted -= this.AcquireCompletedEventHandler;
        }
        this._acquireCallback(this._fileName);
    }
    catch (Exception ex)
    {
        this._exeptionCallback(ex);
    }
}
Oct 22, 2014 at 2:40 PM
thanks Nixeus, this code help me a alot.
Oct 24, 2014 at 7:11 AM
How can i improve scan image quanlity, i set resolution to 300f but it's not good.
link pdf: https://drive.google.com/file/d/0B9aQJjbcLHUlWE02RHZ5U1RCTGJNaGdaa3EwYVZkUUYwNEdV/view?usp=sharing
Thanks,