EStatusCode PDFCopyingContextTest::Run() { EStatusCode status; PDFWriter pdfWriter; PDFDocumentCopyingContext* copyingContext = NULL; do { status = pdfWriter.StartPDF("C:\\PDFLibTests\\PDFCopyingContextTest.PDF",ePDFVersion13,LogConfiguration(true,true,"c:\\pdflibtests\\PDFCopyingContextTest.txt")); if(status != PDFHummus::eSuccess) { cout<<"failed to start PDF\n"; break; } copyingContext = pdfWriter.CreatePDFCopyingContext("C:\\PDFLibTests\\TestMaterials\\BasicTIFFImagesTest.PDF"); if(!copyingContext) { cout<<"failed to initialize copying context from BasicTIFFImagesTest\n"; status = PDFHummus::eFailure; break; } EStatusCodeAndObjectIDType result = copyingContext->AppendPDFPageFromPDF(1); if(result.first != PDFHummus::eSuccess) { cout<<"failed to append page 1 from BasicTIFFImagesTest.PDF\n"; status = result.first; break; } result = copyingContext->AppendPDFPageFromPDF(18); if(result.first != PDFHummus::eSuccess) { cout<<"failed to append page 18 from BasicTIFFImagesTest.PDF\n"; status = result.first; break; } result = copyingContext->AppendPDFPageFromPDF(4); if(result.first != PDFHummus::eSuccess) { cout<<"failed to append page 4 from BasicTIFFImagesTest.PDF\n"; status = result.first; break; } copyingContext->End(); // delete will call End() as well...so can avoid delete copyingContext; copyingContext = NULL; status = pdfWriter.EndPDF(); if(status != PDFHummus::eSuccess) { cout<<"failed in end PDF\n"; break; } }while(false); delete copyingContext; return status; }