void makePdfPage(String url, PdfContentByte contentByte){
com.itextpdf.text.Font sans = UtilityMethods.getSansSerifFont(14);
sans.setColor(80,147,225);
ColumnText ct = new ColumnText(contentByte);
ct.setSimpleColumn("Hello", 0, 780, 595, 830, 10, Element.ALIGN_CENTER);
try {
ct.go();
} catch (DocumentException e) {
System.out.println(e);
// TODO Auto-generated catch block
e.printStackTrace();
}
Promise<WSResponse> out = notification.call(url);
out.map(resp->{
Map<String,Object> mapp= Json.fromJson(resp.asJson().get("list"), Map.class);
PdfService.designPdf(mapp, contentByte);
return resp;
});
}
contentByte
is going empty to desginPdf
Its going async so thats why its not having the value of contentByte, can any other way so i can synchronously use or any other way to solve my problem.
WSResponse resp = out.get(10000);
getting fails
I don't have experience with Java promises, but based on my experience in Scala, I would've tried something like this:
Promise<WSResponse> out = notification.call(url);
WSResponse res = out.map(resp->{
Map<String,Object> mapp= Json.fromJson(resp.asJson().get("list"), Map.class);
PdfService.designPdf(mapp, contentByte);
return resp;
});
//Do something with res
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With