Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a7ea76c
Support for PDFBox initial commit
tomas-sexenian Mar 10, 2023
c03d347
progress
tomas-sexenian Mar 14, 2023
dcd1d7c
static code analysis ok
tomas-sexenian Mar 15, 2023
4d3bcbc
Code cleaning and minor fixes
tomas-sexenian Mar 16, 2023
d2b97ea
Merge branch 'master' into PDFBoxSupport
tomas-sexenian Mar 21, 2023
9bc331c
Small fixes
tomas-sexenian Mar 21, 2023
7a10320
Merge branch 'master' into PDFBoxSupport
tomas-sexenian Mar 21, 2023
5b1f533
Various fixes
tomas-sexenian Mar 22, 2023
c59c836
close streams and added dependencies
tomas-sexenian Mar 22, 2023
b2b4d1c
Initial parent and children refactoring
tomas-sexenian Mar 23, 2023
4f975da
Parent n child tweaks and document shows on screen
tomas-sexenian Mar 24, 2023
864e006
text, lines and rectangles appear on report
tomas-sexenian Mar 27, 2023
ce2af28
Support for img and many controls at the same time
tomas-sexenian Mar 29, 2023
ec81e28
More code cleanup
tomas-sexenian Mar 29, 2023
af3d99b
Fix all use of PDRectangles
tomas-sexenian Mar 30, 2023
0510343
bold and italic text support
tomas-sexenian Apr 3, 2023
b32c7dc
Fix pagination and report library support
tomas-sexenian Apr 10, 2023
1f99b11
Minor casing, naming and catching fixes
tomas-sexenian Apr 11, 2023
3661350
Merge branch 'master' into PDFBoxSupport
tomas-sexenian Apr 11, 2023
d0fcd7e
Merge branch 'master' into PDFBoxSupport
tomas-sexenian Apr 11, 2023
d707212
code styling, text positioning, text wrapping and text coloring fixes
tomas-sexenian Apr 20, 2023
9f5fe13
Code refactoring, GXPrintInit and text writing in pdfbox
tomas-sexenian Apr 21, 2023
b16d167
text styling fixes: bold, italic and fore color
tomas-sexenian Apr 21, 2023
f2b5448
Merge branch 'master' into PDFBoxSupport
tomas-sexenian Apr 21, 2023
ce5e0a2
Logging update into l4j and font rework in pdfbox implementation
tomas-sexenian Apr 25, 2023
08e9060
GxDrawBitMap now supports all possible bitmap locations
tomas-sexenian Apr 26, 2023
22be488
barcode support in pdfbox implementation
tomas-sexenian Apr 27, 2023
bfabaf9
Fixed remaining logging mistakes plus code prettify
tomas-sexenian May 4, 2023
73a9d02
iText7 support
tomas-sexenian May 16, 2023
cb5329e
Merge branch 'master' into PDFBoxSupport
tomas-sexenian May 17, 2023
ea5a657
Remove PDFReportItext
tomas-sexenian May 17, 2023
79b3d8d
Fix implementation reading in client.cfg
tomas-sexenian May 19, 2023
9ad48bd
Deleted unnecessary code and add debug for itext7
tomas-sexenian May 19, 2023
aa211aa
Fix fullgx test 7322
tomas-sexenian May 21, 2023
8be4914
Merge branch 'master' into PDFBoxSupport
tomas-sexenian May 21, 2023
811aa59
Particular log for each report implementation
tomas-sexenian May 23, 2023
4fc797e
Fix wrong call to implementation constructor
tomas-sexenian May 23, 2023
0c68e93
Adjusted pagesize of iText7 reports
tomas-sexenian May 23, 2023
af2fbb0
Fix pagination error when images exceed page size
tomas-sexenian May 24, 2023
12b382a
Merge branch 'master' into PDFBoxSupport
tomas-sexenian May 24, 2023
389c845
Merge branch 'master' into PDFBoxSupport
tomas-sexenian May 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions android/src/main/java/com/genexus/ClientPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -529,4 +529,8 @@ public boolean getJDBC_LOGEnabled() {
return iniFile.getProperty(name, "JDBCLogEnabled", "0").equals("1");
}

