How do I convert several web pages into one pdf document?
<pre><code>public FileResult Download() 
{ 

    var doc = new EO.Pdf.PdfDocument(); 
    EO.Pdf.HtmlToPdf.ConvertUrl("http://www.google.com/", doc); 

    var ms = new MemoryStream();     
    doc.Save(ms); 

    ms.Position = 0; 

    return new FileStreamResult(ms, "application/pdf") 
               { 
                   FileDownloadName = "download.pdf"
               }; 
}
</code></pre>

<p>Can you please show if possible, how to extend the code above to be able to convert several web pages into one pdf document?</p>

<p>The tricky part is that we don't know what pages a user is likely to attempt to convert.</p>

<p>So, hardcoding the webpages as the code above shows isn't helping us.</p>

<p>Any help is greatly appreciated.</p>

<pre><code>//Create a new PdfDocument object
var doc = new EO.Pdf.PdfDocument();

//Convert two ore more different pages into the same PdfDocument

EO.Pdf.HtmlToPdf.ConvertUrl("c:\\1.html", doc);

EO.Pdf.HtmlToPdf.ConvertUrl("c:\\2.html", doc);
</code></pre>

<p>Latest code:</p>

<pre><code>public FileResult Download() 
{ 
    var doc = new EO.Pdf.PdfDocument(); 

foreach(var url in passedUrls)  
{ 
EO.Pdf.HtmlToPdf.ConvertUrl(url, doc);   
doc.Save(ms);   
}


    ms.Position = 0; 

    return new FileStreamResult(ms, "application/pdf") 
               { 
                   FileDownloadName = "download.pdf"
               }; 
}
</code></pre>

<p>Latest from Adam (thank you sir)</p>

<pre><code>public FileResult Download() 
{ 

var documents = new List&lt;EO.Pdf.PdfDocument&gt;(); 
foreach(var url in passedUrls) 
{ 
    var doc = new EO.Pdf.PdfDocument(); 
    EO.Pdf.HtmlToPdf.ConvertUrl(url, doc); 
    documents.Add(doc); 
} 

EO.Pdf.PdfDocument mergedDocument = EO.Pdf.PdfDocument.Merge(documents.ToArray()); 
}
</code></pre>

<p>Hopefully, others find these codes useful.</p>
