PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jun 24, 2018 10:51 am

All times are UTC

Forum rules

Please read this before posting on this forum: Forum Rules

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

Joined: Tue Sep 08, 2009 12:09 pm
Posts: 3
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 =

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())
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?!

Reply with quote  
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: Baidu [Spider], Google [Bot] and 6 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:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group