PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Tue Jul 01, 2025 1:35 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Apr 19, 2016 9:05 am 
Offline

Joined: Tue Apr 05, 2016 11:23 am
Posts: 11
In our application we include a background image to appear on every page:

Code:
var fixedPage = new FixedPage();
BitmapImage bgImage = new BitmapImage(new Uri("pack://application:,,,/Resources/Icons/bgimage.png"));
fixedPage.Background = new ImageBrush(bgImage);


The problem is that this image is not displayed in the exported PDF. This seems to be due to an exception that occurs when the following lines in PdfSharp.Pdf.Advanced.PdfImage are executed:

Code:
BmpBitmapEncoder encoder = new BmpBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(image.wpfImage));
encoder.Save(memory);


NotSupportedException occurred. "BitmapMetaData" is not available for "BitmapImage".

What can I do to make it work?


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 19, 2016 9:18 am 
Offline

Joined: Tue Apr 05, 2016 11:23 am
Posts: 11
I noticed it is possible to prevent the exception by writing:

Code:
BmpBitmapEncoder encoder = new BmpBitmapEncoder();
BitmapFrame bmf = BitmapFrame.Create(image.wpfImage, null, null, null);
encoder.Frames.Add(bmf);
encoder.Save(memory);


Still, the background image is not exported to PDF. The problem is not resolved.


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 20, 2016 7:45 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3131
Location: Cologne, Germany
Hi!

We cannot replicate the problem.

See also:
viewtopic.php?f=2&t=832
http://www.pdfsharp.net/wiki/IssueSubmissions.ashx

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 18 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