Incremental save generate an empty pdf file

80 views
Skip to first unread message

Daniel Hu

unread,
Mar 28, 2024, 6:05:18 AMMar 28
to pdfium
Hello guys,

When i add an annotation and save the file by invoke SaveAsCopy which generate an empty file. Blow is the code:
------------- code begin ------------

int writeBlock(FPDF_FILEWRITE* owner, const void* buffer, unsigned long size) {

    const FileWrite* writer = reinterpret_cast<FileWrite*>(owner);

    if (!writer->filestream->is_open()) {

        return 1;

    }

    writer->filestream->write(static_cast<const char*>(buffer), size);    

    return 1;

}

FileWrite filewrite(filename);

filewrite.version = 1;

filewrite.WriteBlock = &writeBlock;

bool ret = FPDF_SaveAsCopy((FPDF_DOCUMENT)self.mDocument.data, &filewrite, FPDF_INCREMENTAL);

---------------code end-------------

Did Pdfium support incremental saving? 

Could you help me

Thanks,

Daniel Hu.

geisserml

unread,
Mar 29, 2024, 11:55:15 AMMar 29
to pdfium
I believe incremental saving of annotations is broken according to https://crbug.com/pdfium/1518

geisserml

unread,
Mar 30, 2024, 2:12:58 PMMar 30
to pdfium
Apart from that, some documentation for FPDF_INCREMENTAL (as comment in fpdf_save.h) might be helpful.
Like a reference to PDF 1.7, 7.5.6 ("Incremental Updates") in the header comments.
Reply all
Reply to author
Forward
0 new messages