Evidlo / remarkable_printer

Native printing to reMarkable.
GNU General Public License v3.0
261 stars 21 forks source link

does not work with 2.6.1.71 #23

Closed dansbandit closed 3 years ago

dansbandit commented 3 years ago

Reinstalled after the 2.6.1.71 update.

What gets printed is one white page.

gavinmcc commented 3 years ago

I think I'm seeing the same. On macbook:

38f9d35c0f7b:~ gavinmc$ nc 10.11.99.1 9100 < Downloads/FAQ.pdf 
38f9d35c0f7b:~ gavinmc$ ls -lh Downloads/FAQ.pdf 
-rw-r--r--@ 1 gavinmc  staff   156K Jan 16  2020 Downloads/FAQ.pdf

On reMarkable:

Mar 21 01:11:54 reMarkable printer.arm[923]: Saving PDF to: /home/root/.local/share/remarkable/xochitl/54893dbc-9aac-47f5-901b-32f4e347e993.pdf
Mar 21 01:11:54 reMarkable printer.arm[923]: %PDF-1.4
Mar 21 01:11:54 reMarkable printer.arm[923]: PDF begin
Mar 21 01:11:54 reMarkable printer.arm[923]: Saving metadata to /home/root/.local/share/remarkable/xochitl/54893dbc-9aac-47f5-901b-32f4e347e993.metadata
Mar 21 01:11:54 reMarkable printer.arm[923]: Restarting xochitl
reMarkable: ~/ ls -lh /home/root/.local/share/remarkable/xochitl/54893dbc-9aac-47f5-901b-32f4e347e993*
-rw-r--r--    1 root     root         537 Mar 21 01:11 /home/root/.local/share/remarkable/xochitl/54893dbc-9aac-47f5-901b-32f4e347e993.content
-rw-r--r--    1 root     root         275 Mar 21 01:11 /home/root/.local/share/remarkable/xochitl/54893dbc-9aac-47f5-901b-32f4e347e993.metadata
-rw-r--r--    1 root     root           0 Mar 21 01:11 /home/root/.local/share/remarkable/xochitl/54893dbc-9aac-47f5-901b-32f4e347e993.pagedata
-rw-r--r--    1 root     root      155.9K Mar 21 01:11 /home/root/.local/share/remarkable/xochitl/54893dbc-9aac-47f5-901b-32f4e347e993.pdf

/home/root/.local/share/remarkable/xochitl/54893dbc-9aac-47f5-901b-32f4e347e993:

/home/root/.local/share/remarkable/xochitl/54893dbc-9aac-47f5-901b-32f4e347e993.thumbnails:
-rw-r--r--    1 root     root        1.5K Mar 21 01:12 c2ee4954-94b2-4eab-aa58-b8298f5da191.jpg

