開始時に私はCで初心者ですので、忍耐強く:
私はバイトの配列を持っています。 1つの項目がpdfファイルのページを表します。この配列を1つにマージする必要があります。私はこの新しい配列が2つのページを上に表示することを願っています。この場合:
のPage1(アイテムから[0])
ページ2(アイテムから[1])配列内の2バイト以上の項目を1バイト要素にマージする方法
その良いアイデア?私はデータベースを使ってレポートサービスに画像としてpdfを添付する必要があります。
編集:ここでは
私のコードです:
PDFParser.dllから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<System.Drawing.Image> images = parser.Split(pdf);
object dataByte = null;
for (int i = 0; i < images.Count; i++)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
images[i].Save(ms, System.Drawing.Imaging.ImageFormat.Png);
items.Add(ms.ToArray());
}
と方法:どのような私
public class Parse
{
public List<Image> Split(byte[] document)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream(document);
Document pdfDoc = new Document(new BinaryReader(ms));
Page page = null;
List<Image> returnVal = new List<Image>();
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 < 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;
}
}
3'rdパーティプログラム中古品:
http://www.tallcomponents.com/pdfrasterizer3.aspx
私は恐らくこのようにはうまくいかないと思います。あなたが別の車の後ろに1つの車を接着する場合、あなたはリムジンを取得しない、混乱を取得します。 – MattDavey
@MattDavey私は以下の答えの良いアナロジーのために狩りをしていました。私はあなたの2x車を愛しています! – ColinE