Java native pdf writer
A sample java program for interaction of java with native language such as C/C++ to create a pdf file.
PdfWriter.h
file with the native method declarations in it.
javac -h . Main.java
Use the header files and shared library from PDFWriter project to define the methods in PdfWriter.h
header files.
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
libpdf.so
to library path.
java Main