reMarkable: ~/ cat /home/root/.local/share/remarkable/xochitl/54893dbc-9aac-47f5-901b-32f4e347e993.metadata 
{
    "deleted": false,
    "lastModified": "1616289114000",
    "lastOpenedPage": 0,
    "metadatamodified": true,
    "modified": true,
    "parent": "",
    "pinned": false,
    "synced": false,
    "type": "DocumentType",
    "version": 0,
    "visibleName": "Printed"
}
reMarkable: ~/ cat .local/share//remarkable/xochitl/54893dbc-9aac-47f5-901b-32f4e347e993.pagedata 
Blank
reMarkable: ~/ grep -A 50  54893dbc log.txt 
Mar 21 01:11:58.913 Warning: file '/home/root/.local/share/remarkable/xochitl/54893dbc-9aac-47f5-901b-32f4e347e993.content' does not exist! (:0, )
Mar 21 01:11:58.914 Warning: Document error detected for "54893dbc-9aac-47f5-901b-32f4e347e993" (:0, )
Mar 21 01:11:58.918 Warning: File type is undefined, falling back to Notebook for Document(0x26de680) (:0, )
Mar 21 01:11:58.929 Debug:   void Library::load() 21 ms  *** ON GUI THREAD *** (:0, )
Mar 21 01:11:58.933 Info: wlan0: Link is up (:0, )
Mar 21 01:11:58.944 Warning: FIXME: mipmap filtering not supported (:0, )
Mar 21 01:11:58.945 Warning: FIXME: wrapmode not supported (:0, )
Mar 21 01:11:58.945 Warning: FIXME: wrapmode not supported (:0, )
Mar 21 01:11:58.946 Warning: FIXME, setting node inner target rect for image node not supported: QRectF(0,0 60x60) (:0, )
Mar 21 01:11:58.946 Warning: FIXME: mirroring not supported (:0, )
Mar 21 01:11:59.691 Warning: No worker! (:0, )
Mar 21 01:12:00.208 Info: wlan0: Address added: 192.168.1.121 (:0, )
Mar 21 01:12:00.209 Info: wlan0: Address added: fd2c:1f8b:5e53:0:122c:6bff:fed1:dd0d (:0, )
Mar 21 01:12:00.209 Info: wlan0: Address added: fe80::122c:6bff:fed1:dd0d (:0, )
Mar 21 01:12:00.339 Info: Got gateway: 192.168.1.1 (:0, )
Mar 21 01:12:00.345 Info: We probably have Internet (:0, )
Mar 21 01:12:00.364 Info: Scanning: true (:0, )
Mar 21 01:12:03.988 Info: Scanning: false (:0, )
gavinmcc commented 3 years ago

It appears the problem is, as mentioned that the ".content' does not exist!".

I turned off the automatic restart, printed, then copied a content file into place from another PDF uploaded by the standard software. I also altered the .metadata file to give it a name which wasn't "printed", then manually restarted and I got a working PDF I could read again.

reMarkable: ~/ cp  .local/share//remarkable/xochitl/d7ef7645-1aed-42a4-aa05-9c6ae3bd6562.content .local/share//remarkable/xochitl/43263555-aae6-4a15-bc9d-5a4ccc812205.content
reMarkable: ~/ vim  .local/share//remarkable/xochitl/43263555-aae6-4a15-bc9d-5a4ccc812205.metadata 
reMarkable: ~/ systemctl restart xochitl

So it looks like a solution may be for remarkable_printer to create a .content file.

This is the file I copied into place (which was very obviously incorrect):

reMarkable: ~/ cat .local/share//remarkable/xochitl/d7ef7645-1aed-42a4-aa05-9c6ae3bd6562.content 
{
    "coverPageNumber": 0,
    "dummyDocument": false,
    "extraMetadata": {
        "LastEraserTool": "Eraser",
        "LastPen": "SharpPencilv2",
        "LastSharpPencilv2Color": "Black",
        "LastSharpPencilv2Size": "1",
        "LastTool": "SharpPencilv2",
        "LastUndefinedColor": "Black",
        "LastUndefinedSize": "1"
    },
    "fileType": "pdf",
    "fontName": "",
    "lineHeight": -1,
    "margins": 100,
    "orientation": "portrait",
    "pageCount": 14,
    "pages": [
        "0974786a-9e45-451a-8a82-766fcc489bc5",
        "b79314f8-cc64-4ee8-80ed-e65fea1497fc",
        "f123da6f-1ba2-4d1c-afa0-98aaa5c78420",
        "69bbdad2-801f-4259-bab1-e737a23d0282",
        "444e2fcb-0bef-426f-b351-ca5df57c7352",
        "0eb4b439-2c74-49d9-8180-56f2685dac2f",
        "6a4ce06c-7958-45ab-b80a-641c0125747f",
        "858c2e07-8eca-4c66-9c3d-de74c6dc0a4f",
        "ef526c9c-6f3e-4238-9943-3d3a0d0f6195",
        "f4b65366-1adf-4679-a906-d24e2740750f",
        "d45a8049-e963-4f72-a088-ef02df72cb26",
        "75efd51b-583f-4948-add5-7dde62b2fb78",
        "f0ed82b5-7ca2-416e-a618-0b1413554dd4",
        "c1783baa-7714-4fc7-82a0-ecabf440a5d0"
    ],
    "textAlignment": "left",
    "textScale": 1,
    "transform": {
        "m11": 1,
        "m12": 0,
        "m13": 0,
        "m21": 0,
        "m22": 1,
        "m23": 0,
        "m31": 0,
        "m32": 0,
        "m33": 1
    }
}

