-
Notifications
You must be signed in to change notification settings - Fork 59
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
Failed to initialize parser: Failed to read pdf: Failed to read xref table: Expected xref to start with 'xref' #16
Comments
Thank you for the bug report and sample PDF. From the PDF specification:
I will add support for reading cross-reference information from cross-reference streams. |
@phpdave11 any idea when this support will be added? |
@tylerzika I will hopefully get to it by the end of the month. I'm just now reading up on how xref streams ought to be parsed. If you're able add support for this sooner, feel free to submit a pull request. |
@phpdave11 any updates on this? I'll see if I can contribute.. |
@tylerzika I started work on it in the xref-stream-support branch, but I haven’t been able to work on it lately. |
@phpdave11 could you please let us know when this would be available? Thank you very much in advance |
@phpdave11 Sorry for asking again, your help would be very much appreciated. Thank you |
@phpdave11 can you share the documentation you would use to fix this issue? I'm clueless on how I would solve it, but I'd like to contribute and try. |
This is fixed in gofpdi v1.0.9. |
I've updated the gofpdi dependency in my fork of gofpdf - jung-kurt/gofpdf is no longer maintained. |
@phpdave11 I think there is a compiling error. My import statement:
|
@phpdave11 it looks like you change some of the functions and their parameters? |
@tylerzika The external functions and parameters have not changed. I'm not seeing any compiler errors. Try updating the code with |
@phpdave11 when I do
|
|
@tylerzika can you share your go.mod and go.sum files? |
Please see issue #23 against v1.0.9 |
go.mod
go.mod
go.sum
|
@phpdave11 I deleted the src files and did a go get to download them again. The error went away. But I'm still getting this error:
|
@tylerzika this has been fixed in gofpdi v1.0.11. Originally posted by @phpdave11 in #25 (comment) |
@phpdave11 this update is fantastic! It's working well with a lot of my company's pdfs we are importing. There is one that is still having problems. It's successfully importing a pdf, but one of the pdf's pages is almost completely blank. At the top of the second page, all of the pdf's image appears to be squashed at the top. It's attached. We had to blot out some person information, so I hope you can experience what we've seen from the original. |
With v1.0.11:
|
@tylerzika I'm able to reproduce this issue. I will open a separate issue for this problem. |
@0x-1 would you mind posting the PDF that causes this error in a new issue? |
Sure thing. Thanks for the patch so far. |
I'm getting the same error as @0x-1
Does anyone have a solution to this? |
The only solution I have found that is relatively fool-proof is to re-save the pdf using pdftk first.
For example
pdftk infile cat output outfile && mv outfile infile
Then gofpdi is able to read the pdf xref table in most situations.
…On 28/12/20, Rajat ***@***.***) wrote:
I'm getting the same error as @0x-1
```
Failed to initialize parser: Failed to read pdf: Failed to read xref table: Failed to read prev xref: Unsupported /DecodeParms - only tested with /Columns 4 /Predictor 12
```
Does anyone have a solution to this?
|
Thanks @rorycl |
now this qustion util exist。 |
now this qustion util exist。
|
Please see my comments above about using pdftk to fix xref tables. I haven't tried it yet, but I wonder if using the |
Save my day, thanks@rorycl |
That's great to hear @lsymy. Do you have an implementation example to share? Cheers, |
@phpdave11 : any news on a possible fix for this? Most of the time gofpdi works great, but the xref table problem causing a panic is affecting the users of rm2pdf; see rorycl/rm2pdf#4. Using Thanks for any response. |
Certain formats of PDF documents do not contain the xref table which is causing the parsing error.
Attaching the pdf so you can duplicate the error.
example_012a.pdf
The text was updated successfully, but these errors were encountered: