Fix printing error: pdfio output "Missing Root object." - #167
Open
szlt5 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After compiling and printing using the master branch code, the print job fails. The error log indicates that the temporary PDF file generated is structurally incomplete. As a result, the gstoraster filter reports an unexpected page count and terminates with an error.
The root cause is that when pdfioFileOpen() attempts to read temp_filename, some of the data previously written to temp_fp is still buffered in the stdio layer and has not yet been flushed to disk. This causes pdfio to read an incomplete PDF file.
The fix is to call fflush(temp_fp) before invoking pdfioFileOpen(). This ensures that all buffered data is written to the file so that pdfio can read a complete and structurally valid PDF document.