HighCharts Export Server not rendering series marker symbols consistently - c#

The graph exported by the export server fails to render the images from a specified URL that are to be used as the marker for each series datapoint, such as of the following example:
"series":[{"data":[{"y":0.06,"x":3.5815,"marker":{"symbol":"url(https://www.highcharts.com/samples/graphics/sun.png)","width":40,"height":40}}}]
The rendering is inconsistent in the sense that it loads at times and doesn't at others. I am assuming the highchart export server returns the graph much before the images from the URL are loaded onto it.
Alternatively, is there any other way to load images as markers onto the graph by passing such a parameter in the JSON file?

I noticed that you already reported this issue here: https://github.com/highcharts/node-export-server/issues/43. Until this bug is fixed, you can use the older version of the export server (using PhantomJS). At the bottom of this page: https://www.highcharts.com/docs/export-module/render-charts-serverside you will find instruction how to install and configure legacy export server. Here is the example of use:
phantomjs highcharts-convert.js -infile options.js -outfile chart.png
I tried to generate image this way and it renders without any problems, resulting in:

Related

HiQPdf not displaying Charts on the generated PDF

I have been using the (free version) HiQPdf libraries to converto html pages to pdf documents.
I am also using in my pages several Chart objecs from the .Net Framework (System.Web.UI.DataVisualization.Charting.Chart) to produce bar graphics dysplaying values changing along time. It works wonders in my local environment when I debug with VS, but when I publish on my IIS or on other servers the charts do not appear at all on the pdf - note: they do appear on the webpages just not on the pdf.
In the Pdfs all the html is displayed correctly, inlcuding css, showing it exactly as seen on the page, except the chart images. I kind of understand that they would not appear as in the html, the image source from the charts results in something like:
<img id="MainContent_MyPageControl_ctl00" src="/MyTestWebSite/ChartImg.axd?i=charts_0/chart_0_2.png&g=396d61e14ceb41c08be06fd956cd4dca"
Because the real generated png image is not even directly referenced as usual. But the fact is they do appear on the generated pdf when running local from VS, which produces a similar html anyway as the above.
Only difference I see is that when I run local the Image Chart Handler key is defined in the webconfig as:
add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;"
but when publishing on a server I have changed it to:
add key="ChartImageHandler" value="storage=file;timeout=20;Url=~/MyfolderTempcharts/;deleteAfterServicing=false;"
So why dont the charts appear too on my generated pdf, or why they do appear if Im running from VS?
Anyone ever had this problem?
So I have figured out a way to deal with my problem, and I am sharing here if anyone is also in need. The deal is that the Chart objects use http handlers to render the chart generated images (you can read more about it in detail from these guys: https://web.archive.org/web/20201205231110/https://www.4guysfromrolla.com/articles/081909-1.aspx)
At first I thought I could manipulate the html (that I get before the page render) and replace the image sources with accessible links to send to the HiQPdf - for that I would need to temporarely copy the generated images to a public folder. That would be fine unless in my case I deal with sensitive data that should never be accessed even if only momentarily.
So what I do is I check that the image file does exists (in my configured folder) and extract the byte data from it, convert it to base 64 and replace it in the image source html where the handler is, and voila.
example of Base64 html embeded image:
Notice that this manipulated html is never accessible from the outside and is only worked on on the server side, in order to provide a "normal" html that the HiQPdf can pprocess.

Read OLE object with C#

I have an old application made with Visual Basic that can upload and download documents as OLE objects. That is retrieved to a SQL Server database, which stores them in a varbinary(max) field. However, those bins don't have the same format as regular files, as OLE structured them in its own fashion.
I want to mass download all those docs with a .NET C# app that uses SQL, but I can't find a way to do it. I have tried to copy the binary data in a new file using SqlDataReader, MemoryStream and FileStream, but they interpreted the information straightforward and not in the way OLE structured them. So, the resulting files were corrupted.
Is there a class that can interpret properly this OLE binaries? The old app used an OLE Container component, but they don't exist since a few years.
This is an old post that never got answered. I am in a similar situation myself in that I need to take images and convert them into OLE Files so that Microsoft Access OLE Bound Frames can read them. I have been researching this for days and have just now discovered the Binary Format that I need i.e. Compound File... or Structured File. They have this Nuget Package available which should accomplish what we both need available here: OpenMCDF
I am still in the process of trying to figure out how to create a compound file from Raw Binary... but feel I am close and will post the resolution when I get it.
UPDATE: The project that I was working on was not supposed to be so involved. Thus I didn't want to waste anymore time with it after already trying different recommendations for a couple days. Thus I ended up creating a complete hack that I never hope to have to repeat. Here are the steps that I used:
I set up a form with a maximized window to display each of the images one by one via a timer interval.
Between each interval I took programmatic screen shots (Print Screen) of the images, saving them in a separate folder using an identifiable naming convention.
That portion was done all in VBA.
Once I had full screen shots in a folder, I then used PhotoShop to then crop all the images in a batch to the exact image sizes.
A hack yes, but it accomplished what I needed... what a pain!

Rendering barcodes in PDF export from Microsoft.ReportViewer.LocalReport

I am using Microsoft.Reporting.WebForms namespace and trying to render the data from my localreport object for printing purposes on the client side.
byte[] bytes = myReportViewer.LocalReport.Render("PDF");
File.WriteAllBytes("test.pdf", bytes); // I will normally return bytes here but for testing I am writing to a file
The output pdf file is displaying little boxes instead of barcodes. It appears that pdf can't support code128 font.
Things I've tried:
Tried other file formats: "Image" is rendering but is too blurry. "WORD" breaks the report design and margins.
Installed the font on both the server my app is on and client
giving parameters to render method
PS:
The built in exportReport method from the client side exports the pdf perfectly with sharp barcodes. But I am trying to render the data and return it as byte array. I couldn't figure out the difference between this client side method and server side render method. Do they use different logic?
I would appreciate if you can direct me in some direction.
Thanks.
It seems that this was a known bug with Microsoft Reporting Services 10.0.0. After much googling, I stopped and checked my referenced files. It turns out that I was referencing version 10 of Microsoft.Reporting.WebForms although in my other project that worked it was version 11.
So if anyone runs into the same problem, just make sure that you are not using the version 10 dll files.

SSRS .net PDF to Image from SQL

I have looked and there doesnt seem to be anything around to do this.
I have a database with a varbinary column that contains a PDF.
I want to display this as an image in SSRS.
I can't find any way with ghostscript or spire.pdf etc (the free options) that allow you to pass a stream as the pdf input, and then output the images, they all seem to need an actual file.
Googling this gives a codeproject example from 2009 which uses a component you now have to buy, plus sqlclr which seems overly complicated.
I just want a .net class i can build and reference in my SSRS rdl file which i can pass the field as the result of the sql query and get back a list of images (1 per page)
Instead of trying to display PDF stored in VARBINARY(MAX) directly in SSRS, I would try to obtain the images before generating the report:
1) use a tool to generate an image from a PDF (e.g. ImageMagick). More details about this conversion can be found here.
2) Display images in SSRS from VARBINARY(MAX) using this tutorial.
This means to have some redundancy (extra space needed), but reports will generate faster.

