|
@@ -18,15 +18,25 @@
|
|
|
#include "Trace.h"
|
|
|
|
|
|
int main(){
|
|
|
+ printf("if running on Windows check here for file(s): %%AppData%%\\Local\\VirtualStore\n");
|
|
|
PDFWriter pdfWriter;
|
|
|
// PREPARE PDF DOCUMENT
|
|
|
// ********************
|
|
|
- // set path to output directory for new pdf
|
|
|
- EStatusCode e = pdfWriter.StartPDF(".\\myFile.pdf",ePDFVersion13,LogConfiguration(true,true,".\\logMe"));
|
|
|
- TRACE_LOG("ooogaBooga");
|
|
|
- if (e){
|
|
|
- printf ("something interesting");
|
|
|
+ // get a PDFWriter object to interact with. set the PDF version, set log file
|
|
|
+ EStatusCode e = pdfWriter.StartPDF("c:\\myFile.pdf",ePDFVersion13,LogConfiguration(true,true,".\\logMe"));
|
|
|
+ if (e){
|
|
|
+ /* 25APR20 - look through codebase and found these three reasons for nonrecoverable failure:
|
|
|
+ * - user requested encryption, document doesn't support it
|
|
|
+ * - it is unlikely, but for some reason GK wanted to call OutputFile::CloseFile(), it failed
|
|
|
+ * - operating system was unsuccessful at giving a lock for the filename *
|
|
|
+ *
|
|
|
+ * * Windows 'gives' a lock, but doesn't protect others from writing to this filename
|
|
|
+ */
|
|
|
+ printf("Terminating (c:\\myFile.pdf): unsuccessful lock or couldn't close existing or requested encryption but not supported\n");
|
|
|
+ TRACE_LOG("Terminating (c:\\myFile.pdf): unsuccessful lock or couldn't close existing or requested encryption but not supported");
|
|
|
+ exit(1);
|
|
|
}
|
|
|
+ TRACE_LOG("Notified OS we might use c:\\myFile.pdf");
|
|
|
PDFPage* pdfPage = new PDFPage();
|
|
|
// set dimensions for an A4 sized page
|
|
|
pdfPage->SetMediaBox(PDFRectangle(0,0,595,842));
|
|
@@ -36,7 +46,7 @@ int main(){
|
|
|
// ADD CONTENT
|
|
|
// ********************
|
|
|
// set font color to black
|
|
|
- pageContentContext->k(0,0,0,1);
|
|
|
+ /*pageContentContext->k(0,0,0,1);
|
|
|
// set text object
|
|
|
pageContentContext->BT();
|
|
|
// set font
|
|
@@ -46,13 +56,13 @@ int main(){
|
|
|
// insert text into PDF
|
|
|
pageContentContext->Tj("Text placed and scaled with Tm");
|
|
|
// end of text
|
|
|
- pageContentContext->ET();
|
|
|
+ pageContentContext->ET();*/
|
|
|
PDFFormXObject* image = pdfWriter.CreateFormXObjectFromJPGFile("C:\\Users\\bad-p\\Desktop\\Work Folder\\VS CODE\\SanAntonioPass.jpg");
|
|
|
if (!image){
|
|
|
printf ("hiiii");
|
|
|
}
|
|
|
pageContentContext->q();
|
|
|
- pageContentContext->cm(0.25,0,0,0.25,86,125);
|
|
|
+ pageContentContext->cm(1,0,0,1,0,0);
|
|
|
//pageContentContext->cm(0.4,0,0,0.4,57.5,241);
|
|
|
pageContentContext->Do(pdfPage->GetResourcesDictionary().AddFormXObjectMapping(image->GetObjectID()));
|
|
|
pageContentContext->Q();
|