728x90
GoFPDF로 PDF template을 import 하려고 하는데 계속 이런 에러가 발생했다.
> Failed to initialize parser: Failed to read pdf: Failed to read xref table: Expected xref to start with ‘xref’. Got: 103
https://github.com/phpdave11/gofpdi/issues/16
Failed to initialize parser: Failed to read pdf: Failed to read xref table: Expected xref to start with 'xref' · Issue #16 · p
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
github.com
계속 검색을 해보다가 gofpdi 버전을 최신으로 업데이트 해봤다.
그랬더니 이제 잘 된다 ㅎㅎ
해결방법
Terminal에 밑에 사진처럼 입력해준다.
> go get github.com/phpdave11/gofpdi
이렇게 해주면 최신 버전으로 업데이트 끝이다!
이제 모든 템플릿이 에러 없이 import 될 것이다.
이런 식으로 버전이 바뀌어 있다~~
여기서 추가로
이렇게 해도 pdf template이 나오지 않거나 빈 화면으로 나오는 경우도 있다.
나는 업데이트 이전에
tplid := gofpdi.ImportPage(pdf, "sample.pdf", 1, "/ArtBox")
이렇게 ArtBox로 했었다.
근데 잘 안뜬다면
tplid := gofpdi.ImportPage(pdf, "sample.pdf", 1, "/MediaBox")
ArtBox를 MediaBox로 바꿔주면 된다!
그럼 해결~!
728x90
'Study > error 삽질' 카테고리의 다른 글
[C#, Unity] NullReferenceException: Object reference not set to an instance of an object 해결 방법 (0) | 2022.12.02 |
---|---|
[IntelliJ] 인텔리제이 Server's certificate is not trusted 해결하기 (0) | 2022.11.21 |
Mac 에러 해결하기 (xcrun: error: invalid active developer path) (0) | 2022.11.16 |
Mac OS 터미널(Terminal) 오류 (0) | 2022.11.08 |
[GitHub] Push 에러 해결하기 (error: failed to push some refs to) (2) | 2021.07.05 |
댓글