It looks like xochitl scanned the PDF and corrected it:

reMarkable: ~/ diff .local/share//remarkable/xochitl/d7ef7645-1aed-42a4-aa05-9c6ae3bd6562.content .local/share//remarkable/xochitl/43263555-aae6-4a15-bc9d-5a4ccc812205.content 
--- .local/share//remarkable/xochitl/d7ef7645-1aed-42a4-aa05-9c6ae3bd6562.content
+++ .local/share//remarkable/xochitl/43263555-aae6-4a15-bc9d-5a4ccc812205.content
@@ -15,22 +15,13 @@
     "lineHeight": -1,
     "margins": 100,
     "orientation": "portrait",
-    "pageCount": 14,
+    "pageCount": 5,
     "pages": [
         "0974786a-9e45-451a-8a82-766fcc489bc5",
         "b79314f8-cc64-4ee8-80ed-e65fea1497fc",
         "f123da6f-1ba2-4d1c-afa0-98aaa5c78420",
         "69bbdad2-801f-4259-bab1-e737a23d0282",
-        "444e2fcb-0bef-426f-b351-ca5df57c7352",
-        "0eb4b439-2c74-49d9-8180-56f2685dac2f",
-        "6a4ce06c-7958-45ab-b80a-641c0125747f",
-        "858c2e07-8eca-4c66-9c3d-de74c6dc0a4f",
-        "ef526c9c-6f3e-4238-9943-3d3a0d0f6195",
-        "f4b65366-1adf-4679-a906-d24e2740750f",
-        "d45a8049-e963-4f72-a088-ef02df72cb26",
-        "75efd51b-583f-4948-add5-7dde62b2fb78",
-        "f0ed82b5-7ca2-416e-a618-0b1413554dd4",
-        "c1783baa-7714-4fc7-82a0-ecabf440a5d0"
+        "444e2fcb-0bef-426f-b351-ca5df57c7352"
     ],
     "textAlignment": "left",
     "textScale": 1,
gavinmcc commented 3 years ago

It seems you only need a single entry in that .content file for things to work:

reMarkable: ~/ cat dummy.content 
{
    "fileType": "pdf"
}

I copied this into place and manually restarted xochitl and things worked fine.

reMarkable: ~/ cp dummy.content  .local/share//remarkable/xochitl/8a6be70c-5a25-4f8a-9a5c-ddeeeeecc895.content 
reMarkable: ~/ systemctl restart xochitl
reMarkable: ~/ diff dummy.content  .local/share//remarkable/xochitl/8a6be70c-5a25-4f8a-9a5c-ddeeeeecc895.content
--- dummy.content
+++ .local/share//remarkable/xochitl/8a6be70c-5a25-4f8a-9a5c-ddeeeeecc895.content
@@ -1,3 +1,30 @@
 {
-    "fileType": "pdf"
+    "coverPageNumber": -1,
+    "dummyDocument": false,
+    "extraMetadata": {
+    },
+    "fileType": "pdf",
+    "fontName": "",
+    "lineHeight": -1,
+    "margins": 125,
+    "orientation": "portrait",
+    "pageCount": 3,
+    "pages": [
+        "8de87c93-08bc-46a6-9e4e-c70cec770b60",
+        "9bcf30d4-f83a-401e-bbda-592552e0e874",
+        "4a622c6c-afe9-4984-aeab-d6802abcb368"
+    ],
+    "textAlignment": "justify",
+    "textScale": 1,
+    "transform": {
+        "m11": 1,
+        "m12": 0,
+        "m13": 0,
+        "m21": 0,
+        "m22": 1,
+        "m23": 0,
+        "m31": 0,
+        "m32": 0,
+        "m33": 1
+    }
 }
