-
Notifications
You must be signed in to change notification settings - Fork 50
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
Fix case where prawn-templates would cause PDF contents to disappear #21
base: master
Are you sure you want to change the base?
Fix case where prawn-templates would cause PDF contents to disappear #21
Conversation
223f5ef
to
cb47931
Compare
@ndbroadbent Thanks for this fix! Have you seen any new issues arise from using this patch? |
Hi @hasmanyguitars, I've been using this patch for the last few months and haven't seen any problems. It seems to work fine, but there might be a better fix, or a better way to refactor the code. I'm not too familiar with prawn-templates |
According to the PDF spec the |
@content = document.ref({}) | ||
dictionary.data[:Contents] << document.state.store[@content] | ||
contents = ensure_contents_array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to split this in two distinct operations? ensure_contents_array
looks a lot like a command and return value here appears to be circumstantial.
This issue is VERY OLD. Is it still relevant after the latest releases? |
@bvogel As far as I can tell, yes, since the fix is not yet incorporated. |
@ndbroadbent I know it's been a while. Any chance you have a sample PDF around which I can build a test? |
@petergoldstein Sorry for the delay! I'll try to create a sample PDF and add a test case that demonstrates the issue. |
I ran into an issue with a PDF, where prawn-templates would cause the original PDF contents to disappear after adding it's own content stream.
I figured out the reason for this -
:Contents
was a reference that pointed to an array of references, which is a case thatprawn-templates
didn't appear to handle. I've annotated a screenshot from the pdfwalker tool:This PR just adds support for this case, which fixes the issue.