public String getPDF_RPT_LIBRARY(){
return iniFile.getProperty(defaultSection, "PDF_RPT_LIBRARY", "ITEXT");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ public interface IClientPreferences {
String getPRINT_LAYOUT_METADATA_DIR();

boolean getEXPOSE_METADATA();

String getPDF_RPT_LIBRARY();
}
21 changes: 21 additions & 0 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,32 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itext7-core</artifactId>
<version>7.2.5</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>html2pdf</artifactId>
<version>4.0.5</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itextasian</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.27</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>com.sap.conn.jco</groupId>
<artifactId>sapjco3</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions java/src/main/java/com/genexus/ClientPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,4 +534,8 @@ public int getHttpBufferSize()
}
return HTTP_BUFFER_SIZE;
}

public String getPDF_RPT_LIBRARY(){
return iniFile.getProperty(defaultSection, "PDF_RPT_LIBRARY", "ITEXT");
}
}
19 changes: 9 additions & 10 deletions java/src/main/java/com/genexus/GXWebReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import com.genexus.db.UserInformation;
import com.genexus.internet.HttpContext;
import com.genexus.reports.GXReportMetadata;
import com.genexus.reports.IReportHandler;
import com.genexus.reports.PDFReportItext;
import com.genexus.reports.*;
import com.genexus.webpanels.GXWebProcedure;

public abstract class GXWebReport extends GXWebProcedure
Expand Down Expand Up @@ -37,20 +35,21 @@ protected void initState(ModelContext context, UserInformation ui)

httpContext.setBuffered(true);
httpContext.setBinary(true);

reportHandler = new PDFReportItext(context);

String implementation = com.genexus.Application.getClientContext().getClientPreferences().getPDF_RPT_LIBRARY();
if (implementation.equals("ITEXT"))
reportHandler = new PDFReportItext2(context);
else if (implementation.equals("ITEXT7"))
reportHandler = new PDFReportItext7(context);
else
reportHandler = new PDFReportPDFBox(context);
initValues();
}

protected void preExecute()
{
httpContext.setContentType("application/pdf");
httpContext.setStream();

// Tiene que ir despues del setStream porque sino el getOutputStream apunta
// a otro lado.
((PDFReportItext) reportHandler).setOutputStream(httpContext.getOutputStream());
((GXReportPDFCommons) reportHandler).setOutputStream(httpContext.getOutputStream());
}

protected void setOutputFileName(String outputFileName){
Expand Down
11 changes: 10 additions & 1 deletion java/src/main/java/com/genexus/GXutil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,16 @@ public static String blobFromBytes(byte[] bytesString)
gxFile.fromBytes(bytesString);
com.genexus.webpanels.BlobsCleaner.getInstance().addBlobFile(filePath);
return filePath;
}
}

public static String blobFromBytes(byte[] bytesString, String extension)
{
String filePath = Preferences.getDefaultPreferences().getBLOB_PATH() + com.genexus.PrivateUtilities.getTempFileName(extension);
com.genexus.util.GXFile gxFile = new com.genexus.util.GXFile(filePath);
gxFile.fromBytes(bytesString);
com.genexus.webpanels.BlobsCleaner.getInstance().addBlobFile(filePath);
return filePath;
}

public static java.util.UUID strToGuid(String value)
{
Expand Down
2 changes: 1 addition & 1 deletion java/src/main/java/com/genexus/GxImageUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private static String writeImage(BufferedImage croppedImage, String destinationF
} else {
outStream.flush();
byte[] imageInByte = outStream.toByteArray();
return GXutil.blobFromBytes(imageInByte);
return GXutil.blobFromBytes(imageInByte,CommonUtil.getFileType(newFileName));
}
}
}
Expand Down
144 changes: 46 additions & 98 deletions java/src/main/java/com/genexus/reports/GXReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,42 @@
import com.genexus.ModelContext;
import com.genexus.ProcessInterruptedException;

public abstract class GXReport extends GXProcedure
{
import org.apache.logging.log4j.Logger;

public abstract class GXReport extends GXProcedure {
protected static final int OUTPUT_RVIEWER = 1;
protected static final int OUTPUT_PDF = 2;

// Tiene que ser protected porque se pasa como par�metro en los reports
protected GXReportMetadata reportMetadata;
protected IReportHandler reportHandler;

protected int lineHeight;
protected int Gx_line;
protected int P_lines;
protected int gxXPage;
protected int gxYPage;
protected int Gx_page;
protected String Gx_out = ""; // Esto est� asi porque no me pude deshacer de una comparacion contra Gx_out antes del ask.
protected String Gx_out = ""; // Esto esto asi porque no me pude deshacer de una comparacion contra Gx_out antes del ask.

protected static Logger log = org.apache.logging.log4j.LogManager.getLogger(GXReport.class);

public GXReport(int remoteHandle, ModelContext context, String location)
{
super(remoteHandle, context, location);
}

public GXReport(boolean inNewUTL, int remoteHandle, ModelContext context, String location)
{
public GXReport(boolean inNewUTL, int remoteHandle, ModelContext context, String location) {
super(inNewUTL, remoteHandle, context, location);
}

public static byte openGXReport(String document)
{
if(document.toLowerCase().endsWith(".pdf"))
{ // Si es un .pdf
try
{
PDFReportItext.showReport(document, false);
}catch(Exception e)
{
System.err.println(e.toString());
public static byte openGXReport(String document) {
if(document.toLowerCase().endsWith(".pdf")) { // Si es un .pdf
try {
GXReportPDFCommons.showReport(document, false);
} catch(Exception e) {
log.error("GXReport failed to open report " + document + " : ", e);
return -1;
}
}else
{
} else {
GXReportViewerThreaded.GxOpenDoc(document);
}
return 0;
Expand Down Expand Up @@ -76,53 +71,31 @@ public IReportHandler getPrinter()
}
else if (getOutputType() == OUTPUT_PDF)
{
reportHandler = new PDFReportItext(context);

try
{
((PDFReportItext) reportHandler).setOutputStream(getOutputStream());
}
catch (Exception e)
{
try {
String implementation = com.genexus.Application.getClientContext().getClientPreferences().getPDF_RPT_LIBRARY();
if (implementation.equals("ITEXT"))
reportHandler = new PDFReportItext2(context);
else if (implementation.equals("ITEXT7"))
reportHandler = new PDFReportItext7(context);
else
reportHandler = new PDFReportPDFBox(context);
((GXReportPDFCommons) reportHandler).setOutputStream(httpContext.getOutputStream());
} catch (Exception e) {
log.error("Failed to set output stream: ", e);
}
}
else
{
else {
throw new RuntimeException("Unrecognized report type: " + getOutputType());
}
}

return reportHandler;
}
/*
public String format(String value, String picture)
{
return PictureFormatter.format(value, picture);
}

public String format(long value, String picture)
{
return localUtil.format(value, picture);
}

public String format(java.util.Date value, String picture)
{
return localUtil.format(value, picture);
}

public String format(double value, String picture)
{
return localUtil.format(value, picture);
}
*/
protected void GxEndPage() throws ProcessInterruptedException
{
protected void GxEndPage() throws ProcessInterruptedException {
if (reportHandler != null)
reportHandler.GxEndPage();
}

protected boolean initTextPrinter(String output, int gxXPage, int gxYPage, String iniFile, String form, String printer, int mode, int nPaperLength, int nPaperWidth, int nGridX, int nGridY, int nPageLines)
{
protected boolean initTextPrinter(String output, int gxXPage, int gxYPage, String iniFile, String form, String printer, int mode, int nPaperLength, int nPaperWidth, int nGridX, int nGridY, int nPageLines) {
int x[] = {gxXPage};
int y[] = {gxYPage};

Expand All @@ -135,8 +108,7 @@ protected boolean initTextPrinter(String output, int gxXPage, int gxYPage, Strin
return ret;
}

protected boolean initPrinter(String output, int gxXPage, int gxYPage, String iniFile, String form, String printer, int mode, int orientation, int pageSize, int pageLength, int pageWidth, int scale, int copies, int defSrc, int quality, int color, int duplex)
{
protected boolean initPrinter(String output, int gxXPage, int gxYPage, String iniFile, String form, String printer, int mode, int orientation, int pageSize, int pageLength, int pageWidth, int scale, int copies, int defSrc, int quality, int color, int duplex) {
int x[] = {gxXPage};
int y[] = {gxYPage};

Expand All @@ -149,83 +121,59 @@ protected boolean initPrinter(String output, int gxXPage, int gxYPage, String in
return ret;
}

protected void endPrinter()
{
try
{
protected void endPrinter() {
try {
getPrinter().GxEndPrinter();
waitPrinterEnd();
}
catch (Exception e)
{
}
} catch (Exception e) {}
}

protected void waitPrinterEnd()
{
if (reportHandler != null && Gx_out.equals("SCR") && reportHandler.getModal())
{
while (reportHandler.GxIsAlive());
}

/* IGUIContext ctx = context.getGUIContext();
if (ctx instanceof com.genexus.ui.GUIContext)
{
((com.genexus.ui.GUIContext) ctx).getWorkpanel().setFocus();
protected void waitPrinterEnd() {
if (reportHandler != null && Gx_out.equals("SCR") && reportHandler.getModal()) {
while (reportHandler.GxIsAlive());
}
*/
}

protected int getOutputType()
{
protected int getOutputType() {
return OUTPUT_RVIEWER;
}

protected java.io.OutputStream getOutputStream()
{
protected java.io.OutputStream getOutputStream() {
throw new RuntimeException("Output stream not set");
}

//M�todos para la implementaci�n de reportes din�micos

protected void loadReportMetadata(String name)
{

protected void loadReportMetadata(String name) {
reportMetadata = new GXReportMetadata(name, getPrinter());
reportMetadata.load();
}

protected int GxDrawDynamicGetPrintBlockHeight(int printBlock)
{
protected int GxDrawDynamicGetPrintBlockHeight(int printBlock) {
return reportMetadata.GxDrawGetPrintBlockHeight(printBlock);
}

protected void GxDrawDynamicText(int printBlock, int controlId, int Gx_line)
{
protected void GxDrawDynamicText(int printBlock, int controlId, int Gx_line) {
reportMetadata.GxDrawText(printBlock, controlId, Gx_line);
}

protected void GxDrawDynamicText(int printBlock, int controlId, String value, int Gx_line)
{
protected void GxDrawDynamicText(int printBlock, int controlId, String value, int Gx_line) {
reportMetadata.GxDrawText(printBlock, controlId, Gx_line, value);
}

protected void GxDrawDynamicLine(int printBlock, int controlId, int Gx_line)
{
protected void GxDrawDynamicLine(int printBlock, int controlId, int Gx_line) {
reportMetadata.GxDrawLine(printBlock, controlId, Gx_line);
}

protected void GxDrawDynamicRect(int printBlock, int controlId, int Gx_line)
{
protected void GxDrawDynamicRect(int printBlock, int controlId, int Gx_line) {
reportMetadata.GxDrawRect(printBlock, controlId, Gx_line);
}

protected void GxDrawDynamicBitMap(int printBlock, int controlId, String value, int Gx_line)
{
protected void GxDrawDynamicBitMap(int printBlock, int controlId, String value, int Gx_line) {
reportMetadata.GxDrawBitMap(printBlock, controlId, Gx_line, value, 0);
}

protected void GxDrawDynamicBitMap(int printBlock, int controlId, String value, int aspectRatio, int Gx_line)
{
protected void GxDrawDynamicBitMap(int printBlock, int controlId, String value, int aspectRatio, int Gx_line) {
reportMetadata.GxDrawBitMap(printBlock, controlId, Gx_line, value, aspectRatio);
}
}
Loading