pdf importer crashes
Closed, ArchivedPublic

Description

System Information
win7 x64

Blender Version
Broken: 6c3d8fb

Short description of error
Some PDF won't import at all and give the following error:

Traceback (most recent call last):
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\__init__.py", line 204, in execute
    self.action(context)
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\__init__.py", line 173, in action
    (mdl, msg) = import_vecfile.ReadVecFileToModel(self.filepath, options)
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\import_vecfile.py", line 72, in ReadVecFileToModel
    art = vecfile.ParseVecFile(fname)
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\vecfile.py", line 128, in ParseVecFile
    contents = pdf.ReadPDFPageOneContents(filename)
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\pdf.py", line 596, in ReadPDFPageOneContents
    return GetPDFPageOneContents(contents)
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\pdf.py", line 667, in GetPDFPageOneContents
    return GetPDFStreamContents(contentsobj, s, crossrefs)
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\pdf.py", line 905, in GetPDFStreamContents
    ans = ans.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9f in position 19206: invalid start byte

location: <unknown location>:-1

or

Problem reading file path/to/pdf.pdf: Problem reading file or unhandled type

or

Traceback (most recent call last):
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\__init__.py", line 204, in execute
    self.action(context)
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\__init__.py", line 173, in action
    (mdl, msg) = import_vecfile.ReadVecFileToModel(self.filepath, options)
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\import_vecfile.py", line 72, in ReadVecFileToModel
    art = vecfile.ParseVecFile(fname)
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\vecfile.py", line 128, in ParseVecFile
    contents = pdf.ReadPDFPageOneContents(filename)
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\pdf.py", line 596, in ReadPDFPageOneContents
    return GetPDFPageOneContents(contents)
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\pdf.py", line 617, in GetPDFPageOneContents
    (trailerdict, crossrefs) = GetPDFTrailerAndCrossrefs(s)
  File "F:\builds\blender-2.78.0-git.6c3d8fb-windows64\2.78\scripts\addons_contrib\io_vector\pdf.py", line 518, in GetPDFTrailerAndCrossrefs
    while crossrefi > 0:
TypeError: unorderable types: tuple() > int()

location: <unknown location>:-1

depending on the file.

Exact steps for others to reproduce the error
Can't attach a file because of rights. But it happens with all tried files but one so far. I can't edit those files because of missing tools and those files where made by another Company. They all open fine in Adobe reader and SumatraPDF.

Details

Type
Bug

exact same problems are in 2.78a.

Without an example file where this crash happens, I can't fix it. What kind of rights error do you get when trying to add a file? I see that you have been successful uploading files in other bug reports; e.g., T50276

@Howard Trickey (howardt). I mean the pdf intellectual property. I'm not allowed because of laws if you prefer. The pdf where made with Autocad if I'm right, but I don't have it, so I can't send a dummy file with the problem.

tried to edit the pdf in another program, I removed enough things to make the pdf import, but it is now like rotated 180° on x axis (so it's up down)
On the left, Blender (Wrong) on the right, acrobat reader (right)


For this, I can attach a file:

Sergey Sharybin (sergey) triaged this task as "Incomplete" priority.Dec 21 2016, 4:50 PM

@matali23 (matali23), we can only fix bugs which we can reproduce and for that we do need a .pdf file which demonstrates the issue. If you can't share original .pdf make a new one. That's really the only way we can solve the issue.

Mixing two issues in one report is also not the greatest idea.

Aaron Carlisle (Blendify) closed this task as "Archived".Jan 5 2017, 10:37 PM

No news in more then a week closing.

Ok, I managed to get access to the computer producing the pdf files. Here is an example file:

. It imports without problem in inkscape, photoshop, etc...

matali23 (matali23) reopened this task as "Open".Jan 9 2017, 10:31 AM
matali23 (matali23) raised the priority of this task from "Incomplete" to "Normal".Jan 11 2017, 1:48 PM

Thanks for the file. I tried importing it, and it did not crash.
Can you please tell me the version of the pdf importer that you have on your computer?
Under binary directory where blender lives, there should be a file like
2.77/scripts/addons_contrib/io_vector/__init__.py

It has a version number in it.
Also, maybe just upload the file pdf.py that is in that directory into this bug.
Thanks.

matali23 (matali23) lowered the priority of this task from "Normal" to "Incomplete".Jan 12 2017, 10:43 AM

After updating to latest buildbot, the file "Ohne Titel1.pdf" imports correctly, but the original file still doesn't. Sorry for the bad example, will put as incomplete until I can make a simple example.

Joey Ferwerda (TheOnlyJoey) closed this task as "Archived".Feb 2 2017, 5:04 PM

This report has passed the limit of inactivity, will be closed as archived.