-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a test for building massive files (#142)
* Added a test for building massive files Not automated yet, just the code
- Loading branch information
1 parent
6d0359c
commit 7cf4e88
Showing
2 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "pdfgen.h" | ||
#include <stdlib.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
struct pdf_doc *pdf = pdf_create(PDF_A4_WIDTH, PDF_A4_HEIGHT, NULL); | ||
int pagecount = 10; | ||
char filename[128]; | ||
|
||
if (argc > 1) { | ||
pagecount = atoi(argv[1]); | ||
} | ||
pdf_set_font(pdf, "Times-Roman"); | ||
for (int i = 0; i < pagecount; i++) { | ||
char str[64]; | ||
pdf_append_page(pdf); | ||
sprintf(str, "page %d", i); | ||
pdf_add_text(pdf, NULL, str, 12, 50, 20, PDF_BLACK); | ||
|
||
pdf_add_image_file(pdf, NULL, 100, 500, 50, 150, "data/penguin.jpg"); | ||
} | ||
|
||
sprintf(filename, "massive-%d.pdf", pagecount); | ||
pdf_save(pdf, filename); | ||
pdf_destroy(pdf); | ||
return 0; | ||
} |