PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Oct 23, 2014 4:30 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Tue Sep 08, 2009 12:34 pm 
Offline

Joined: Tue Sep 08, 2009 12:09 pm
Posts: 3
Hi.
I am using the PdfSharp Library in a project, trying to create a pdf document from multiple paged tiff document. My code runs correctly, but at my mate's machine an Assertion warning message pops up: "Raw string contains invalid character with a value > 255."
Here is the code i use:

System.Drawing.Image img = null;
System.Drawing.Imaging.FrameDimension frameDimention = null;
int frameCount = 0;

PdfSharp.Drawing.XImage pdfimage = null;

img = System.Drawing.Image.FromFile(source);
frameDimention = new System.Drawing.Imaging.FrameDimension(img.FrameDimensionsList[0]);
frameCount = img.GetFrameCount(frameDimention);
PdfSharp.Pdf.PdfDocument pdfDocument = new PdfSharp.Pdf.PdfDocument();

for (int i = 0; i < frameCount; i++)
{
img.SelectActiveFrame(frameDimention, i);

pdfDocument.Pages.Add(new PdfSharp.Pdf.PdfPage());
using (PdfSharp.Drawing.XGraphics xgr =
PdfSharp.Drawing.XGraphics.FromPdfPage(pdfDocument.Pages[i]))
{

pdfimage = img;//equal to XGraphics.FromGdiPlusImage()

pdfDocument.Pages[i].Width = XUnit.FromPoint(img.Size.Width);
pdfDocument.Pages[i].Height = XUnit.FromPoint(img.Size.Height);
xgr.DrawImage(pdfimage, 0, 0, img.Size.Width, img.Size.Height);
}
}

using (MemoryStream ms = new MemoryStream())
{
pdfDocument.Save(ms);
byte[] pdfAlteredDocBytes = ms.ToArray();
pdfDocumentAsBinary = new System.Data.Linq.Binary(pdfAlteredDocBytes);
}

It seems like in the red-colored Save method something happens. I follwed the assertion up to the overriden GetBytes method of the RawEncoding class. I link the image with the assertion shown - http://img7.imageshack.us/img7/4899/errun.png.
In fact if the assertion is ignored it works. I really don't understand how this could happen on other's machines?! I welcome any help!!!

Guys, any help?!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group