Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to merge 2 or more byte items in array to one byte element
    primarykey
    data
    text
    <p>In start I want say, I am beginner in C# so be patient :)<br/> I have array of bytes. One item represent page of pdf file. I need now merge this arrays to one. I hope this new array will show two pages one above other. In this case: <br /> Page1 (from Items[0]) <br /> Page2 (from Items[1.])</p> <p>Its good idea? I need this to attach pdf as images to reporting services wihtout using Database. <hr/> <img src="https://i.stack.imgur.com/YDiQe.png" alt="Screen"></p> <p><strong>EDIT:</strong></p> <p>Here is my code:</p> <pre><code>System.Collections.ArrayList items = new System.Collections.ArrayList(); System.IO.FileStream fs = new System.IO.FileStream("C://1.pdf", System.IO.FileMode.Open, System.IO.FileAccess.Read); byte[] pdf = new byte[fs.Length]; fs.Read(pdf, 0, (int)fs.Length); PDFParser.Parse parser = new PDFParser.Parse(); System.Collections.Generic.List&lt;System.Drawing.Image&gt; images = parser.Split(pdf); 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>and method from PDFParser.dll:</p> <pre><code>public class Parse { public List&lt;Image&gt; Split(byte[] document) { System.IO.MemoryStream ms = new System.IO.MemoryStream(document); Document pdfDoc = new Document(new BinaryReader(ms)); Page page = null; List&lt;Image&gt; returnVal = new List&lt;Image&gt;(); float resolution = 100; float scale = resolution / 72f; int bmpW = (int) (scale * pdfDoc.Pages[0].Width); int bmpH = (int) (scale * pdfDoc.Pages[0].Height); for (int i = 0; i &lt; pdfDoc.Pages.Count; i++) { page = pdfDoc.Pages[i]; using (Bitmap bitmap = new Bitmap(bmpW, bmpH)) { Graphics graphics = Graphics.FromImage(bitmap); graphics.ScaleTransform(scale, scale); graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; page.Draw(graphics); returnVal.Add((Image)bitmap.Clone()); } } return returnVal; } } </code></pre> <p><strong>3'rd party program what I used:</strong><br /> <a href="https://i.stack.imgur.com/YDiQe.png" rel="nofollow noreferrer">http://www.tallcomponents.com/pdfrasterizer3.aspx</a></p>
    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.
 

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