how can i use zxing in html5?

I currently have the zxing lib running on my silver-light project.
It's not lightning fast but it works fine and accurate.
However... the limitations are that some people use Linux and silver-light don't run very well (If at all) on some Linux platforms even with mono (moonlight)
So I'm trying to develop something that will decode bar-codes directly from an html5 page then send this information to my server by calling a service.
I am using c# at present.
I have the zxing jar files but have very little to no idea how to utilize them in an html5 page.
I have the webcam up and running using the html5 getUserMedia and can grab a frame from the stream and put it into a canvas, but can not work out how to integrate it with the zxing library.
Any and all help will be well appreciated.
There are a few native JS barcode scanning libraries out there that you could use:
http://badassjs.com/post/654334959/barcode-scanning-in-javascript
https://github.com/manuels/unix-toolbox.js-exact-image/
https://github.com/LazarSoft/jsqrcode
The last one is apparently a port of zxing, though it looks like it is tailored to QR code scanning.
I'm working on something similar. Trouble is, I've not gotten it to completely work either. But maybe this can help:
Like you, I've gotten an HTML5 webcam with a canvas to capture stills of the barcode. To use the ZXING stuff, you'll need to either compile the java files from source yourself, or get a pre-compiled .war file and find some way to host the servlets. I'm hosting mine using tomcat with the pre-compiled war pulled down from the maven repository (http://repo1.maven.org/maven2/com/google/zxing/zxingorg/2.2/) .
Once that's set, the ZXING decoding servlet is expecting either a URL or a file from an html form that has its action set to the url of your decode servlet. So you could take captured barcode on the canvas, save it to a file, and then have the user manually submit the file via the html page(exactly like the zxing.org web version) and that would work. However, if you wanted to seamlessly take the captured still and send it to the ZXING decoder, it's a bit more difficult and that's where I'm stuck as well.
I used javascript to convert the canvas's image to a blob first (and mind you, this only works in Firefox, since Chrome doesn't support canvas blobs yet. no idea about IE). Then I created a new FormData object, giving it the existing id of a form on the webpage, and appended the blob to that form. Then I used a submit button on the webpage to do the actual submitting of the form, which sends it via post to the decode servlet. I then get a nice white page with a console error about the character encoding of a plain text document not being declared.
I've also tried creating a new XMLHttpRequest in the javascript file, appending the canvas blob to that rather than an existing html form, and submitting via that. According to the console, that seems to get a bit farther (the console will show whether it redirected to a "results not found" page or to the results page), but I can't actually see/manipulate the output data.
Sorry I can't be of more assistance. I'd love to see someone get a completely web based version of this working since ZXING seems to be really good at the decoding process.

Categories

Resources