2014-10-16 1 views
1

XSL-Fo에서 이미지의 올바른 경로를 설정했지만 이미지를 검색 할 수 없습니다.이미지를 찾을 수 없음 - XSL-FO

<fo:external-graphic src="../graphics/bullet.png" content-height="0.5cm" /> 

이 오류가 발생할 때마다이 오류가 발생하고 Windows의 명령 프롬프트를 통해 파일이 처리되었습니다.

org.apache.fop.events.LoggingEventListener processEvent 
SEVERE: Image not found. URI: bullet.png. (See position 26:80) 
org.apache.fop.events.LoggingEventListener processEvent              
SEVERE: Image not found. URI: bullet.png. (No context info available) 
org.apache.fop.events.LoggingEventListener processEvent                     

원본 경로는 APACHE의 FOP 이미지 예제에서 제공 한 정확한 형식입니다. 심지어 외부 그래픽을 렌더링 할 때 "image.fo"파일을 실행했지만 위의 오류 (다른 이미지 파일 사용)가 발생했습니다.

대체 솔루션이 있습니까?

답변

3

상대 URI는 기본 URI (https://xmlgraphics.apache.org/fop/fo.html#external-resources)를 기준으로합니다.

FOP 구성에서 기본 URI를 설정하지 않으면 기본 URI가 현재 디렉토리 (https://xmlgraphics.apache.org/fop/1.1/configuration.html)입니다.

FOP를 실행중인 디렉토리에 상대적인 이미지 파일은 어디에 있습니까?

<fo:external-graphic src="examples/fo/graphics/bullet.png" content-height="0.5cm" /> 

을 : 당신이 사용하는 경우


그것은 작동합니까?

+0

내 이미지 파일에 대한 상대 경로 : "examples \ fo \ graphics". – maudff

+0

XML-FO는 여전히 해당 경로를 사용하여 이미지를 검색 할 수 없습니다. – maudff

+0

그런 다음 먼저 절대 경로 인'file : /// C : /.../examples/ fo/graphics/bullet.png'을 입력하면 FOP가 파일을 찾을 위치를 선택할 수 없습니다. 둘째,'-x' 또는'-d' (https://xmlgraphics.apache.org/fop/trunk/running.html)로 실행 해보고 어느 것이 FOP가 실행 중인지를 알 수있는 충분한 정보를 제공하는지 확인하십시오. –

1

내 외장 그래픽 태그는 다음과 같이 보았다 :

<fo:external-graphic content-height="15.73mm" src="url('logo.png')"/> 

와 나는 XSL 파일과 같은 디렉토리에 logo.png 파일을 넣어했다. 이다

, 내 FOP 명령은 다음과 같이 보았다 :

$TOOLS/fop-2.0/fop -d -x -xml xmlfiles/xmlfile.xml -xsl xslfiles/xslfile.xsl -pdf pdffiles/pdffile.pdf 

와 나는 xmlfiles 디렉토리에 .PNG 파일을 넣어했다.

허용 된 대답에 URI가 "현재 디렉토리"라고되어 있기 때문에이를 가져오고 있습니다.