Programmatically render a LocalReport to XPS - reporting-services

I'm trying to render a LocalReport to a XPS file, so I can print them from a Windows Service using the XPS Print API, as it is shown in this article.
The problem I find is that I cannot render a local report directly to XPS. Maybe I can render it to an image stream, and then embed that image into a manually created XPS, but I don't like that solution too much.
I would really appreciate any advise about rendering a LocalReport to XPS.

Unfortunately, it won't be easy. Except that it is.
First off, everything has to happen within an STA thread. So you start out with threading issues.
Next, XPS documents are deeply intertwined with WPF. XPS documents expose their content as FixedDocumentSequences, which are DependencyObjects. That's all WPF. Your LocalReport is not WPF, its a Forms-based component.
Your only option is to render the report to some kind of format that can be converted to a WPF representation by some kind of parsing and rendering process you code. This might be as simple as creating images from the report, or as hard as writing an XSLX converter.
But why even bother with this in the first place? The documentation for LocalReport shows how you can print the report without dealing with XPS print paths.

Related

Cannot print out XPS document

I have a program that accepts parameter and generate XPS file.
However I've found that SOME file cannot be printed out with whether Windows XPS Viewer or Windows API to print it out.
When printing with XPS Viewer, it will prompt an error with "A printing error has occurred", "The XPS Viewer cannot print all pages of this document".
While printing with Windows Api Startxpsprintjob, it did returned a print job id but not print out.
For both the method above, it will produce the following sequence in windows print operation log:
As it only happens for some combination, I suspect that maybe it's related to XPS embedded font, however I can view all fonts correctly in the XPS viewer.
I have no idea on what can I do next, any help will be appreciate, thanks!
It's about XPS file contents and the way how Windows handles it. Some hints can be picked up here https://stackoverflow.com/a/6678902
You could try to print page by page (or even selection) and try to find out which contents cannot be printed.
What I experienced, the case when word document had been converted into XPS file, insertion of image with text made the problem, and inserted text box was the solution.
So, it can be anything. Good luck! :-)

wkhtmltopdf does not convert to pdf

Hi ,
I just changed my server and from what i understand i have installed all the dependencies required for this. But still i am unable to view my PDF instead a distorted code is shown and what's more annoying is that i have a bunch of projects in CODEIGNITOR Framework that are working fine but this project is developed in laarvel 5.
Is there any additional dependency for laravel or am i doing it wrong at some place.
I just joined a new team and don't know their whole programming structure yet.
The image-content you posted looks like a valid PDF - looking at it by a text viewer.
Did you try to open it with a pdf viewer?

PDF Annotator with JSON layers

I am attempting to create a pdf annotator using PDF.js and a HTML5 drawing app to create a JSON file.
Using this: https://github.com/mozilla/pdf.js/blob/master/examples/learning/prevnext.html
Maybe this: http://codecanyon.net/item/html5-drawing-tools/8869338?WT.oss_phrase=&WT.oss_rank=2&WT.z_author=appsandsites&WT.ac=search_thumb
to create a JSON like http://www.html5rocks.com/en/tutorials/canvas/integrating/#web
Any thoughts or suggestions on how to do this? Do you think I could use PHP to create and place the file on my server?
Direction on the best way to do this is appreciated.. what version of JSON, how to use canvas to create a file and edit it, etc
Update, I want to lay this over PDF.js:
https://github.com/trsanders/responsive-sketchpad
and then in PHP create a JSON file that stores the url of a PDF and the URL to the generated json/image.
Update 2/23
I found a document browser in Perl with flexpaper which lays aframework foundation for what I want to do, but does not add in drawing support. What I was thinking is the above image.
http://eric-blue.com/2010/02/12/example-document-browser-code/
Hypothes.is supports text annotation of PDFs (via PDF.js and Annotator). The plan at The Hypothesis Project (a non-profit...also where I work, fwiw) is to upstream the PDF related features that have been made to its customized Annotator, so they'll be available to more developers.
Here's an example of Hypothes.is loaded on a PDF via a proxy. The same functionality is provided without the proxy by using a bookmarklet in Firefox or the Hypothes.is Chrome extension.
Additionally (if you're wanting shape drawing on top of PDF.js rendered PDFs), you might check out the Annotorious polygon preview. Similar to what you've described, plus annotation, plus storage...though I don't believe it works on PDFs...just images.
There is also ongoing work being done at the W3C to build an interoperable annotation data model. Checkout the Annotation Working Group for more information.
Lastly, PDF.js is also getting work done to it now to support PDF-level annotations. Eventually, it should give PDF.js a strong foundation for exposing annotations loaded from other sources.
Hopefully that's enough to get you started. :)

Drupal 7 (VERY) Custom Preview

I have a drupal site that is being used strictly as a CMS that produces JSON feeds using services and services_views, which are consumed by a separate site. What I would like to do (and I have a working proof of concept of this) is allow for a "live preview" on the real site, by intercepting the node form preview / submit, encoding the node as JSON, and loading a special page on the live site that consumes that JSON and displays the page accordingly.
The problem with this JSONized node is, it's different from the JSON being produced by my view (using services_views). My end goal is to produce JSON that is identical for both previewed and non-previewed objects, without having to maintain separate output methods (I could easily hand-customize the json but then when my view for the public api changes I have to make the same changes to the preview json. Trying to avoid this).
I'm looking for feedback on this approach. Is what I'm attempting even possible? The ideas I've been able to come up with so far are:
being able to (conditionally) drive my view with data from a non-databse source
sneakily inserting data into the view object during one of the stages of execution? Kludgy but I'm not above that :)
saving a "clone" node (or revision?) of the node being previewed and let the view use that to display the preview JSON?
Maybe this is the wrong approach altogether and there's something better? (Trying to intercept and format the services output in my module... maybe avoid services_views altogether?)
If anyone can offer some advice, insight or opinions on how to best proceed here, I'd be really grateful.
in a custom module, you could set up a page that grabs the json output from the view page.
$JSON = file_get_contents($url);
that way the preview stays bound to the view, even if the view changes.
First I think it's not an easy task what you are trying to achieve. So before all, good luck.
I think you could intercept the node submission data, then create a node programatically, then render that node, and then export the rendered node to JSON. Inmediately after you get the JSON, delete this node, because the programmatically created node is only for preview.
This task could be more CPU demanding but think that previewing content exactly as the content will look is difficult.
Your rss feeds that your site reads could be filtered with some parameter to avoid programmatically created nodes (prewiew nodes), despite these nodes will be available for a very short time.

Generate dynamic html

to export some data i want to be able to generate an html output.
I have some constant content to output, like html headers and footers.
My question is how to deal with that ?
Do I have to embed some template (in a resource file) and parse it to make it dynamic ?
Do I store my static content in some constant (is there a 255 char limit?) and append them while generating the dynamic content ?
Do you have some hints, useful links, or best practices to share?
Thanks
Use the Delphi TPageProducer. It generates HTML from a 'close to HTML' template which contains special tage. You respond to these tag in an event and replace them with your own data. Works a treat.
I've created a Delphi project that handles this issue also. I wanted to create a web-platform that uses Delphi-code in the same source-files as the HTML, much like other web-scripting platforms, but still compiles a library to run. (and auto-compiles on changes)
http://xxm.sf.net/
In its basic form it compiles into library that can be run by a handler for IIS (ISAPI extension), InternetExplorer (IInternetProtocol as its own URL scheme), or a stand-alone HTTP process. (Apache module and FireFix plug-in are on the way).