You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A challenge I encountered while working on custom cryptocurrency extensions. I have successfully developed a paper wallet solution for these extensions. However, I faced an issue when attempting to include description or message data within the HTML-rendered content for the paper wallet.
The problem I encountered was that, when sending this content via email, the actual HTML source code was being displayed instead of the desired rendered content. I am aiming to find a solution that enables me to send the HTML-rendered data as the content or message within the email body.
My goal is to ensure that the recipients of these emails are able to see the beautifully rendered HTML content rather than the raw source code. If you have any insights or suggestions on how to achieve this, I would greatly appreciate your guidance.
This is the source code of Our Paper Wallet Generator:-
public class VoucherWalletGenerator implements IPaperWalletGenerator {
private static final Logger log = LoggerFactory.getLogger("batm.master.VoucherWalletGenerator");
private IExtensionContext ctx;
private ITransactionDetails transactionDetails;
private Locale locale;
private static final int imagesize = 400;
private static final String MESSAGE = "This is a test content for paper wallet";
public VoucherWalletGenerator() {
}
public VoucherWalletGenerator(ITransactionDetails transactionDetails, Locale locale){
log.info("3 transaction details in method:"+transactionDetails.getCryptoCurrency());
this.transactionDetails=transactionDetails;
this.locale=locale;
}
@Override
public IPaperWallet generateWallet(String cryptoCurrency, String passphrase, String language, boolean shouldBeVanity) {
return generateWallet();
}
private VoucherPaperWallet generateWallet() {
log.info("4 transaction details in method:"+transactionDetails.getCryptoCurrency());
String charactersallowed = "";
String newtkn = "XYXYXYXYXY";
VoucherPaperWallet paperwallet = new VoucherPaperWallet();
byte[] image = generateQR(newtkn, imagesize);
paperwallet.setCryptoCurrency(CryptoCurrency.VE.getCode());
paperwallet.setMessage(EmailProviderForVoucher.getBuyVoucherHtmlBody(transactionDetails,locale));
paperwallet.setFileExtension("png");
paperwallet.setAddress("");
paperwallet.setContentType("image/png");
paperwallet.setContent(image);
return paperwallet;
}
public byte[] generateQR(String address, int size) {
Hashtable hintMap = new Hashtable();
hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
try {
QRCodeWriter qrCodeWriter = new QRCodeWriter();
BitMatrix byteMatrix = qrCodeWriter.encode(address,
BarcodeFormat.QR_CODE, size, size, hintMap);
int matrixWidth = byteMatrix.getWidth();
BufferedImage image = new BufferedImage(matrixWidth, matrixWidth,
BufferedImage.TYPE_INT_RGB);
image.createGraphics();
Graphics2D graphics = (Graphics2D) image.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, matrixWidth, matrixWidth);
// Paint and save the image using the ByteMatrix
graphics.setColor(Color.BLACK);
for (int i = 0; i < matrixWidth; i++) {
for (int j = 0; j < matrixWidth; j++) {
if (byteMatrix.get(i, j)) {
graphics.fillRect(i, j, 1, 1);
}
}
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageOutputStream stream = new MemoryCacheImageOutputStream(baos);
ImageIO.write(image, "png", stream);
stream.close();
return baos.toByteArray();
} catch (WriterException | IOException e) {
log.error("Error", e);
}
return null;
}
}
The text was updated successfully, but these errors were encountered:
A challenge I encountered while working on custom cryptocurrency extensions. I have successfully developed a paper wallet solution for these extensions. However, I faced an issue when attempting to include description or message data within the HTML-rendered content for the paper wallet.
The problem I encountered was that, when sending this content via email, the actual HTML source code was being displayed instead of the desired rendered content. I am aiming to find a solution that enables me to send the HTML-rendered data as the content or message within the email body.
My goal is to ensure that the recipients of these emails are able to see the beautifully rendered HTML content rather than the raw source code. If you have any insights or suggestions on how to achieve this, I would greatly appreciate your guidance.
This is the source code of Our Paper Wallet Generator:-
The text was updated successfully, but these errors were encountered: