Changes between Initial Version and Version 1 of Ticket #926, comment 5


Ignore:
Timestamp:
Jan 12, 2017, 2:27:36 PM (5 years ago)
Author:
olle
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #926, comment 5

    initial v1  
    66
    77 A. The java class/file `PdfUtil.java` in `src/net/sf/basedb/reggie/pdf/` is used to import bar code images into the PDF file. However, methods in this library class is used to produce other types of PDF documents than referral forms, e.g. result reports (this was actually the original use). When the class is modified, care must therefore be taken, not to break any functionality used by other Reggie modules.
    8  B. Tests using iText functionality to produce bar codes, revealed an unexpected difference in the width of the created bar code images compared to those produced by the Barcode4J package, when the same parameters were used, as for the latter (the new bar codes were 22.8% wider). If the new "raw" bar codes were decreased in width, the value for the bar code x-position also had to be adjusted. Values for size and placement of individual bar codes for referral forms are stored in class/file `ReferralGeneratorServlet.java` in `src/net/sf/basedb/reggie/servlet/`. Until it is clear that iText bar code functionality can be used satisfactorily for SCAN-B referral form generation, a simple correction formula is used in new public method `void addBarcode(String text, float x, float y, float width, float height, int align, float rotationDegrees)` in `PdfUtil.java`, thus allowing the old bar code size and placement values to be retained in `ReferralGeneratorServlet.java`. If it is decided to use iText functionality for bar code generation, the correction might be removed and the values in `ReferralGeneratorServlet.java` updated.
     8 B. Tests using iText functionality to produce bar codes, revealed an unexpected difference in the width of the created bar code images compared to those produced by the Barcode4J package, when the same parameters were used (the new bar codes were 22.8% wider). If the new "raw" bar codes were decreased in width, the value for the bar code x-position also had to be adjusted. Values for size and placement of individual bar codes for referral forms are stored in class/file `ReferralGeneratorServlet.java` in `src/net/sf/basedb/reggie/servlet/`, and these parameters therefore have to be updated.
    99
    1010Design update:
    1111
    12  1. Java servlet class/file `ReferralGeneratorServlet.java` in `src/net/sf/basedb/reggie/servlet/` updated:[[BR]]a.
    13 
     12 1. Java utility class/file `PdfUtil.java` in `src/net/sf/basedb/reggie/pdf/` updated:[[BR]]a. New private method `Image createBarcode(String text, float width, float height)` added. It creates a barcode with chosen content, width, and height, and returns an Image object of it. The barcode will be of type Code 128.[[BR]]b. New public method `void addBarcode(String text, float x, float y, float width, float height, int align)` added. It calls new public method `void addBarcode(String text, float x, float y, float width, float height, int align, float rotationDegrees)` with value of `rotationDegrees` set to `0`.[[BR]]c. New public method `void addBarcode(String text, float x, float y, float width, float height, int align, float rotationDegrees)` added. It calls new private method `Image createBarcode(String text, float width, float height)` to create a barcode with the desired content and size, after which new private method `void importImage2(Image img, float x, float y, float width, float height, int align, float rotationDegrees)` is called to import the barcode to the document at the chosen position.[[BR]]d. Public method `void importImage2(byte[] imageByteArray, float x, float y, float width, float height, int align, float rotationDegrees)` updated to call new public method `void importImage2(Image img, float x, float y, float width, float height, int align, float rotationDegrees)` to import the image created from the input byte array into the document at the chosen position.[[BR]]e. New public method `void importImage2(Image img, float x, float y, float width, float height, int align)` added. It calls new public method `void importImage2(Image img, float x, float y, float width, float height, int align, float rotationDegrees)` with value of `rotationDegrees` set to `0`.[[BR]]f. New public method `void importImage2(Image img, float x, float y, float width, float height, int align, float rotationDegrees)` added. It uses code previously in public method `void importImage2(byte[] imageByteArray, float x, float y, float width, float height, int align, float rotationDegrees)` to import the input image into the document at the chosen position.
     13 2. Java servlet class/file `ReferralGeneratorServlet.java` in `src/net/sf/basedb/reggie/servlet/` updated:[[BR]]a. The following private methods were updated by calling new public `PdfUtil` methods `void addBarcode(String text, float x, float y, float width, float height, int align)` and `void addBarcode(String text, float x, float y, float width, float height, int align, float rotationDegrees)` to add a barcode to the document, instead of calling private method `byte[] createBarcode(String barcodeText)` to create a barcode image byte array, and then use that as input in a call to `PdfUtil` public methods `void importImage2(byte[] imageByteArray, float x, float y, float width, float height, int align)` and `void importImage2(byte[] imageByteArray, float x, float y, float width, float height, int align, float rotationDegrees)` to import the barcode into the document at the desired position:[[BR]]i. `PdfUtil createConsentReportForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList)`,[[BR]]ii. `PdfUtil createClinChemForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList)`,[[BR]]iii. `PdfUtil createClinPathologyForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList)`,[[BR]]iv. `PdfUtil createClinChemBloodForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList)`,[[BR]]v. `PdfUtil createClinChemBcBloodForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String scanbId, List<String> formTemplateFileList)`.[[BR]]Barcode width and position parameters have also been updated to give a result equaling that using the Barcode4J library to create the barcodes.[[BR]]b. The following private methods related to creating barcodes with the Barcode4J library were removed:[[BR]]i. `byte[] createBarcode(String barcodeText)`,[[BR]]ii. `byte[] createBarcode(String barcodeText, String barcodeType, Integer dpi, Boolean humanReadable, String textPlacement, String fontName, Integer fontSize)`,[[BR]]iii. `static Configuration buildBarcodeCfg(String type, Boolean humanReadable, String textPlacement, String fontName, Integer fontSize)`.