Support Forum
Welcome Guest Search | Active Topics | Members | Log In | Register

ERROR - WriteableBitmap has protected content. Pixel access is not allowed. -- RESOLVED Options
antoinne85
Posted: Wednesday, March 31, 2010 12:58:03 PM
Rank: Newbie
Groups: Member

Joined: 3/31/2010
Posts: 3
Location: Lexington, KY
My company is currently evaluating SmartPrint to see if it can meet our needs for a current project, but we're experiencing some difficulties.

I have a StackPanel that I need to create a PDF from. The StackPanel is populated at runtime with borders, labels, and images. When no dynamically created images are present in the StackPanel, it creates the document (although with a few issues, listed at the end). However, once an image has been added at runtime it throws the error in the title of this post:

"WriteableBitmap has protected content. Pixel access is not allowed."

Here is the code:
Quote:

PrintSettings ps = new PrintSettings();
ps.ElementsToPrint = new List<UIElement> {SP_Main};

SmartPrintManager printMgr = new SmartPrintManager("http://localhost:3557/SmartPrintHandler.ashx");
printMgr.AutoGeneratePrintDocumentViewer = true;
printMgr.Print(ps);


The error is being thrown by the last line.

Any thoughts on what's causing it or how to resolve it?

Lastly, the issues I'm facing when it does print the (almost) empty StackPanel is that (what I assume to be the header information) is missing. The document opens up inside my Silverlight App with about a one-inch space at the top that still contains my application. I assume this is where a print/back button should reside?

My ultimate goal would be to pop up the PDF in a separate window, but the documentation that came with the trial version (the .chm file) seems to be broken. None of the pages load.
antoinne85
Posted: Wednesday, March 31, 2010 1:29:20 PM
Rank: Newbie
Groups: Member

Joined: 3/31/2010
Posts: 3
Location: Lexington, KY
Found the problem. Cross-domain permissions.

So I can now print the images without a problem.

So the only real questions left are:
Where did the header go?
Can I open the PDF in a new window?

If I could get a working copy of the help doc, I'd be happy to look into these things myself.
admin
Posted: Friday, April 02, 2010 7:34:46 PM
Rank: Administration
Groups: Administration

Joined: 2/25/2008
Posts: 26
Let us know what problems you're having with the help doc. If it's not showing anything when opened then you'll need to right-click on it in Windows Explorer, select Properties from the menu and then unblock the file. Windows Vista and Windows 7 can have that problem (assuming you're running on one of those operating systems).

As far as opening the PDF, we autogenerate a viewer by default but if you set the AutoGeneratePrintDocumentViewer property to false you can do whatever you'd like once the PDF is ready. Just handle the PrintCompleted event which will give you the path to the PDF file.

Thanks,
SmartWebControls Team
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.6 (NET v2.0) - 11/14/2007
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.