Evidlo commented 3 years ago

Thanks! You can make a PR or I can just commit the change if you want.

gavinmcc commented 3 years ago

Just testing now and it looks like it's working ... PR shortly.

dansbandit commented 3 years ago

I tried the fix but the problem persists.

Now it says Printed in the remarkable, and it's the same if I try to print on browser or print test page.

./printer.arm -host 0.0.0.0 -port 9100 -debug -restart
Debugging enabled 
Listening on 0.0.0.0:9100
Saving PDF to: /home/root/.local/share/remarkable/xochitl/4e5cf0c7-c27e-4841-a853-347ff59bc1eb.pdf
%PDF-1.4 
PDF begin 
Saving metadata to /home/root/.local/share/remarkable/xochitl/4e5cf0c7-c27e-4841-a853-347ff59bc1eb.metadata
Restarting xochitl
grep -A 50 4e5cf0c7 log.txt
Mar 22 07:33:22.806 Warning: file '/home/root/.local/share/remarkable/xochitl/4e5cf0c7-c27e-4841-a853-347ff59bc1eb.content' does not exist! (:0, )
Mar 22 07:33:22.806 Warning: Document error detected for "4e5cf0c7-c27e-4841-a853-347ff59bc1eb" (:0, )
Mar 22 07:33:22.811 Warning: File type is undefined, falling back to Notebook for Document(0x1ccdb68) (:0, )
Mar 22 07:33:22.816 Warning: Found deleted entry in library! "506546e5-1020-432a-bf18-a9734c9049bd" (:0, )
Mar 22 07:33:22.818 Warning: Found deleted entry in library! "52332b9e-d1b8-446b-a602-198bcee14009" (:0, )
Mar 22 07:33:22.821 Warning: Found deleted entry in library! "5433a351-7510-4040-a6c5-ad1506258202" (:0, )
Mar 22 07:33:22.830 Warning: Found deleted entry in library! "5d8d55cf-0243-46ae-ad84-b7da0eebee8b" (:0, )
Mar 22 07:33:22.877 Debug:       virtual Entry::SharedPtr Library::loadEntry(const QString&) 46 ms  *** ON GUI THREAD *** (:0, )
Mar 22 07:33:22.883 Warning: Found deleted entry in library! "644db968-a899-4581-8065-760a17140db9" (:0, )
Mar 22 07:33:22.886 Warning: Found deleted entry in library! "6cd9473a-49b0-4ccd-a440-b6c4a23afe50" (:0, )
Mar 22 07:33:22.888 Warning: Found deleted entry in library! "725c291a-6149-4802-b55d-0371826777cb" (:0, )
Mar 22 07:33:22.891 Warning: Found deleted entry in library! "72dfec2b-211c-4bf8-9d29-24c0501a7df0" (:0, )
Mar 22 07:33:22.900 Warning: Found deleted entry in library! "87996ef3-eb68-488a-ad41-548c10cbbf54" (:0, )
Mar 22 07:33:22.912 Warning: Found deleted entry in library! "87e382ee-ed23-4719-9936-c7c5c68c88ac" (:0, )
Mar 22 07:33:22.913 Debug:       virtual Entry::SharedPtr Library::loadEntry(const QString&) 11 ms  *** ON GUI THREAD *** (:0, )
Mar 22 07:33:22.914 Warning: Found deleted entry in library! "8b3accf1-fbcf-4d01-938f-871ae673aa74" (:0, )
Mar 22 07:33:22.927 Warning: Found deleted entry in library! "8d9f3cdd-3dc6-4e21-b225-17fa1184afdf" (:0, )
Mar 22 07:33:22.929 Warning: Found deleted entry in library! "8f171eca-1dc9-4e6a-867c-7d6df1891c56" (:0, )
Mar 22 07:33:22.931 Warning: Found deleted entry in library! "9ddc8220-124b-4ac1-b50b-417e00703573" (:0, )
Mar 22 07:33:22.933 Warning: Found deleted entry in library! "9e64bf67-9399-463d-828d-7bfb07d4809c" (:0, )
Mar 22 07:33:22.935 Warning: Found deleted entry in library! "9e7cbd22-cb48-411c-b892-c357447a5978" (:0, )
Mar 22 07:33:22.938 Warning: Found deleted entry in library! "a0d68637-5cac-44bb-aadc-2ccd7e392281" (:0, )
Mar 22 07:33:22.949 Warning: Found deleted entry in library! "a2f46e0b-eee3-4946-bc96-5ff42bc62f8e" (:0, )
Mar 22 07:33:22.951 Warning: Found deleted entry in library! "a7015193-d8d3-4788-821a-60e6f4bae105" (:0, )
Mar 22 07:33:22.955 Warning: Found deleted entry in library! "ae491792-439c-466d-8d4b-34eb3c15ee9e" (:0, )
Mar 22 07:33:22.957 Warning: Found deleted entry in library! "b022bd4f-0178-432b-89d5-a1530434bda8" (:0, )
Mar 22 07:33:22.964 Warning: Found deleted entry in library! "b406b529-5fda-4ce7-8b3b-ba5570f57896" (:0, )
Mar 22 07:33:22.966 Warning: Found deleted entry in library! "b7a478fb-099a-4fad-bd5d-ff9aa2bd08a9" (:0, )
Mar 22 07:33:22.970 Warning: Found deleted entry in library! "bd880b9c-d09e-40a5-8b40-82fa8440527b" (:0, )
Mar 22 07:33:22.978 Warning: Found deleted entry in library! "c810e328-ebf3-44ca-b58e-d278802b8ab6" (:0, )
Mar 22 07:33:22.980 Warning: Found deleted entry in library! "cef6d221-dcf3-41a9-9fdc-3c9f4e547289" (:0, )
Mar 22 07:33:22.982 Warning: Found deleted entry in library! "d0fee85f-7dc5-435e-8c15-0eaa00906884" (:0, )
Mar 22 07:33:22.993 Warning: Found deleted entry in library! "d410156c-f0a4-4022-b046-46fb0773f391" (:0, )
Mar 22 07:33:22.994 Warning: Found deleted entry in library! "d4a7fede-1b05-4475-8263-d3479ab281b0" (:0, )
Mar 22 07:33:23.001 Warning: Found deleted entry in library! "d7772bb6-d8f1-475a-930f-309c86c2ed0b" (:0, )
Mar 22 07:33:23.004 Warning: Found deleted entry in library! "dc073c33-4178-4bf0-aeba-8bafba88154f" (:0, )
Mar 22 07:33:23.017 Debug:       virtual Entry::SharedPtr Library::loadEntry(const QString&) 12 ms  *** ON GUI THREAD *** (:0, )
Mar 22 07:33:23.020 Warning: Found deleted entry in library! "e0cec6d1-3180-41ac-aa76-584517d62e5a" (:0, )
Mar 22 07:33:23.022 Warning: Found deleted entry in library! "e1443cff-f52b-480c-b082-b7eadbea2b98" (:0, )
Mar 22 07:33:23.024 Warning: Found deleted entry in library! "e2eabe66-8e03-4f41-8c7a-aad32625c7f2" (:0, )
Mar 22 07:33:23.026 Warning: Found deleted entry in library! "e316b7fc-500d-4b3a-9ed0-4ed4c01ba002" (:0, )
Mar 22 07:33:23.030 Warning: Found deleted entry in library! "f0edc7cf-4526-4afd-8b55-ecc627823233" (:0, )
Mar 22 07:33:23.033 Warning: Found deleted entry in library! "f85b54ba-dab4-478b-8caa-7e6566c1e1c7" (:0, )
Mar 22 07:33:23.036 Warning: Found deleted entry in library! "fbc26282-0288-4153-b8f0-a7d49f7525b9" (:0, )
Mar 22 07:33:23.038 Warning: XMLHttpRequest: Using GET on a local file is dangerous and will be disabled by default in a future Qt version.Set QML_XHR_ALLOW_FILE_READ to 1 if you wish to continue using this feature. (:0, )
Mar 22 07:33:23.040 Debug:       void Library::load() 395 ms  *** ON GUI THREAD *** (:0, )
Mar 22 07:33:23.042 Info: wlan0: Link is up (:0, )
Mar 22 07:33:23.115 Warning: FIXME: mipmap filtering not supported (:0, )
Mar 22 07:33:23.115 Warning: FIXME: wrapmode not supported (:0, )
Mar 22 07:33:23.115 Warning: FIXME: wrapmode not supported (:0, )
Mar 22 07:33:23.115 Warning: FIXME, setting node inner target rect for image node not supported: QRectF(0,0 60x60) (:0, )
Mar 22 07:33:23.116 Warning: FIXME: mirroring not supported (:0, )

