본문 바로가기

아빠별/.Net

.Net으로 PDF를 만들자(FOP) - 2편

반응형

오늘은 FOP Class 들을 IKVM을 이용하여 DLL로 만들어 보자.
먼저 ikvm, FOP를 download 했다면 적당한 위치에 압축을 풀자.

사용자 삽입 이미지




















IKVM 디렉토리를 살펴보면 bin 디렉토리에 실행 파일과 DLL들을 볼 수 있다.
여기서 실제로 우리가 사용해야 되는 것은 ikvmc.exe(컴파일러)와 IKVM.OpenJDK.ClassLibrary.dll(.Net 프로그램에서 참조)이다.

다음 FOP 디렉토리를 보면 Lib 디렉토리에 아래와 같은 jar 파일을 볼 수 있다.
avalon-framework-4.2.0.jar
batik-all-1.6.jar
commons-io-1.3.1.jar
commons-logging-1.0.4.jar
serializer-2.7.0.jar
xalan-2.7.0.jar
xercesImpl-2.7.1.jar
xml-apis-1.3.02.jar
xmlgraphics-commons-1.2.jar

또한 build 디렉토리에 보면 fop.jar 파일을 볼 수 있다.

자 그럼 ikvmc를 이용해서 dll로 변환해 보자. 사용법은 아래와 같다

usage: ikvmc [-options] <classOrJar1> ... <classOrJarN>

options:
    @<filename>                Read more options from file
    -out:<outputfile>          Specify the output filename
    -assembly:<name>           Specify assembly name
    -target:exe                Build a console executable
    -target:winexe             Build a windows executable
    -target:library            Build a library
    -target:module             Build a module for use by the linker
    -keyfile:<keyfilename>     Use keyfile to sign the assembly
    -key:<keycontainer>        Use keycontainer to sign the assembly
    -version:<M.m.b.r>         Assembly version
    -fileversion:<version>     File version
    -main:<class>              Specify the class containing the main method
    -reference:<filespec>      Reference an assembly (short form -r:<filespec>
    -recurse:<filespec>        Recurse directory and include matching files
    -nojni                     Do not generate JNI stub for native methods
    -resource:<name>=<path>    Include file as Java resource
    -externalresource:<name>=<path>  Reference file as Java resource
    -exclude:<filename>        A file containing a list of classes to exclude
    -debug                     Generate debug info for the output file
                               (Note that this also causes the compiler to
                               generated somewhat less efficient CIL code.)
    -srcpath:<path>            Prepend path and package name to source file
    -apartment:sta             (default) Apply STAThreadAttribute to main
    -apartment:mta             Apply MTAThreadAttribute to main
    -apartment:none            Don't apply STAThreadAttribute to main
    -noglobbing                Don't glob the arguments
    -D<name>=<value>           Set system property (at runtime)
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                               Set system property to enable assertions
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                               Set system property to disable assertions
    -removeassertions          Remove all assert statements
    -nostacktraceinfo          Don't create metadata to emit rich stack traces
    -opt:fields                Remove unused private fields
    -Xtrace:<string>           Displays all tracepoints with the given name
    -Xmethodtrace:<string>     Build tracing into the specified output methods
    -compressresources         Compress resources
    -strictfinalfieldsemantics Don't allow final fields to be modified outside
                               of initializer methods
    -privatepackage:<prefix>   Mark all classes with a package name starting
                               with <prefix> as internal to the assembly
    -nowarn:<warning[:key]>    Suppress specified warnings
    -warnaserror:<warning[:key]>  Treat specified warnings as errors
    -time                      Display timing statistics
    -classloader:<class>       Set custom class loader class for assembly


먼저 FOP Lib 디렉토리의 jar 파일들을 먼저 dll 로 변환한다.
C:\PDF>c:\pdf\ikvm\bin\ikvmc.exe -target:library c:\pdf\fop-0.94\lib\avalon-framework-4.2.0.jar

.......

C:\PDF>c:\pdf\ikvm\bin\ikvmc.exe -target:library c:\pdf\fop-0.94\lib\xmlgraphics-commons-1.2.jar

다음 만들어진 lib dll들을 이용하여, 우리가 원하는 fop.dll을 만들어 보자.
(타이핑의 압박... ㅠㅠ)
C:\PDF>c:\pdf\ikvm\bin\ikvmc.exe -target:library -r:avalon-framework-4.2.0.dll -r:batik-all-1.6.dll -r:commons-io-1.3.1.dll -r:commons-logging-1.0.4.dll -r:serializer-2.7.0.dll -r:xalan-2.7.0.dll -r:xercesImpl-2.7.1.dll -r:xml-apis-1.3.02.dll -r:xmlgraphics-commons-1.2.dll c:\pdf\fop-0.94\build\fop.jar

다음 시간엔 오늘 만들어진 파일을 가지고서 PDF를 만들어 보자.

그럼 다음 시간에..

반응형