Last active
November 24, 2022 04:28
-
-
Save SiddiqueAhmad/7ca3da59301ce21093b2435fc25b7b94 to your computer and use it in GitHub Desktop.
custom fonts in BIRT, integrated with Axelor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AnyController { | |
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); | |
public void print( | |
ActionRequest request, ActionResponse response) { | |
List<Long> ids = (List) request.getContext().get("_ids"); | |
String fileLink; | |
String title; | |
PrintServiceImpl printService = Beans.get(PrintServiceImpl.class); | |
fileLink = printService.getFileLink(ids); | |
response.setView(ActionView.define(title).add("html", fileLink).map()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.axelor.app.AxelorModule; | |
public class AnyModule extends AxelorModule { | |
@Override | |
protected void configure() { | |
bind(PrintServiceImpl.class); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cp "/resources_path/report/fonts/font-family/font1.ttf" ~/.fonts | |
fc-cache -fv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.axelor.apps.tool.file.PdfTool; | |
import com.google.inject.Inject; | |
import com.lowagie.text.FontFactory; | |
import org.eclipse.birt.report.engine.api.IReportEngine; | |
import java.util.List; | |
import java.io.IOException; | |
public class PrintServiceImpl { | |
private IReportEngine engine; | |
@Inject | |
public PrintServiceImpl(IReportEngine engine) { | |
this.engine = engine; | |
FontFactory.register("/resources_path/report/fonts/font-family/font1.ttf", "alias-fontfamily"); | |
} | |
public String getFileLink(List<Long> ids) throws IOException { | |
List<File> printedSaleOrders = new ArrayList<>(); | |
return PdfTool.mergePdfToFileLink(printedSaleOrders, "prefix-SaleOrders-postfix.pdf"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Informative ...