-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On closing a PDF mOutputStream is NULL #289
Comments
Sounds like a library expression of PDF Format's own limitation. The beginning of Appendix C "Implementation limits" of the PDF specs says: There's probably something within the library writing algo that identifies that at some point it's hitting the limit to describe offsets and stops. I should hope there's a better way than just crashing on null....i wonder if there's an earlier warning, like if one of the earlier writing command (like teh placement of a JPEG) provides with an error. [i'll try to take a look sometime soon and figure out if there's such an early warning trying to simulate what you got myself). Can you handle the task at hand with smaller files? like limited to 9-9.5 gigs? |
Work at less than 10 G. |
While I'm still having the problem with 10G+ files |
The resulting output file is up to 11.5 GB, but the file is corrupt. In function "EStatusCode ObjectsContext::WriteXrefTable(LongFilePositionType& outWritePosition)" Hope this helps |
This probably means that there was an earlier halt. adding logs doesn't help? In any case, im not sure what this will help. the files as come out of PDFWriter have the 10 gigs limitation anyways in writing. maybe there's an earlier warning (so you dn't crash), but you should probably plan on smaller files. Being able to support larger files probably means a bit of a feature adding to the library to emit objects stream based files only (that's the 1.5 feature you refer to...and it remains to be seen whether it does elevate the said limitation), which is not the case right now. |
ok. located the string of issues.
This can be corrected to return a failure immediately (by redirecting the error code via StartXXXXIndirectObject in its various form) instead of doing so later. At the least it will provide an early halt. The file would still be defective, given it already reached 10gbs and xref may not be written later still. I'll introduce a correction along this line soon. So with this, it's still required to keep an eye on how the file size grows and halt prior to 10gbs. I read about 1.5 xref streams again. looks like they can be used regardless of the usage of objects streams. While the library does not write xref streams at this point i think i got most of the parts ready to enable this. I Can add this as a feature after a bit of a POC to see that i got this right. This will lift the 10gbs limit as you can determine the offset bytesize yourself, something that i'll route to the user as an option (with a good enough default). |
ok, so with #291 you should be able to create files with file size larger than 10gbs. To activate this when using StartPDF/StartPDFStream provide a PDFCreationSettings with inWriteXrefAsXrefStream set to true. cheers, |
#291 version works, great. But the #291 version works much better. My test was up to 11.5 GB. |
yeah, just changing the version wouldn't be enough. it's not required for 1.5 or higher to use xref streams, so that's an optional feature. cool. glad to see it works. i'll make this an official release then and add documentation. |
OS: Windows 10
Complier: Microsoft Visual C++ 2019 Version 16.11.33
I'm writing a file that is 10+GB in size.
Smaller sizes seem to work.
All JPEG images.
During the file closing process, (in function ObjectsContext::StartNewIndirectObject())
mOutputStream is NULL.
The resulting PDF isn't properly closed.
static const std::string scObj = "obj";
ObjectIDType ObjectsContext::StartNewIndirectObject()
{
ObjectIDType newObjectID = mReferencesRegistry.AllocateNewObjectID();
}
My code:
boolean CQSDPdfFile::Close()
{
EStatusCode status;
// If file is already closed, just return true
if (!m_bIsFileOpen)
return true;
status = m_pdfWriter.EndPDF(); <<<
ClearFile();
if (status != PDFHummus::eSuccess)
return false;
m_bIsFileOpen = false;
return true;
}
The text was updated successfully, but these errors were encountered: