2017-09-21 26 views
2

연속 텍스트를 줄 바꾸기 위해 itext sharp에 코드를 추가했습니다. 여기에 예를 들어 URL이 있습니다. 이 CSS는 웹 브라우저에서 작업 할 때 제대로 작동하지만 pdf로 내보낼 때 URL은 감싸지 않습니다.Itext에서 연속 텍스트 줄 바꾸기

정확한 문제는 무엇인지 알 수 없습니다. 온라인 및 PDF보기 참조 행동

이미지 :

Image for reference behavior of the online and pdf view

는 CSS를

.background-color-dark-blue { 
 
    background-color: #485679; 
 
} 
 
.color-light { 
 
    color: #fff !important; 
 
} 
 

 

 
.white-space-pre-wrap a { 
 
    word-break: break-all !important; 
 
    word-wrap: break-word; 
 
    word-wrap: break-word !important; 
 
    
 
} 
 
.break-all { 
 
    word-break: break-all; 
 
    word-wrap: break-word; 
 
} 
 

 
.url-style a { 
 
    /*font-size: 14px;*/ 
 
    line-height: 1.3; 
 
    color: #2a99d4; 
 
    font-weight: 700; 
 
    text-decoration: none; 
 
    margin-top: 0px !important; 
 
}
<table> 
 
               <colgroup> 
 
                <col class="col-3"> 
 
                <col class="col-4"> 
 
                <col class="col-5"> 
 
               </colgroup> 
 
               <thead> 
 
                <tr class="background-color-dark-blue "> 
 
                 <th class="color-light"> 
 
                  Document Name</th> 
 
                 <th class="color-light"> 
 
                  Document Description</th> 
 
                 <th class="color-light"> 
 
                  Location/Link</th> 
 
                </tr> 
 
               </thead> 
 
               <tbody> 
 
                
 
             <tr class="bg-color-lighter"> 
 
              <td class="va-top">FATF 40 Recommendations</td> 
 
              <td class="va-top">Global standard for AML/CFT published by the Financial Action Task Force </td> 
 
              <td class="review-report-url-fix padding-left-5 break-all va-top"> 
 
               <div class="break-all va-top"> 
 
               <a id="SiteContentPlaceHolder_AppendicesReviewControl_ReferenceDocumentListView_ReferenceDocumentLink_0" title="http://www.fatf-gafi.org/publications/fatfrecommendations/ 
 
http://www.fatf-gafi.org/publications/fatfrecommendations/documents/risk-based-approach-banking-sector.html" class="url-style white-space-pre-wrap" href="http://www.fatf-gafi.org/publications/fatfrecommendations/%0d%0a%20http://www.fatf-gafi.org/publications/fatfrecommendations/documents/risk-based-approach-banking-sector.html" target="_blank">http://www.fatf-gafi.org/publications/fatfrecommendations/ 
 
http://www.fatf-gafi.org/publications/fatfrecommendations/documents/risk-based-approach-banking-sector.html</a> 
 
                </div> 
 
               
 
              </td> 
 

 
             </tr> 
 
            
 
             <tr class="bg-color-dashboard-table"> 
 
              <td class="va-top">Risk Based Approach Guidance for Legal Professionals</td> 
 
              <td class="va-top">Guidance on the AML/CFT Risk Based Approach for lawyers and the legal profession</td> 
 
              <td class="review-report-url-fix padding-left-5 va-top"> 
 
               <div class="break-all va-top"> 
 
               <a id="SiteContentPlaceHolder_AppendicesReviewControl_ReferenceDocumentListView_ReferenceDocumentLink_1" title="http://www.fatf-gafi.org/publications/fatfrecommendations/documents/riskbasedapproachguidanceforlegalprofessionals.html" class="url-style white-space-pre-wrap" href="http://www.fatf-gafi.org/publications/fatfrecommendations/documents/riskbasedapproachguidanceforlegalprofessionals.html" target="_blank">http://www.fatf-gafi.org/publications/fatfrecommendations/documents/riskbasedapproachguidanceforlegalprofessionals.html</a> 
 
                </div> 
 
               
 
              </td> 
 

 
             </tr>         
 
            
 
               </tbody> 
 
              </table>

+0

라이브러리 함수는 그냥 확인하십시오? 5.5.x와'XmlWorker' 또는 7.0.x와'HtmlConverter'? – mkl

+0

방금 ​​iText 지원 시스템에서 최근 티켓의 세부 사항을 살펴 보았습니다. 귀하는이를보고 한 동일한 고객입니다. 이 문제를 담당하는 제 동료가 JIRA를 통해 해결책을 줄 것이며 Stack Overflow에 대한 해결책을 게시하지 않을 것입니다. 그러나 일단 스택 오버플로가 발생하면 해당 솔루션을 복사 할 수 있습니다. –

+0

Itext 버전 7.0을 사용하고 있습니다. –

답변

0

iText를 버전 7.0로 URL을 포장하는 방법은 없나요 inbuild 라이브러리 함수가 있습니다.

SetSplitCharacters (ISplitCharacters splitCharacters);

그래서 iText를 7

public string SplitChars { get; set; } = ".+-/"; 
var document = new Document(pdf, PageSize.LETTER, false) 
document.SetSplitCharacters(new CustomSplitCharacters(SplitChars)); 

은 이제 연속 URL을에 모든 휴식 것이다 코드를 사용 문자를 분할 할 수 + -. /이 테이블 셀

Reffer URL의 끝에있을 때 당신이 사용합니까 어떤 iText를 버전 :

http://itextsupport.com/apidocs/itext7/7.0.4/com/itextpdf/layout/ElementPropertyContainer.html