diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 8fd5e18..3218b33 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -709,7 +709,7 @@ int PDFDoc::savePageAs(GooString *name, int pageNo) annotsObj.free(); } yRef->markUnencrypted(); - Guint objectsCount = writePageObjects(outStr, yRef, 0); + writePageObjects(outStr, yRef, 0); yRef->add(rootNum,0,outStr->getPos(),gTrue); outStr->printf("%d 0 obj\n", rootNum); @@ -730,7 +730,6 @@ int PDFDoc::savePageAs(GooString *name, int pageNo) catObj.free(); pagesObj.free(); outStr->printf(">>\nendobj\n"); - objectsCount++; yRef->add(rootNum + 1,0,outStr->getPos(),gTrue); outStr->printf("%d 0 obj\n", rootNum + 1); @@ -742,7 +741,6 @@ int PDFDoc::savePageAs(GooString *name, int pageNo) } outStr->printf(">>\n"); outStr->printf("endobj\n"); - objectsCount++; yRef->add(rootNum + 2,0,outStr->getPos(),gTrue); outStr->printf("%d 0 obj\n", rootNum + 2); @@ -760,14 +758,13 @@ int PDFDoc::savePageAs(GooString *name, int pageNo) value.free(); } outStr->printf(" >>\nendobj\n"); - objectsCount++; page.free(); Goffset uxrefOffset = outStr->getPos(); Ref ref; ref.num = rootNum; ref.gen = 0; - Dict *trailerDict = createTrailerDict(objectsCount, gFalse, 0, &ref, getXRef(), + Dict *trailerDict = createTrailerDict(rootNum + 3, gFalse, 0, &ref, getXRef(), name->getCString(), uxrefOffset); writeXRefTableTrailer(trailerDict, yRef, gFalse /* do not write unnecessary entries */, uxrefOffset, outStr, getXRef());