When saving PDF in PoDoFo dont collect garbage to avoid slowdowns with some PDF files

See #2041745 (metadata in PDF very slow or gives errors)
This commit is contained in:
Kovid Goyal 2023-10-31 19:59:59 +05:30
parent 9ba1a63bde
commit e8d3e37208
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 3 additions and 8 deletions

View File

@ -6,12 +6,8 @@
*/
#include "global.h"
#include <iostream>
#include <algorithm>
#include <new>
#include <string_view>
#include <unordered_map>
#include <vector>
using namespace pdf;

View File

@ -13,7 +13,6 @@
#define USING_SHARED_PODOFO
#include <podofo.h>
#include <unordered_set>
#include <unordered_map>
using namespace PoDoFo;
using namespace std::literals;
@ -130,9 +129,9 @@ object_as_reference(const PdfObject *o) {
return o->IsReference() ? o->GetReference() : o->GetIndirectReference();
}
// Needed to avoid PoDoFo clobbering the /Info and XMP metadata with its own nonsense
// rename to NoMetadataUdate after https://github.com/podofo/podofo/commit/96689eb6e45b71eae1577ecb2d4a796c52e9a813
static const PdfSaveOptions save_options = PdfSaveOptions::NoModifyDateUpdate;
// NoMetadataUpdate needed to avoid PoDoFo clobbering the /Info and XMP metadata with its own nonsense
// NoCollectGarbage needed to avoid slowdowns on writing, see https://github.com/podofo/podofo/issues/99#issuecomment-1787239479
static const PdfSaveOptions save_options = PdfSaveOptions::NoMetadataUpdate | PdfSaveOptions::NoCollectGarbage;
class PdfReferenceHasher {
public: