PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Nov 01, 2024 12:14 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Aug 25, 2011 9:49 am 
Offline

Joined: Tue Aug 23, 2011 9:31 am
Posts: 2
Hi everyone!
Results after using these functions of XGraphics vary from results which we get from .NET Graphics functions BeginContainer(...), EndContainer().
Is it bug or feature?


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 25, 2011 11:09 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3111
Location: Cologne, Germany
denhnure wrote:
Is it bug or feature?

I dunno.
What's different?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 25, 2011 12:17 pm 
Offline

Joined: Tue Aug 23, 2011 9:31 am
Posts: 2
This is an extract from my WinForms application:

override protected void OnPaint(PaintEventArgs e)
{
// Create a new PDF document
PdfDocument document = new PdfDocument();

// Create an empty page
PdfPage page = document.AddPage();

XGraphics gfx = XGraphics.FromGraphics(e.Graphics, new XSize(100, 100));



// Define transformation for container.
Rectangle srcRect = new Rectangle(0, 0, 200, 200);
Rectangle destRect = new Rectangle(100, 100, 150, 150);

// Begin graphics container.
XGraphicsContainer containerState1 = gfx.BeginContainer(
destRect, srcRect,
XGraphicsUnit.Point);

// Fill red rectangle in container.
gfx.DrawRectangle(new SolidBrush(Color.Red), 0, 0, 200, 200);

// End graphics container.
gfx.EndContainer(containerState1);

// Begin graphics container.
GraphicsContainer containerState2 = e.Graphics.BeginContainer(
destRect, srcRect,
GraphicsUnit.Point);

// Fill red rectangle in container.
e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 200, 200);

// End graphics container.
e.Graphics.EndContainer(containerState2);




// Save the document...
const string filename = "C:\\HelloWorld_tempfile.pdf";
document.Save(filename);
// ...and start a viewer.
//Process.Start(filename);
}


Attachments:
File comment: Black rectangle was drawn by .NET Graphics.
Red rectangle was drawn by PdfSharp XGraphics.

PdfSharp.jpg
PdfSharp.jpg [ 24.51 KiB | Viewed 12615 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 25, 2011 12:58 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3111
Location: Cologne, Germany
I think it's a bug (my boss will have to look at it, but he's currently unavailable).

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 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