Непрерывный текст в области текста обрезает PDF, переполненный текстом - PullRequest
6 голосов
/ 31 мая 2019

Я вижу, что есть много вопросов, связанных с одним и тем же сценарием, этот немного отличается, не может найти решение.У меня есть в таблице в ячейке.Когда я даю непрерывный текст типа «ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc», он переполняет текст, когда я загружаю файл печати, и его нормальный, когда я даю нормальный текст с breaks * *. Это мой код * 100 * 100

.generaltable {
	background-color : #5C7FBF;
	border:thin;
	width : 100%;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	}
  
  
	.column {
	background-color : #DEEDFF;
	font-weight : bold;
	padding-bottom : 1px;
	padding-left : 1px;
	padding-right : 1px;
	padding-top : 1px;
	text-align : center;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	border: none;
	}
  
 .edit {
	background-color : #DEEDFF;
	border-width: 1px;
	border-style:solid;
	border-color:#DEEDFF;
	border: 1px solid #DEEDFF;
	color: black;
	text-align : left;
	font-weight : bold;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	word-break: break-all;
	}
  
  .iedit2 {
	background-color : white;
	text-align: left;
	color: black;
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
	border-top: 1px solid #999999;
	border-right: 1px solid #333333;
	border-bottom: 1px solid #333333;
	border-left: 1px solid #999999;
	word-break: break-all;
	}
  
  
  
  
  
<table border="1" width="100%" align="center" cellpadding="2" cellspacing="1"  class="generaltable">  <tbody><tr id="Row35494#0">
    <th id="04" class="column" width="39%"><a href="javascript:alert('Self Explanatory')">Brief                 description of the issue *</a></th>
        <td id="1 04" width="39%" class="edit">
            <textarea id="269494_0" class="iedit2" cols="35" rows="5" wrap="virtual" maxlength="4000"                   name="fiy">ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
             </textarea>
        </td>
      </tr>
  </tbody>
 </table>

, пожалуйста, найдите фотографии для ясного обзора This is the entry

У меня есть щелчок как Go, как только я это сделаюЕсли он загружает весь документ здесь, используя код JAVA, то здесь фрагмент неработающего кода

This is the pdf

Это код Java:

 if (cmd != null && cmd.equals("Go") && (printType.equals("5181") || printType.equals("3") || printType.equals("4"))) {
        request.setAttribute("print", printType);
        StatusBean statusBean = null;
        long sysRptRecptId = new Long((String) request.getParameter("RECPTID"));
        ServletOutputStream out = response.getOutputStream();
        response.setContentType("application/pdf");
        String filename = reportSelectionObj.getFormShortTitle() + "_" + reportSelectionObj.getReportingPeriod() + ".pdf";

        response.setHeader("Pragma", "public");
        response.setHeader("Cache-Control", "max-age=0");
        response.setHeader("Content-disposition", "attachment; filename=\"" + filename+"\"");
        boolean isGrantor = reportSelectionObj.isROCO();
        RptStatusImpl client = new RptStatusImpl();
        //log.debug("calling the PDF service internally");
        BufferedInputStream bis = null;
        BufferedOutputStream bos = null;
        try {
            FormUtils formUtils = new FormUtils();
            DataHandler dh = null;
            if (printType.equals("5181")) {
                dh = client.getReportPdfContentWithReportId(sysRptRecptId, isGrantor);
            } else if (printType.equals("3")) {
                dh = getPDFReportErrorsWarningsService().getReportPdfErrorsWarningsWithReportId(sysRptRecptId);
            } else if (printType.equals("4")) {
                List<RptAttachments> rptAttachments = getAttachmentService().getListOfAttachments(sysRptRecptId, 0l, false/*, null*/);
                for (RptAttachments rptAttachment : rptAttachments) {
                    if (rptAttachment.getAttachmentType() == 6063) {
                        //TODO - need downloadDocument rest service to continue
                    }
                    log.debug(rptAttachment.getFileName());
                }
            }
            bos = new BufferedOutputStream(out);
            bis = new BufferedInputStream(dh.getInputStream());
            byte[] buff = new byte[2048];
            int bytesRead;
            // Simple read/write loop.
            while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
                bos.write(buff, 0, bytesRead);
            }
            statusBean = new StatusBean();
            statusBean.setReportId(new Long(sysRptRecptId).toString());
            formUtils.insertOLDCRecordIntoWsActionLog(statusBean, "Retrieve PDF of Form", user);
        } catch (final IOException e) {
            log.debug("IOException in PDF Print.");
        } catch (Exception ex) {
            log.debug("Exception in Print PDF.");
        } finally {
            if (bis != null) {
                bis.close();
            }
            if (bos != null) {
                bos.close();
            }
        }

        return mapping.findForward("");

1 Ответ

1 голос
/ 03 июня 2019

Вы можете определить, когда текст достигает новой строки в поле ввода, и вставить '\ n', чтобы принудительно разрывать строки, чтобы при загрузке изображения оно было жестко запрограммировано на разрыв строки.Надеюсь, это поможет!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...