Error pdf structure 40 invalid file format что делать
Error pdf structure 40 invalid file format что делать
Добрый день уважаемые читатели блога, наверняка каждый из вас пользуется офисными продуктами Microsoft и очень часто сохраняет файлы в формате PDF, так как они меньше весят и можно запретить редактирование. Бывают ситуации, что вы подготовили отчет и пересылаете его вашему руководители или коллеге. Он открывает его и видит ошибку, что PDF файл поврежден: PDF Structure 40: invalid reference table. Давайте разбираться как можно выкрутиться из этой ситуации и посмотреть содержимое данного документа.
Ошибка открытия pdf файла
Давайте разбираться, по каким причинам у вас может быть ошибка открытия pdf файла: PDF Structure 40: invalid reference table
Как восстановить поврежденный PDF файл
И так для того, чтобы избавиться от ошибки PDF Structure 40: invalid reference table, вы можете пойти такими путями:
Восстановление через online сервисы
Для того, чтобы открыть поврежденный файл pdf я использую сервис https://www.pdf-online.com/osa/repair.aspx
Его я использую, чтобы посмотреть содержимое у поврежденного файла, у сервиса один минус, в бесплатном режиме (evaluation mode), при восстановлении файла у вас на нем будет водяные знаки, рекламирующие этот сервис.
Что вам нужно, нажимаете выберите файл и после жмем Load pdf, в итоге у вас отобразится размер подгруженного pdf. Затем вы нажимаете execute.
Вам покажут превью страниц, для сохранения документа, нажмите Save as.
Еще есть один online сервис https://online.officerecovery.com/ru/ от вас так же нужно нажать кнопку безопасная загрузка и восстановление после того, как вы выбрали файл.
В моем случае, сервис написал:
К сожалению, данных, пригодных для восстановления, найти не удалось.
Если файл очень важен для вас, вы можете заказать его анализ специалистом по восстановлению данных. Им будут использованы профессиональные методы, чтобы либо подтвердить, что файл не подлежит восстановлению, либо получить результат восстановления.
и не смог справиться с ошибкой, что PDF файл поврежден: PDF Structure 40: invalid reference table.
Восстановление через утилиты
Первые утилиты, которые я проверил это были Recovery Toolbox for PDF и PDF Repair Toolbox, сразу отмечу, что они не справились с ошибкой PDF Structure 40: invalid reference table. На первом шаге, вам нужно указать исходный pdf файл.
далее вам предложат назвать, новый файл.
Далее выбираете формат конечного файла.
В бесплатной версии, программа Recovery Toolbox for PDF и PDF Repair Toolbox восстанавливает, только одну страницы, но и этого достаточно для проверки.
Видим, что восстановление прошло успешно.
при открытии я получил белый лист, может конечно в вашем случае Recovery Toolbox for PDF и PDF Repair Toolbox вам помогут, я иду дальше.
Устранение ошибки поврежденных документов при открытии файлов PDF
Продукты Acrobat раньше открывали файл PDF, ожидая встретить в нем заголовок %PDF-header в любом месте первых 1024 байтов файла. Для внешних байтов перед заголовком %PDF-header никакие проверки не выполнялись. Однако обновления 10.1.5 и 11.0.01 улучшают защиту с помощью более строгого анализа заголовка PDF. Продукт теперь не позволяет открывать небольшую часть файлов PDF, которые не начинаются с заголовка «%PDF-‘ header» и возникает ошибка:
Ошибка. Документ поврежден и не может быть восстановлен. Adobe Reader не может открыть файл, поскольку формат файла не поддерживается или файл был поврежден (например, отправлен по e-mail как вложение и декодирован неправильно).
Решение. Использовать один из следующих обходных путей
Программы для создания PDF-файлов
Если вы управляете или администрируете программным обеспечением, которое автоматически создает PDF-файлы, измените способ создания PDF-файлов. Убедитесь, что посторонние байты не появляются в начале файла перед %PDF.
Получатели PDF: корпоративные администраторы и пользователи
Путь HKLM имеет примерно такой вид:
Например, чтобы изменить поведение Acrobat 11.0, создайте DWORD вот здесь: HKLM\SOFTWARE\Adobe\Adobe Acrobat\11.0\AVGeneral\bValidateBytesBeforeHeader=dword:00000000
Путь HKCU имеет примерно такой вид:
Например, чтобы изменить поведение Reader 10.0, создайте DWORD вот здесь: HKCU\SOFTWARE\Adobe\Acrobat Reader\10.0\AVGeneral\bValidateBytesBeforeHeader=dword:00000000
Всегда меняйте наименование продукта и номер версии в соответствии с вашей конкретной ситуацией. Этот метод позволяет отображать PDF на тех компьютерах, которыми вы можете управлять.
Knowledgebase
Why do I get error messages when I attempt to open certain files?
Question:
Why do I get error messages when I attempt to open certain files?
Symptoms:
Error messages such as those detailed below may be present:
Answer:
The error messages:
mean the file is damaged. For example, it may have been corrupted when it was copied or not have downloaded fully from a remote location. The original file could also be corrupted or damged for other reasons, for example Mozilla Firefox can cause this in cases where the PDF file is larger than its cache limit.
Resolution:
Non-PDF Files
Please note that PDF-XChange Viewer is designed to open and edit PDF files. Although PDF-XChange Viewer can create PDF files from alternative formats, it does not contain the functionality to open those formats. Additionally, it should be noted that PDF-XChange Editor has superseded PDF-XChange Viewer, which has been discontinued. PDF-XChange Editor contains the functionality to open a wide range of file formats, and upgrading to this application should resolve the issue. It is available here.
Damaged Files
The first option in the case of damaged files is to attempt to copy/download them again in order to ensure that the issue was not a procedural error.
If PDF-XChange Viewer is opening a file within Mozilla Firefox and one of the above error messages are returned then it is possible that the file exceeds the cache limit. There are several methods that can be used to resolve this issue:
All versions of PDF-XChange Viewer from build 52 and all versions of PDF-XChange Editor include the option to download files as streams, rather than use the Firefox cache method to download files. This will resolve the issue, but please note that viewing very large files may affect performance.
Alternatively, the size of the Mozilla Firefox cache can be increased:
1. Open Mozilla Firefox.
2. Press Alt to launch the toolbar.
3. Click Tools.
4. Click Options.
5. Click the Advanced tab.
Invalid PDF structure #5742
Comments
thnk2wn commented Feb 19, 2015
With some PDFs I get the below error:
PDF.js v1.0.907 (build: e9072ac)
Message: Invalid PDF structure
I can open the PDF fine in Acrobat Reader. Not sure if this is it or not but this happens to be an EchoSigned PDF document.
The text was updated successfully, but these errors were encountered:
thnk2wn commented Feb 19, 2015
So I tried again a couple times and now it works. It seems to be sporadic.
If it matters I’m using Google Chrome (40.0.2214.111 m). We had similar «cannot load PDF» issues before using iFrame or object tag style embeds with Chrome and switched to PdfJs to help avoid this issue but maybe it’s more of a Chrome problem.
yurydelendik commented Feb 19, 2015
Does it work for other browsers? If yes, can be #5512. Also v1.0.907 is older version of PDF.js.
thnk2wn commented Feb 19, 2015
It seems to just be Chrome. Even there it is sporadic and it can happen randomly hitting refresh.
I took a look at the related issue you tagged but can’t quite tell what, if anything, I can do to work around it yet.
As to the version, 1.0.907 was the latest stable version that I just downloaded today from http://mozilla.github.io/pdf.js/getting_started/#download. But if the beta is stable and might help with this issue I’m open to switching to that version.
CodingFabian commented Feb 19, 2015
@thnk2wn for our product we take the latest version of pdf.js once we want to release and run it through our automated tests. Most of the time it is much better than the latest «official stable build». That one is more a marker for the firefox inclusion. IMHO the current master as as stable as any release, if not better.
In general bug reports will be only accepted on the latest version to avoid hunting already fixed bugs.
CodingFabian commented Feb 19, 2015
and yes from your description it sounds likely to be #5512. The newer versions work around this issue and hopefully Chrome decides soon how they want to fix it 🙂
Snuffleupagus commented Feb 19, 2015
You can test this easily using the demo viewer, see http://mozilla.github.io/pdf.js/web/viewer.html; or if you prefer to test locally you can use the archive from the gh-pages branch, see https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#gh-pages.
thnk2wn commented Feb 19, 2015
Also looking for a way to display a loading indicator while the viewer loads since it’s slower than native object tag but these are separate topics.
thnk2wn commented Feb 23, 2015
ananyaojha commented Feb 6, 2016
Invalid or corrupted file.
PDF.js v1.1.114 (build: 3fd44fd)
Message: Invalid PDF structure
It’s coming in all browsers.
m-hcb commented Oct 3, 2016
I have the same issue as @ananyaojha. any solution guys? or reason?
timvandermeij commented Oct 3, 2016
Use the most recent PDF.js version. Otherwise open a new issue with all requested details provided, such as an example PDF file to reproduce the issue.
tofanelli commented Jun 7, 2018
I’m getting this same error message with the PDF file provided with the PDF.js package (in the picture i just renamed it for the sake of tests).
Chrome Version 66.0.3359.181 (Official Build) (64-bit)
and
Firefox 60.0.1 (64-bit)
Windows 8.1
bloigge commented Jul 27, 2018
Same for me. Running pdf.js in ionic cordova on android (chrome web view)
Edward-Shaw commented Oct 15, 2018
Meet the same problem with cordova on android.
Same for me. Running pdf.js in ionic cordova on android (chrome web view)
tofanelli commented Oct 15, 2018 •
guys. I solved my issue using a HTML native tag
and done. the browser itself does the job to understand the object and open it using its tools. way better than add more things (libs) to your project =)
darkomenx commented Jan 12, 2021
Same issue with latest version of pdfjs at now (2.5.207) into Electron application and this code :
InvalidPDFException Comments
Puspendert commented Nov 14, 2018
I am using 4.0.0-beta.5 but still I am getting InvalidPDFException for this file
InvalidPDFException Also, there are lot of warning on console
The text was updated successfully, but these errors were encountered:
iSunRise commented Nov 14, 2018
You just can’t read a file from local filesystem, try any remote pdf, for example: http://www.pdf995.com/samples/pdf.pdf
Puspendert commented Nov 15, 2018
You just can’t read a file from local filesystem, try any remote pdf, for example: http://www.pdf995.com/samples/pdf.pdf
I am using URL now. CORS error was stopping me to fetch the PDF, so I disable CORS using this extension.
But now, nothing is getting rendered
SHAPPY0 commented Jan 29, 2019
Hi,
Did you solved this issue?
I am also facing the same error. Please let me know the solution if you had fixed it.
jp3492 commented Feb 4, 2019
Im having the same issues and getting really desperate in trying to view pdfs in my React app. Maybe i need to eject my CRA to make this possible?
SHAPPY0 commented Feb 6, 2019
wojtekmaj commented Feb 17, 2019
Check if you can open this PDF file in Firefox. Firefox uses the same engine to render PDFs as we do in React-PDF.
If you can open the file just fine in Firefox, open your website and check in Network tab in Developer Tools, if you are actually downloading a file you’re requesting, or as @Puspendert suggested you are hitting a CORS issue and end up getting an invalid/empty PDF file.
Gui-Alucard commented May 21, 2021
Guys, react-pdf accepts only http protocols. So, if you are testing any pdf on your machine, the browser URL will likely be «file: //home/myComputer/localOfFiles/myPdf.pdf» and the correct path should be «http://localhost:3000/myPdf.pdf».
You don’t need to use any extension or anything else, you just move a file.pdf to your public folder in React code and try this path «http://localhost:3000/myPdf.pdf» to see if your browser will render something.
Here is some sample code:
bottxiang commented Jul 24, 2021
Try this import file from ‘./x.pdf’;
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Comments
Puspendert commented Nov 14, 2018
I am using 4.0.0-beta.5 but still I am getting InvalidPDFException for this file Also, there are lot of warning on console The text was updated successfully, but these errors were encountered: You just can’t read a file from local filesystem, try any remote pdf, for example: http://www.pdf995.com/samples/pdf.pdf You just can’t read a file from local filesystem, try any remote pdf, for example: http://www.pdf995.com/samples/pdf.pdf I am using URL now. CORS error was stopping me to fetch the PDF, so I disable CORS using this extension. Hi, Im having the same issues and getting really desperate in trying to view pdfs in my React app. Maybe i need to eject my CRA to make this possible? Check if you can open this PDF file in Firefox. Firefox uses the same engine to render PDFs as we do in React-PDF. Guys, react-pdf accepts only http protocols. So, if you are testing any pdf on your machine, the browser URL will likely be «file: //home/myComputer/localOfFiles/myPdf.pdf» and the correct path should be «http://localhost:3000/myPdf.pdf». You don’t need to use any extension or anything else, you just move a file.pdf to your public folder in React code and try this path «http://localhost:3000/myPdf.pdf» to see if your browser will render something. Here is some sample code: Try this import file from ‘./x.pdf’; You can’t perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
InvalidPDFException iSunRise commented Nov 14, 2018
Puspendert commented Nov 15, 2018
But now, nothing is getting renderedSHAPPY0 commented Jan 29, 2019
Did you solved this issue?
I am also facing the same error. Please let me know the solution if you had fixed it.jp3492 commented Feb 4, 2019
SHAPPY0 commented Feb 6, 2019
wojtekmaj commented Feb 17, 2019
If you can open the file just fine in Firefox, open your website and check in Network tab in Developer Tools, if you are actually downloading a file you’re requesting, or as @Puspendert suggested you are hitting a CORS issue and end up getting an invalid/empty PDF file.Gui-Alucard commented May 21, 2021
bottxiang commented Jul 24, 2021