Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>+1 to ColinE's answer. To implement the effect you want to achieve you'll need to use some 3rd party C# PDF library. You can find some links to open-source PDF libraries in answers to <a href="https://stackoverflow.com/questions/373926/lightweight-open-source-pdf-library-in-c">this SO question</a> or <a href="http://csharp-source.net/open-source/pdf-libraries" rel="nofollow noreferrer">there</a>.</p> <p><strong>UPDATE</strong></p> <p>As for your code - to merge two images so one appears right after another you can use <code>Graphics</code> class like this:</p> <p>Replace</p> <pre><code>object dataByte = null; for (int i = 0; i &lt; images.Count; i++) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); images[i].Save(ms, System.Drawing.Imaging.ImageFormat.Png); items.Add(ms.ToArray()); } </code></pre> <p>with</p> <pre><code>System.IO.MemoryStream ms = new System.IO.MemoryStream(); if (images.Count &gt; 0) { int totalHeight = 0; int maxWidth = 0; for (int i = 0; i&lt; images.count; i++) { totalHeight += images[i].Height; if (images[i].Width &gt; maxWidth) { maxWidth = images[i].Width; } } Image mergedImage = new System.Drawing.Bitmap(maxWidth, totalHeight); System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(mergedImage); int heightOffset = 0; for (int i = 0; i&lt; images.Count; i++) { g.DrawImage(images[i],new Point(0, heightOffset)); heightOffset += images[i].Height; } g.Dispose(); // Mandatory! Graphics is using unmanaged resources so it must be disposed explicitly. mergedImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload