|
@@ -43,18 +43,11 @@ int main(){
|
|
PageContentContext* pageContentContext = pdfWriter.StartPageContentContext(pdfPage);
|
|
PageContentContext* pageContentContext = pdfWriter.StartPageContentContext(pdfPage);
|
|
// include font file
|
|
// include font file
|
|
PDFUsedFont* arialTTF = pdfWriter.GetFontForFile("C:\\Windows\\Fonts\\arial.ttf");
|
|
PDFUsedFont* arialTTF = pdfWriter.GetFontForFile("C:\\Windows\\Fonts\\arial.ttf");
|
|
|
|
+ // include image file
|
|
|
|
+
|
|
// ADD CONTENT
|
|
// ADD CONTENT
|
|
// ********************
|
|
// ********************
|
|
- PDFFormXObject* image = pdfWriter.CreateFormXObjectFromJPGFile("C:\\Users\\bad-p\\Desktop\\Work Folder\\VS CODE\\SanAntonioPass.jpg");
|
|
|
|
- if (!image){
|
|
|
|
- printf ("hiiii");
|
|
|
|
- }
|
|
|
|
- pageContentContext->q();
|
|
|
|
- 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();
|
|
|
|
- delete image;
|
|
|
|
|
|
+
|
|
// set font color to black
|
|
// set font color to black
|
|
pageContentContext->k(0,0,0,1);
|
|
pageContentContext->k(0,0,0,1);
|
|
// set text object
|
|
// set text object
|
|
@@ -67,13 +60,35 @@ int main(){
|
|
pageContentContext->Tj("Text placed and scaled with Tm");
|
|
pageContentContext->Tj("Text placed and scaled with Tm");
|
|
// end of text
|
|
// end of text
|
|
pageContentContext->ET();
|
|
pageContentContext->ET();
|
|
|
|
+ pdfWriter.EndPageContentContext(pageContentContext);
|
|
|
|
+ pdfWriter.WritePageAndRelease(pdfPage);
|
|
|
|
+ // ****************Shutdown Usage************
|
|
|
|
+ // ******************************************
|
|
|
|
+ // ******************************************
|
|
|
|
+ pdfWriter.Shutdown("c:\\myFile.pdf.shutdown");
|
|
|
|
+ PDFWriter pdfWriterB;
|
|
|
|
+ pdfWriterB.ContinuePDF("c:\\myFile.pdf","myFile.pdf.shutdown","",LogConfiguration(true,true,".\\logMe"));
|
|
|
|
+ PDFPage* pdfPageB = new PDFPage();
|
|
|
|
+ // set dimensions for an A4 sized page
|
|
|
|
+ pdfPageB->SetMediaBox(PDFRectangle(0,0,595,842));
|
|
|
|
+ PageContentContext* pageContentContextB = pdfWriterB.StartPageContentContext(pdfPageB);
|
|
|
|
+ PDFFormXObject* image = pdfWriterB.CreateFormXObjectFromJPGFile("C:\\Users\\bad-p\\Desktop\\Work Folder\\VS CODE\\SanAntonioPass.jpg");
|
|
|
|
+ if (!image){
|
|
|
|
+ TRACE_LOG("Image file not found, creating PDF without image.");
|
|
|
|
+ printf("The image \"C:\\Users\\bad-p\\Desktop\\Work Folder\\VS CODE\\SanAntonioPass.jpg\" was not found.");
|
|
|
|
+ }
|
|
|
|
+ pageContentContextB->q();
|
|
|
|
+ pageContentContextB->cm(0.4,0,0,0.4,57.5,241);
|
|
|
|
+ pageContentContextB->Do(pdfPageB->GetResourcesDictionary().AddFormXObjectMapping(image->GetObjectID()));
|
|
|
|
+ pageContentContextB->Q();
|
|
|
|
+ delete image;
|
|
// END PAGE, WRITE PDF.
|
|
// END PAGE, WRITE PDF.
|
|
// ********************
|
|
// ********************
|
|
- pdfWriter.EndPageContentContext(pageContentContext);
|
|
|
|
- EStatusCode f = pdfWriter.WritePageAndRelease(pdfPage);
|
|
|
|
|
|
+ pdfWriterB.EndPageContentContext(pageContentContextB);
|
|
|
|
+ EStatusCode f = pdfWriterB.WritePageAndRelease(pdfPageB);
|
|
if (f){
|
|
if (f){
|
|
printf ("something interesting");
|
|
printf ("something interesting");
|
|
}
|
|
}
|
|
- pdfWriter.EndPDF();
|
|
|
|
|
|
+ pdfWriterB.EndPDF();
|
|
|
|
|
|
}
|
|
}
|