If i put the dummy.content in 4e5cf0c7-c27e-4841-a853-347ff59bc1eb.content and reboot it works but the name is "Printed" again.

gavinmcc commented 3 years ago

I tried the fix but the problem persists.

What exact fix did you try?

Mar 22 07:33:22.806 Warning: file '/home/root/.local/share/remarkable/xochitl/4e5cf0c7-c27e-4841-a853-347ff59bc1eb.content' does not exist! (:0, )

Are you sure the patch applied? The above seems to suggest it wasn't applied. That .content file is what the patch created.

If i put the dummy.content in 4e5cf0c7-c27e-4841-a853-347ff59bc1eb.content and reboot it works but the name is "Printed" again.

I didn't manage to get the filename to be anything other than "Printed" either. I wasn't able to work out how that worked looking at the PDF files and the code reading them. But otherwise, it did at least work and print the document.

dansbandit commented 3 years ago

Yes I have the patch applied. I also deleted the ~bin/ folder on the remarkable and installed the service and printer again. What do you get in your log.txt when you print?

git log

commit 47539d4d913f93fcddb574a0df9e2361fe895118 (HEAD -> master, origin/master, origin/HEAD)
Merge: 52f3174 14e8063
Author: Evan Widloski <evan@evanw.org>
Date:   Sun Mar 21 22:46:30 2021 -0500

    Merge pull request #26 from gavinmcc/fix-ppv

    Fix ppv
