Skip to content

sk02241994/nativeInterfacePdfWriter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java native interface pdf writer.

A sample java program for interaction of java with native language such as C/C++ to create a pdf file.

How to build and execute?

  1. Run the following command to create header PdfWriter.h file with the native method declarations in it.
    javac -h . Main.java
  1. Use the header files and shared library from PDFWriter project to define the methods in PdfWriter.h header files.

  2. Run the following command to create a shared library to be used for java native interface

g++ -shared PdfWriter.cpp -I {Path to PDFWriter includes} -L {Path to PDFWriter shared library} -l pdfwriter -I JAVA_HOME/java-14-openjdk-amd64/include -I JAVA_HOME/java-14-openjdk-amd64/include/linux -o libpdf.so -fPIC
  1. Add the library generated libpdf.so to library path.
  2. Running the java file
java Main