돈 안 들이고 PDF 파일 만들기 5장 : 용지 크기 설정하기

세벌의 이미지

돈 안 들이고 PDF 파일 만들기 5장 : 용지 크기 설정하기

http://kldp.org/node/115153 까지의 내용을 따라 하시다 보면

fop -c cfg.xml 어쩌구 저쩌구

실행할 때 아래와 같이 기본 용지 크기 설정이 나옵니다. 그런데 우리가 자주 쓰는 A4 크기가 아니네요.

2010. 5. 27 오전 7:16:43 org.apache.fop.apps.FopFactoryConfigurator configure
정보: Default page-height set to: 11in
2010. 5. 27 오전 7:16:43 org.apache.fop.apps.FopFactoryConfigurator configure
정보: Default page-width set to: 8.26in

이번엔 우리가 자주쓰는 A4 크기로 설정을 바꾸어 보겠습니다.
cfg.xml 파일에서 default-page-settings 를 아래와 같이 바꾸면 됩니다.

<default-page-settings height="297mm" width="210mm"/>

그 다음에

fop -c cfg.xml 어쩌구 저쩌구

실행하면 아래와 같이 기본 값이 바뀐 것을 보실 수 있습니다.

2010. 5. 27 오전 7:21:11 org.apache.fop.apps.FopFactoryConfigurator configure
정보: Default page-height set to: 297mm
2010. 5. 27 오전 7:21:11 org.apache.fop.apps.FopFactoryConfigurator configure
정보: Default page-width set to: 210mm

그런데, A4 용지를 자주 쓰다가 어쩌다가 다른 규격의 용지 쓸 일 생겼다면?
cfg.xml을 수정하고 fop를 이용해서 pdf 생성하고, 다시 원래의 cfg.xml로 바꾼다? 이건 좀 귀찮은 방법이 되겠네요.
이럴 때는 cfg.xml은 그대로 두고 FO 파일에 용지 크기를 설정해 주는 방법이 있습니다.
아래와 같이 simple-page-master 부분을 수정하면 됩니다.

	<fo:layout-master-set>
		<fo:simple-page-master master-name="my-page" page-width="257mm" page-height="257mm" >
			<fo:region-body margin="1cm"/>
		</fo:simple-page-master>
	</fo:layout-master-set>

이와 같이 .fo 파일을 바꾸어도 fop 실행시킬 때 나타나는 메시지는 cfg.xml 파일의 설정대로 나타납니다만, 만들어지는 pdf 파일 규격은 .fo 파일에 설정한 대로 됩니다.

Forums: 

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.