zelomel commented 3 years ago

Same here. The Printed file gives a white page.

I'm using a rm1 with ddvk patch.

gavinmcc commented 3 years ago

I think maybe I see the reason the fix isn't working for you. The release.zip does not appear to have been updated since the code was merged, so you're still using the same code from prior to the fix.

reMarkable: ~/ md5sum printer.arm 
a8afd51a423ba4a36def94de4ab9626e  printer.arm                          <--  the original
reMarkable: ~/ md5sum bin.working/*
a8afd51a423ba4a36def94de4ab9626e  bin.working/printer.arm              <--  the original
312c054c167af022d7d9e70d8852e006  bin.working/printer.arm.updated      <-- the fix I built and patched manually

You can also see:

https://github.com/Evidlo/remarkable_printer/releases/tag/6

" @Evidlo Evidlo released this 14 days ago · 4 commits to master since this release "

@dansbandit - when you say you have the patch applied, did you build the latest source yourself and transfer it over manually?

gavinmcc commented 3 years ago

In the meantime, until @Evidlo makes a release, you can try this temporary release out:

wget -O -  https://raw.githubusercontent.com/gavinmcc/remarkable_printer/temp-release/install.sh | sh

you should still expect to see the filename "printed", but the file should not be blank.

gavinmcc commented 3 years ago

If i put the dummy.content in 4e5cf0c7-c27e-4841-a853-347ff59bc1eb.content and reboot it works but the name is "Printed" again.

I think the name of the file being "Printed" is a separate issue for which we may need a different fix. I've created a separate issue for it.

https://github.com/Evidlo/remarkable_printer/issues/27

dansbandit commented 3 years ago

I think maybe I see the reason the fix isn't working for you. The release.zip does not appear to have been updated since the code was merged, so you're still using the same code from prior to the fix.

My bad! I will keep this in mind next time!