开发者

Display dynamic QR Code in Crystal Report in asp .net page C# code-behind

I'm using CRv9 and want to make use of Google Charts API for generating QR co开发者_Go百科de on fly (in asp .net) and display it in the Crystal Report in a PDF format. I have spent the whole day looking for solution with no luck. The way we output the report is we use .rpt file, feed it with data and use Response.OutputStream to feed to browser. No CrystalReportViewer control hence CSS solution is not an option.

Now, I got as far as added an OLE Object from file with Link, which I would be overwriting every time the new QR code is generated. I apreciate that CR requires it to be a bitmap, so I was planning to download and convert the google's generated PNG file to BMP, that's not an issue. The problem is that Image in the report does not update after I replace the file. Meaning, it displays the original image, which was added as an OLE Object. If I open this report in CR designer, the image gets refresh/updated and I'd have to save changes to the report to see this new image next time I generate a PDF file.

The question is really how to achieve a dynamic image in Crystal Reports 9? Remember, Picture object did not have a Graphic Location property until vXI, so I cannot use that.

Please help, I'm kinda stuck here. Manipulations with DataSets is not an option either as we're not giving report a datasource, instead we just map the fields with FormulaFieldDefinitions.

sample qr code url: https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=Hello%20world&choe=UTF-8


Try this:

  • Insert a picture; use a dummy QR code or something about the same size
  • Right-click the image and select 'Format Graphic...'
  • Select the Picture tab
  • Add your URL, in double-quotation marks, to the Graphic Location's conditional formatting
  • Refresh the report

My original posting: Crystal Reports: Dynamic Images

This technique worked with versions prior to XI.


Another idea: create a user-function library (UFL):

Creating a Crystal Reports Custom Function Library

You can also create a UFL in Java. In the UFL, you could make the call to Google's service and return the resulting image.

Or purchase a QR UFL: QR Code Font kit


No idea about anything in crystal reports, but the traditional way of embedding barcodes is to use a font, not an image. So it should be pretty doable if you have the ability to use custom fonts here.


the answer to my question is "it's impossible" :(


I had similar issue with dynamic QR-code as image. The problem with CrystalReport is that it flattens image rendering. My solution was to use the rdlc reporting option, though am not an expert in it. It solved the issue because it renders the image as the original file.

Add image to the report and set the source to database in the property. Set it to conform to original size. I think SAP should look into the way image is rendered because I had to change lots of design to rdlc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