Fix case where prawn-templates would cause PDF contents to disappear#21
Fix case where prawn-templates would cause PDF contents to disappear#21ndbroadbent wants to merge 1 commit intoprawnpdf:masterfrom
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 |
| end | ||
| @content = document.ref({}) | ||
| dictionary.data[:Contents] << document.state.store[@content] | ||
| contents = ensure_contents_array |
There was a problem hiding this comment.
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 -
:Contentswas a reference that pointed to an array of references, which is a case thatprawn-templatesdidn'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.