-3

I am facing an issue while generating pdf report with image(png,jpeg). The image appears as black in the pdf preview. User will have an option to record their signature on a html canvas and the respective signature will be stored in the DB as binary and later shown it the report. When I am manually generating an image using a paint, it is displaying as expected. Only the images which are generated through the canvas is having the issues.

I am using asp webforms, java script and oracle to store the binary and crystal report to preview the generate the pdf.

PDF Preview: enter image description here

2 Answers2

0

A typical problem in using png files in a Crystal report is that transparent background shows up as black. You can fix the issue directly in your code. Alternatively, you can solve the problem with a Crystal Reports UFL (User Function Library).

At least one of the 3rd-party Crystal Reports UFLs listed here can solve this by changing the image on the fly (so that transparent-black becomes opaque-white) as shown in the image below:

enter image description here

MilletSoftware
  • 3,521
  • 2
  • 12
  • 15
  • Hi, Thanks for your response. I am using blob object to display the image in report. And in my case not the background is showing black. Complete image is showing as black. – rugma ramachandran Jul 11 '22 at 18:15
  • How does it display in the Crystal Reports preview? – MilletSoftware Jul 11 '22 at 18:55
  • I have added the PDF preview with my question. Kindly check it, Initially I thought it was problem with the byte array. Hence I converted it to an image and downloaded it in the physical path. I am able to preview the same without any issues. Also I tried adding an image generated by me using MSPaint. The image which I have generated using MSPaint works fine in the PDF preview. Only the images which I have generated through the canvas is having this problem. I am really clueless here. Appreciate your help. – rugma ramachandran Jul 11 '22 at 19:49
  • That confirms it is not a pdf export issue. Something is wrong with the binary content. You can try to work around it using code to convert the blob to an image file and refer to that file using the 'Graphic Location' property expression. – MilletSoftware Jul 11 '22 at 23:45
  • Hi, yes you are right. I tried sending blob/base64 string to my server and converted to an image file. And then added an image object in the report and set graphic location property to the image path. Same black rectangle box appeared in the report. I tried almost all combination. Neither of the solutions worked for me :( – rugma ramachandran Jul 12 '22 at 13:35
0

It should not be Base64 -- it should be binary.

If you must start with Base64, then convert it to Binary. You can do that either in the source step or on-the-fly using a Crystal Reports UFL.

MilletSoftware
  • 3,521
  • 2
  • 12
  • 15
  • Hi, I tried both base64 and binary approach. It did not work for me. How to use CR UFL ? – rugma ramachandran Jul 12 '22 at 15:10
  • I tried rather simpler approach. Downloaded file directly in the JavaScript itself https://stackoverflow.com/questions/10673122/how-to-save-canvas-as-an-image-with-canvas-todataurl/ . The same image I tried to add it in the report and in the report preview it shows black again. – rugma ramachandran Jul 12 '22 at 15:47