Printing tens of pages in Silverlight freezes the computer - silverlight-4.0

we have a Silverlight 4 app that prints a multi-page report. When the number of pages exceeds 20 or 30 (depending on the computer), the printing completely blocks the computer and users are unable to use it.
That is due to the huge print job size - each page takes about 170MB, so a 10 page document results in nearly 2gig!
In a comment from the page http://wildermuth.com/2009/11/27/Silverlight_4_s_Printing_Support (see comment by Marshall Agnew from December 3, 2009) I found that "Silverlight Printing does currently allow users to specify Color/Grayscale, Orientation and Resolution(DPI)..."
However, I am unable to find any info as to how this is done.
We are printing a black and white document, text only, so grayscale (or even black&white, if that were possible) would be fine with us.
Thanks for any help on how to decrease the size of the print job or find an alternative solution to printing multi-page reports in SL4.
Jan

The problem is that silverlight print raw image bytes by rendering images from XAML. Not optimized at all.
Try generate XPS or PDF files from your client and allow the user to save it before print.
XPS are relatively easy to generate because they use XAML.
http://msdn.microsoft.com/en-us/library/ms771669.aspx

This whole thing irritates the heck out of me. If I have to print to PDF to print, then Silverlight is just NOT ready for prime time. I built a large scale application in Silverlight. Printing works for the most part, but in some printers the large print jobs cause errors and lock up the application or the computer. This is ridiculous to me! Silverlight cannot be used for business apps with slap stick print support. In fact an even worse bug is that there is no page filtering either. If you select pages 2 and 5 of a 8 page document it will simply print page 1 and 2.
I'm so embarrassed that my application has now inherited the problems of Silverlight.

It sounds like you're asking too much of the Silverlight printing engine. You would probably get better performance if you print from a PDF rather than directly from Silverlight.
Have you looked into some third-party Silverlight reporting tools? Many of them will convert a report to PDF, Excel, and other formats.

Related

Render PDF in Xamarin Forms from a Stream

I have been searching the web however I have come up empty so felt the need to ask. We want to render a PDF file on iOS, Android and UWP through Xamarin Forms and the most important part, from a Stream.
I have come across answers like this however they just reinforce the notion of loading from a file or url.
We are not allowed to store the PDF files unencrypted on disk so the only 2 possible options I can see are to:
Find a viewer that can render from a Stream
Implement/expand a viewer that can render from a Stream
I haven't been able to find much based on these options so I am either hoping for someone to know of some framework or method of achieving this or at least some form of starting point library wise.
PDFTron PDFNet SDK is available for all the listed platforms, and Xamarin, and supports opening and viewing a PDF from a stream (no disk access required).
https://www.pdftron.com/pdf-sdk/xamarin-library
https://www.pdftron.com/documentation/xamarin/guides
While PDFTron was the only supplied answer I encountered great difficulty firstly getting any information from the company themselves in order to get costing information and secondly the trial downloads and samples wouldn't even compile.
I actually did some further research in to paid for solutions and found that SyncFusion offered a PDF viewer control that could also render from a Stream. They also provided answers to all my questions and got us up and running within less than a day.

I need some insight on PDF Bookmarks

I haven't done any programming to handle PDFs in depth, only PDF creation with PHP.
I've been asked into a project where the requirements are generating PDF bookmarks with titles created from selected text.
The scenario goes like this:
The user highlights some text in a given PDF file.
The user is prompted to enter the starting page number for the chapter (bookmark)
A bookmark is created with a title which points to the given page number.
Multi-level bookmarks to handle sub-chapters (like child nodes) should be supported.
Due to some restraints, the client would prefer this to be a web app if possible.
What platform/language/technology/library would you recommend?
Is it doable in a browser? Should this be a desktop app instead?
I am fluent in PHP/Javascript and capable in Python with tiny bits of experience on handling PDF files (nothing further than generating formatted PDF). (plus willing to learn anything new)
I've got some time to dig around and conceptualise it, so I'm very open to suggestions.
Any insight would be appreciated.

Need to print a PDF from .net and select different trays for output

