Merge pull request #428 from PartialVolume/PDFGen2

Further updates to the PDF Erasure Report code
This commit is contained in:
PartialVolume
2023-02-14 01:54:11 +00:00
committed by GitHub
7 changed files with 57 additions and 5 deletions

View File

@@ -6,5 +6,5 @@ AM_LDFLAGS =
# this lists the binaries to produce, the (non-PHONY, binary) targets in
# the previous manual Makefile
bin_PROGRAMS = nwipe
nwipe_SOURCES = context.h logging.h options.h prng.h version.h temperature.h nwipe.c gui.c method.h pass.c device.c gui.h isaac_rand/isaac_standard.h isaac_rand/isaac_rand.h isaac_rand/isaac_rand.c isaac_rand/isaac64.h isaac_rand/isaac64.c mt19937ar-cok/mt19937ar-cok.c nwipe.h mt19937ar-cok/mt19937ar-cok.h pass.h device.h logging.c method.c options.c prng.c version.c temperature.c PDFGen/pdfgen.h PDFGen/pdfgen.c create_pdf.c create_pdf.h
nwipe_SOURCES = context.h logging.h options.h prng.h version.h temperature.h nwipe.c gui.c method.h pass.c device.c gui.h isaac_rand/isaac_standard.h isaac_rand/isaac_rand.h isaac_rand/isaac_rand.c isaac_rand/isaac64.h isaac_rand/isaac64.c mt19937ar-cok/mt19937ar-cok.c nwipe.h mt19937ar-cok/mt19937ar-cok.h pass.h device.h logging.c method.c options.c prng.c version.c temperature.c PDFGen/pdfgen.h PDFGen/pdfgen.c create_pdf.c create_pdf.h embedded_images/shred_db.jpg.c embedded_images/shred_db.jpg.h embedded_images/tick_erased.jpg.c embedded_images/tick_erased.jpg.h
nwipe_LDADD = $(PARTED_LIBS)

View File

@@ -19,11 +19,16 @@
*/
#include "create_pdf.h"
#include "PDFGen/pdfgen.h"
#include "version.h"
#include <string.h>
#include "src/embedded_images/shred_db.jpg.h"
#include "src/embedded_images/tick_erased.jpg.h"
//#include "logging.h"
char pdf_footer[] = "Disc Erasure by NWIPE version 0.34";
int create_pdf( void )
{
char pdf_footer[MAX_PDF_FOOTER_TEXT_LENGTH];
struct pdf_info info = { .creator = "https://github.com/PartialVolume/shredos.x86_64",
.producer = "https://github.com/martijnvanbrummelen/nwipe",
.title = "PDF Disk Erasure Certificate",
@@ -32,15 +37,20 @@ int create_pdf( void )
.date = "Today" };
// nwipe_log( NWIPE_LOG_INFO, "Create the PDF erasure certificate" );
struct pdf_doc* pdf = pdf_create( PDF_A4_WIDTH, PDF_A4_HEIGHT, &info );
pdf_set_font( pdf, "Times-Roman" );
/* Create footer text string and append the version */
strcpy( pdf_footer, "Disc Erasure by NWIPE version" );
strcat( pdf_footer, version_string );
pdf_set_font( pdf, "Helvetica" );
pdf_append_page( pdf );
/* Create header and footer*/
pdf_add_text( pdf, NULL, pdf_footer, 12, 200, 30, PDF_BLACK );
pdf_add_line( pdf, NULL, 50, 50, 550, 50, 3, PDF_BLACK );
pdf_add_line( pdf, NULL, 50, 650, 550, 650, 3, PDF_BLACK );
pdf_add_image_file( pdf, NULL, 45, 670, 128, 128, "shred_db.jpg" );
pdf_add_image_file( pdf, NULL, 430, 670, 128, 128, "tick_erased.jpg" );
pdf_add_image_data( pdf, NULL, 45, 670, 128, 128, bin2c_shred_db_jpg, 27063 );
pdf_add_image_data( pdf, NULL, 430, 670, 128, 128, bin2c_te_jpg, 54896 );
pdf_add_text( pdf, NULL, "Model:Hitachi HDS72105", 14, 215, 720, PDF_BLACK );
pdf_add_text( pdf, NULL, "S/N:MSK4215T145K8G", 14, 212, 700, PDF_BLACK );
pdf_add_text( pdf, NULL, "Disk Erasure Report", 24, 195, 670, PDF_BLACK );

View File

@@ -21,6 +21,8 @@
#ifndef CREATE_PDF_H_
#define CREATE_PDF_H_
#define MAX_PDF_FOOTER_TEXT_LENGTH 50
int create_pdf( void );
#endif /* CREATE_PDF_H_ */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,16 @@
/* Autogenerated by hxtools bin2c */
#ifndef SHRED_DB_JPG_H
#define SHRED_DB_JPG_H 1
#ifdef __cplusplus
extern "C" {
#endif
extern const unsigned char bin2c_shred_db_jpg[27063];
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* SHRED_DB_JPG_H */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,16 @@
/* Autogenerated by hxtools bin2c */
#ifndef TICK_ERASED_JPG_H
#define TICK_ERASED_JPG_H 1
#ifdef __cplusplus
extern "C" {
#endif
extern const unsigned char bin2c_te_jpg[54896];
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* TICK_ERASED_JPG_H */