Comments (7)
ah,i can‘t understan,can you?
from zxing.net.
Can you explain what you have tried?
I did some tests 4 years ago. I got it running with SSRS 2012. Not sure if it works the same way with SSRS 2016.
First I made a little additional project "SSRSBarcodeDemo" which implements ICustomReportItem.
The custom report item adds a custom designer for the barcode control. The report item itself calls the BarcodeWriter class.
To get it running I had to copy the SSRSBarcodeDemo assembly and the zxing.dll to the following directory:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies
I think for SSRS2016 the "11.0" has to be changed to "14.0" or something similar.
I added the following lines
<ReportItems>
<ReportItem Name="ZXingBarcodeControl" Type="SSRSBarcodeDemo.BarcodeCustomReportItem, SSRSBarcodeDemo" />
</ReportItems>
to the file
C:\Program Files\Microsoft SQL Server\MSRS11.WORKSHOP\Reporting Services\ReportServer\rsreportserver.config
before the closing tag </Extensions>
I added the lines
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="ZXingBarcodeControl" Description="This code group grants FullTrust to ZXing Barcode Demo assembly.">
<IMembershipCondition class="StrongNameMembershipCondition" version="1" PublicKeyBlob="0024000004800000140100000602000000240000525341310008000001000100014c9a01956f13a339130616473f69f975e086d9a3a56278936b12c48ca45a4ddfee05c21cdc22aedd84e9468283127a20bba4761c4e0d9836623fc991d562a508845fe314a435bd6c6ff4b0b1d7a141ef93dc1c62252438723f0f93668288673ea6042e583b0eed040e3673aca584f96d4dca19937fbed30e6cd3c0409db82d5c5d2067710d8d86e008447201d99238b94d91171bb0edf3e854985693051ba5167ca6ae650aca5dd65471d68835db00ce1728c58c7bbf9a5d152f491123caf9c0f686dc4e48e1ef63eaf738a12b3771c24d595cc5a5b5daf2cc7611756e9ba3cc89f08fb9adf39685bd5356858c010eb9aa8a767e5ef020408e0c9746cbb5a8" />
</CodeGroup>
to the file
C:\Program Files\Microsoft SQL Server\MSRS11.WORKSHOP\Reporting Services\ReportServer\rssrvpolicy.config
and to the file
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\RSPreviewPolicy.config
Without the custom report item and using only custom code in the report you should get a different exception now: "That assembly does not allow partially trusted callers".
I could only fix it with a special build of zxing which adds the attribute AllowPartiallyTrustedCallers.
https://docs.microsoft.com/en-us/sql/reporting-services/custom-assemblies/using-strong-named-custom-assemblies
from zxing.net.
I positioned the zxing.dll (.NET 2.0 version) in the C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies folder.
I created a new report. I added a reference to zxing.dll and system.drawing. I added the following custom code:
Public Function getBarCode(ByVal s As String) As Byte()
Dim b As System.Drawing.Bitmap
Dim writer As New ZXing.BarcodeWriter()
writer.Format = ZXing.BarcodeFormat.DATA_MATRIX
writer.Options = New ZXing.Common.EncodingOptions
writer.Options.Width = 100
writer.Options.Height = 100
writer.Options.Margin = 30
b = writer.write("1234")
Dim bitmapData as byte() = Nothing
Using ms As New System.IO.MemoryStream()
b.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp)
bitmapData = ms.ToArray()
End Using
Return bitmapData
End Function
Then on the report you add an Image. Set the Image Source to Database. Set the Field to an expression with value =Code.getBarCode("1234"). Set the MIME type to image/bmp.
Run the report and get the runtime error.
Thanks for you attention
Tim
from zxing.net.
Then it is as I said before.
You have to add the mentioned lines to the file rssrvpolicy.config and RSPreviewPolicy.config. And you need a zxing.dll with the attribute AllowPartiallyTrustedCallers which isn't available yet.
I can't say when I will provide such a version of the assembly because it has some side effects.
Meanwhile you can try to write a wrapper assembly which contains your custom report code. With such a wrapper it should be possible to work around the strong name problem.
from zxing.net.
I have followed all the steps and end up with the error
anonymous access.
[rsRuntimeErrorInExpression] The Value expression for the image 'Image1' contains an error: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
from zxing.net.
[rsRuntimeErrorInExpression] The Value expression for the image 'Image1' contains an error: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
[rsInvalidDatabaseImageProperty] The value of the ImageData property for the image 'Image1' is "=Code.getBarCode(Fields!csv.Value)", which is not a valid ImageData.
Preview complete -- 0 errors, 2 warnings
from zxing.net.
I would like to leave a link here, if someone has the same issue.
This happens because of Bitmap.LockBits
https://www.codeproject.com/Articles/625868/LockBits-Alternative-SecurityException-Workaround
More details:
https://stackoverflow.com/a/71710028/11829240
from zxing.net.
Related Issues (20)
- UPC/EAN Extension 2/5 does not read the 2/5 digit extension
- Can someone finally fix the example usage in README?
- Don't decode QR_CODE HOT 3
- ZXing.Net doesn't seem to be able scan more complicated PDF417 barcodes HOT 12
- EPC QR Code (European Payments Council) Not Decoded HOT 3
- Support for Latin-1 in BARCODE-128 HOT 4
- Upgrade SixLabors.ImageSharp - current version has vulnerabilities HOT 1
- UPC_A's error message is wrong.
- The image for PLESSEY is vertically tiny. HOT 6
- The sides of UPC_A's image could be slightly cut out. HOT 1
- Centering PDF_417 Barcodes and Unstable Width/Height HOT 1
- Barcode as small part of image HOT 1
- Barcode generator: unpredictable whitespace padding around it depending on requested Width
- Upgrading to Magick.Net 13.7.0 breaks ZXing.Magick HOT 1
- ZXing for WinUI-3 HOT 1
- Barcode DATA_MATRIX code = BCD88888888-1 to BCD88888888-99 Don't look right they are not a sqaure
- Undecodable QR code generated
- Recognizes the UPC_E format on the Qr_CODE HOT 5
- Cannot create GenericMultipleBarcodeReader from ZXing.OpenCV.BarcodeReader HOT 2
- Digitally sign ZXing NuGet package assemblies HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zxing.net.