My company is moving to a new system which has a very poor printing system in place but it does create PDF's on the file system.
My Boss has asked me to create an application to print all the PDF's based on a JOB number.
I've gotten the filesystem search working, I have used the acrobat sdk to open each file and find certain strings to determine which pages go where.
The problem I'm dealing with is that the Acrobat SDK doesn't seem to support choosing printer settings.
My first thought was no big deal I just change the default windows printer and just change the tray so the invoice part and equipment listing go to white paper from tray 1, and the remittance goes to tray 2 on blue paper.
It seems like the printdocument in .net can handle alot of printer settings but I'm not sure if a PDF can be used with a print document.
Looking for any advice or assistance.
Thanks,
Joshua
I found the answer was to use Win32.
Here was the website that helped me get through some of the hurdles:
http://edinkapic.blogspot.com/2011/01/how-to-set-printer-default-paper-bin-in.html
The underlying problem is that PDFs are combination of vector graphics for the text and bitmapped images. It all needs to be rendered into a format the printer understands before being printable.
Ghostscript does this very nicely and if you need to do it from .Net, GhostScript.Net provides an excellent vb.Net interface.
The problem I'm dealing with is that the Acrobat SDK doesn't seem to support choosing printer settings.
You can't use the desktop version of Acrobat for this, since it's not designed for unattended operation and requires a user interface. Also, I believe it violates Adobe's license.

Add watermark to various documents investigation

I've been asked to investigate the feasibility of adding watermarks to documents when printed through our application. The documents will consist of word, pdf and cad.
The interface of the application is vb6 with a plethora of vc6 dll's.
I can see a couple of possible solutions:
Convert all documents to PDF, add a watermark and then print.
Find a print driver that will add a watermark to all documents prior to printing and install it and reenable it at runtime if it gets disabled for any reason.
3rd Party suites are possibility (we use Volo View Express for viewing CAD files) but since this application is nearing end-of-life we wouldn't want to spend too much on it.
Has anyone had any experience of the above? Any gotcha's that will bog me down?
Tracker Software has a good set of PDF api's that that will allow you to implement the solution you already have in mind. I've used their Image and PDF libraries quite a bit with a lot of success in both VB6 and .NET. Single user licenses are not expensive (depending on how you look at it I guess), and I've found support to be excellent as well.

Is there a good ActiveX/COM component to "print" to PDF?

Clutching at straws here, I think I remember seeing a solution to this somewhere but can't find it now.
The issue is that I need a Windows application (not .Net) to be able to generate PDFs. The "standard" solution is to use something like PDF995 or CutePDF which create a dummy printer that your application can then print to and it is redirected to a PDF file. The problem is that to control those printers requires updating INI files or registry keys and that is error prone and often runs into concurrency problems.
Building the PDF file programmatically isn't an option, it needs to be able to take the output that would normally be sent to a printer, or possibly convert directly from an Excel file.
Ideally, I'd just pass the Excel file to a COM/ActiveX object and it would write to a file I specify. Next best option would be for it to create a separate printer per print job or have some reasonable way of guaranteeing the filename I give will have the document I print.
This Excel to PDF Batch converter might do the trick as at least it has a command line mode, has anyone tried that? It would only solve the problem for Excel files though.
So, is there a better solution?
(As a side note, for Visual FoxPro reports XFRX works really well, it converts the report directly to a PDF without needing a printer driver.)
You might want to look at BullZip (google it because I cannot add hyperlinks yet). We recently had Jody Meyer present this tool at the Detroit Area Fox User Group (previously shown at the Grand Rapids Area Fox User Group too). It was a great session.
She showed how to use the COM object to automate a ton of the BullZip features including the name of the file and properties like author and keywords. Watermarks are a snap too. It is simple and straightforward and her example was rock solid. Tons of features already done for you so you can simply re-engineer the demo form.
You can download it on the DAFUG Web site, in the downloads folder. File name is BullZipDemo.zip (google Detroit Area Fox User Group) and add the folder and filename.
Rick
VFP MVP
For this scenario I would recommend Amyuni PDF Converter. It provides a Microsoft Certified PDF Printer and ActiveX/.Net controls to communicate with it. Concurrency issues can be avoided by using these controls.
Disclaimer: I am part of the development team of this product.