1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #include <stdlib.h>
- #include <iostream>
- #include "PDFWriter.h"
- #include "PDFPage.h"
- #include "PageContentContext.h"
- #include "PDFFormXObject.h"
- #include "Trace.h"
- int main(){
- PDFWriter pdfWriter;
-
-
-
- EStatusCode e = pdfWriter.StartPDF(".\\myFile.pdf",ePDFVersion13,LogConfiguration(true,true,".\\logMe"));
- TRACE_LOG("ooogaBooga");
- if (e){
- printf ("something interesting");
- }
- PDFPage* pdfPage = new PDFPage();
-
- pdfPage->SetMediaBox(PDFRectangle(0,0,595,842));
- PageContentContext* pageContentContext = pdfWriter.StartPageContentContext(pdfPage);
-
- PDFUsedFont* arialTTF = pdfWriter.GetFontForFile("C:\\Windows\\Fonts\\arial.ttf");
-
-
-
- pageContentContext->k(0,0,0,1);
-
- pageContentContext->BT();
-
- pageContentContext->Tf(arialTTF,1);
-
- pageContentContext->Tm(20,0,0,20,40,822);
-
- pageContentContext->Tj("Text placed and scaled with Tm");
-
- 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->Do(pdfPage->GetResourcesDictionary().AddFormXObjectMapping(image->GetObjectID()));
- pageContentContext->Q();
-
-
- pdfWriter.EndPageContentContext(pageContentContext);
- EStatusCode f = pdfWriter.WritePageAndRelease(pdfPage);
- if (f){
- printf ("something interesting");
- }
- pdfWriter.EndPDF();
- }
|