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.
Related
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.
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:
It seems like there should be more information on this, but I can't seem to find the right words to search by.
Basically, I have a C# application that prints off a filled out form. I take user input and draw them over a image of the form then print it off. This application works perfectly for all but one of the workstations that use it.
The text on the form doesn't print in the correct location, rather it seems to be offset by and additional .25" on the x and y axis while the image of the form prints of perfectly. All workstations print to the same shared printer and use the same application.
I'm not sure what settings would cause the printer to print the text in a different location.
Is there a way to configure my application or the users workstation so I won't need to created a "personalized" version of the application for that workstation?
Thank you for help.
If you can't find the reason in different drivers or resolutions, an alternative might be to generate a PDF and then send that to the printer. That way you have control of the output page and can preview it as well. There are many libraries for generating PDF files. If you're generating HTML, you can use the free wkhtmltopdf to convert from HTML to PDF. I'm sure there are many others as well. Good luck!
I am facing a strange issue. I have a html document, and to create PDF out of it, I am using abcPdf.
When I was using abcPdf v7, the resulted pdf was fine. But moving it to version abcPdf 9 making the whole thing bigger [a bit big font, hence lessar margin]
Any idea if this is an intentional upgrade implementation. And please let me know if any check is present to make it compatible with v7 generated pdf.
I think its due to the html engine has grown in ABCpdf. Now you can choose MSHTML engine (Internet Explorer) or Gecko engine (Firefox). Maybe yoy have to explore this changes vía Engine property (http://www.websupergoo.com/helppdfnet/source/5-abcpdf/xhtmloptions/2-properties/1-engine.htm)
But as a licensed user, send them an email, they use to reply very fast.
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.