PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

Images are transparent when converting XPS to PDF
http://forum.pdfsharp.de/viewtopic.php?f=3&t=1115
Page 1 of 1

Author:  JEllenden [ Fri Mar 26, 2010 9:35 am ]
Post subject:  Images are transparent when converting XPS to PDF

Images are not displayed when an XPS document is converted to PDF. I've had a quick look through the source and made the following changes to mine to fix it:

i) In the method PdfSharp.Xps.Parsing.XpsParser.ParseImageBrush immediately after the brush is created I've added the line:
brush.Opacity = 1;
It appears that the brush opacity defaults to 0 and if the opacity attribute isn't explicitly set in the xml element, the opacity always remains 0.

ii) In method PdfSharp.Xps.Rendering.PdfContentWriter in the section where the ImageBrush case is handled I've amended the boundary condition from opacity < 1 to opacity is <= 1. As it stands if both the path and brush opacities are 1 the Alpha values are never set on xgState.

Author:  ChrisCrewdson [ Mon Oct 11, 2010 7:39 pm ]
Post subject:  Re: Images are transparent when converting XPS to PDF

This fixed the issue for me as well. This seems like a simple enough fix that it could be pushed into the source.

Author:  Sullux [ Thu Nov 04, 2010 9:23 pm ]
Post subject:  Re: Images are transparent when converting XPS to PDF

This cost me a great deal of time and trouble. Very rarely does a PDF document not contain an image of some sort. With this bug, not a single PDF document could have been produced from this source code.

Thank you very much for finding it, JEllenden, and I hope they update the source as soon as possible. This is an absolute show-stopper, so I am surprised that the issue was reported in March and the fix is still not posted in November.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/