Skip to content
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

Error: Did not find ENC #44

Closed
michal-devel opened this issue Dec 13, 2022 · 7 comments
Closed

Error: Did not find ENC #44

michal-devel opened this issue Dec 13, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@michal-devel
Copy link

Bug description

Hi!

DeACSM fails with some (I have two files *.acsm files). I checked one of these.

Here's end of Calibre log:

</envelope>Traceback (most recent call last):
  File "calibre/customize/ui.py", line 432, in get_file_type_metadata
  File "calibre/customize/builtins.py", line 315, in get_metadata
  File "calibre/ebooks/metadata/pdf.py", line 124, in get_metadata
ValueError: Could not read info dict from PDF

Not notifying any server since that was disabled.
DeACSM v0.0.16: Downloading book ...
DeACSM v0.0.16: Loading book from <removed>
Download took 30188 ms (HTTP 200)
That's a PDF file
DeACSM v0.0.16: Downloaded PDF, adding encryption config ...
Searching for startxref ...
Got startxref: 21779570
Error: Did not find ENC - took 285 ms
Error, enc not found
DeACSM v0.0.16: There was an error patching the PDF file.
Syntax Error: Document stream is empty
pdfinfo errored out with return code: 1
Added 0 books in 35.4 seconds

I have the full log and *.acsm file. Unfortunately, I cannot download the book by ADE, because I have different credentials on my Windows installation with ADE and different on my Linux system.

I'm happy to help you investigate this issue.

Operating system

Linux

Which version of Calibre are you running?

5.37

Which version of the ACSM Input plugin are you running?

v0.0.16

Further information

No response

@Leseratte10
Copy link
Owner

Leseratte10 commented Dec 13, 2022

Thanks for the report. PDFs can sometimes be a bit weird. EPUBs are easy, they're ZIP files and the DRM is handled by adding / removing an XML file to that ZIP. PDFs on the other hand are a complex binary format that only Adobe software can really 100% understand. That PDF file is probably using something weird for its encryption that my plugin doesn't yet support.

Can you send me the ACSM file and the URL you've removed from that log ("Loading book from ...") to the address <address removed> , then I'll take a look and see if I can find something.

@michal-devel
Copy link
Author

I've just send you an e-mail.

Leseratte10 added a commit that referenced this issue Dec 13, 2022
Some PDFs apparently use nonstandard spacing in the /Encrypt
blob which my parser didn't like. Hopefully this fixes it?
Related to #44
@Leseratte10
Copy link
Owner

Thanks for the full log. Can you test this version and see if that fixes the issue?

https://github.com/Leseratte10/acsm-calibre-plugin/suites/9848969646/artifacts/474757622 (c508280)

Please make a backup of your authorization before installing this (plugin settings -> Export account activation data) as this is a newer version that changes some more stuff and it's a bit experimental.

Then just install the version from that link (install the "calibre-plugin.zip", ignore the "calibre-migration-plugin.zip" file), restart Calibre, try to import the ACSM file again, and see if that works then. If that still doesn't work, please send me another mail with the new log, and with the PDF file as created by that version of the plugin.

@michal-devel
Copy link
Author

Sure, please give a second.

@michal-devel
Copy link
Author

michal-devel commented Dec 13, 2022

Bum! It did the trick!

EDIT:

Please give a sec, I will test some other ACSM files that hadn't been successfully processed before.

EDIT2:

I checked another file. No luck this time. I'll send log and the ACSM file.

@Leseratte10
Copy link
Owner

Quoting from the log file you've sent me:

DeDRM v10.0.3: Trying to decrypt ooqmsq26.pdf
DeDRM v10.0.3: ooqmsq26.pdf is a PDF ebook with encryption EBX_HANDLER
DeDRM v10.0.3: ooqmsq26.pdf is a PDF ebook (EBX) for UUID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
DeDRM v10.0.3: Trying UUID-matched encryption key adobe_uuid_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
error writing pdf: Invalid object number: objid=3290
Traceback (most recent call last):
  File "/home/michal/.config/calibre/plugins/DeDRM.zip/ineptpdf.py", line 1820, in getobj
    obj = objs[i]
IndexError: list index out of range

My plugin seems to have created a valid PDF file but the DeDRM plugin failed to remove the DRM from the file. While this could in theory be a bug with my plugin creating an invalid PDF, this is more likely to be a bug in the DeDRM plugin so you would need to open an issue in that repository as I have nothing to do with the DeDRM plugin.

@Leseratte10
Copy link
Owner

Looks like this was indeed a bug with the DeDRM plugin which is now fixed, so I'm going to close this issue. If it comes up again just reopen this or make a new report.

@Leseratte10 Leseratte10 added the bug Something isn't working label May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants