I'm having some issues with creating PDF's, which I suspect is my own fault!
I am trying to create a PDF with a background image. That is it.
This is from a Project (Visual Studio 2012) although it's a website.
public static string CreateTest()
{
try
{
string directory = @"C:\Users\Dave\Documents\Visual Studio 2012\Projects\Website\LifeCry\LifeCry\Content\Poster\";
PdfDocument document = new PdfDocument();
PdfPage page = document.AddPage();
document.Options.NoCompression = true;
document.Options.ColorMode = PdfColorMode.Cmyk;
document.Version = 14;
page.Size = PdfSharp.PageSize.A4;
XImage xImagePosterBackground = XImage.FromFile(directory + "LifeCryPosterA4.jpg");
XGraphics graphics = XGraphics.FromPdfPage(page);
graphics.DrawImage(xImagePosterBackground, new XPoint(0, 0));
string fileName = DateTime.Now.ToString("yyMMddhhmmss") + ".pdf";
document.Save(directory + fileName);
return "../Content/Poster/" + fileName;
}
catch (System.Exception ex)
{
string s = ex.ToString();
System.Diagnostics.Debug.Assert(false, "beep beep, it failed!");
//TODO - impelement me (yeah, what ever)
}
}
The issue is the page exports/renders incorrectly in anything but FireFox. This means, in IE, Chrome, PDX-XChange and PhotoShop, it renders incorrectly. See attached for screen shots of how it renders and how it should be.
Here, I hope, you can see the issue.
Is this a fault with my code? Any advice would be appreciated.
Dave