Quellcode durchsuchen

new error created in pdfHummusTest1.exe that needs to be resolved.

wes vor 4 Jahren
Ursprung
Commit
04d5a149ac
2 geänderte Dateien mit 28 neuen und 12 gelöschten Zeilen
  1. 8 9
      ToDo/ToDo.txt
  2. 20 3
      pdfHummusTest1.cpp

+ 8 - 9
ToDo/ToDo.txt

@@ -1,11 +1,10 @@
-14April20
-1. Succesfully created a PDF and added text
-2. issues adding a jpg file to the PDF, figure it out next time
-
-19April20
-Successfully created a log file for errors using Gal's LogConfiguration structure. We are not sure what errors he actually keeps track of so we have to hunt for errors to log.
-
 28April20
 Got image and text to work - but image resource has to be added before adding to pagecontext. there is a committed version of this from today. 
-We are now need to figure out how start and continue works. In Gal's example it creates 2 separate pages. In our example it is now creating one page with only the image on it, no text.
-The text could be getting overwritten. or??? will continue next time.
+We now need to figure out how shutdown and continue works. In Gal's example it creates 2 separate pages. In our example it is now creating one page with only the image on it, no text.
+The text could be getting overwritten. The image resource or any resources loaded through PDFWriter have to be added before PDFWriter is used to stream the document.
+Make sure logme files are put into GitIGNORE or other text files we dont want.
+
+30April20
+Figure out this error message for pdfHummusTest1.exe:
+    terminate called after throwing an instance of 'std::bad_alloc'
+    what():  std::bad_alloc

+ 20 - 3
pdfHummusTest1.cpp

@@ -66,7 +66,7 @@ int main(){
     // ******************************************
     // ******************************************
     pdfWriter.Shutdown("c:\\myFile.pdf.shutdown");
-    PDFWriter pdfWriterB;
+    /*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
@@ -89,6 +89,23 @@ int main(){
     if (f){
         printf ("something interesting");
     }
-    pdfWriterB.EndPDF();
-
+    pdfWriterB.EndPDF();*/
+PDFWriter pdfWriterB;
+			pdfWriterB.ContinuePDF("C:\\Users\\bad-p\\AppData\\Local\\VirtualStore\\myFile.pdf","C:\\Users\\bad-p\\AppData\\Local\\VirtualStore\\myFile.pdf.shutdown");
+			// Create a new page
+			PDFPage* pdfPage2 = new PDFPage();
+			pdfPage->SetMediaBox(PDFRectangle(0,0,595,842));
+			// Create a content context for the page
+			PageContentContext* pageContentContext2 = pdfWriterB.StartPageContentContext(pdfPage2);
+			PDFUsedFont* arialTTF2 = pdfWriterB.GetFontForFile("C:\\Windows\\Fonts\\arial.ttf");
+			pageContentContext2->k(0,0,0,1);
+			pageContentContext2->BT();
+			pageContentContext2->Tf(arialTTF2,1);
+			pageContentContext2->Tm(20,0,0,20,40,822);
+			pageContentContext2->Tj("Hello Again, World");
+			pageContentContext2->ET();				
+			// End content context, and write the page
+			pdfWriterB.EndPageContentContext(pageContentContext2);
+			pdfWriterB.WritePageAndRelease(pdfPage2);
+			pdfWriterB.EndPDF();
 }