rmfakecloud icon indicating copy to clipboard operation
rmfakecloud copied to clipboard

Cannot add pages to existing PDFs

Open scarpentier opened this issue 3 years ago • 2 comments

I'm having trouble generating pages from a PDF that has been modified on the remarkable to add new pages.

image

I am under the impression that rmfakecloud cannot handle this kind of scenario as the error message says that it's expecting the same amount of pages as the included PDF (which is not the case after adding pages).

Looking inside the resulting ZIP file, there's a .content file that has a redirectionPageMap array that sounds helpful but I'm just at a loss when trying to figure out which pages are new and which are edited in regards to the contents of the accompanying .rm files.

It looks like this:

"redirectionPageMap": [
        0,    <--- First page of the original PDF
        1,    <--- Second page of the original PDF that has been written on
        -1,   <--- Brand new page between second and third page of the PDF
        2,    <--- Third page of the original PDF 
        -1    <--- Last page is now a new page with notes
    ],

Here's the log of me adding a page to a PDF document then using rmfakecloud's web interface to read the resulting PDF and the zip file in question.

time="2022-09-07T18:40:41Z" level=info msg="[GIN] 2022/09/07 - 18:40:41 | 200 | 231.611µs | 172.17.0.1 | PUT \"/document-storage/json/2/upload/request\""
time="2022-09-07T18:40:41Z" level=debug msg="[storage] uploading with token:eyJhbGciOiJIUzI1NiIsImtpZCI6IjEiLCJ0eXAiOiJKV1QifQ.eyJkb2N1bWVudElkIjoiNmRiN2ZiMDItNjcxOS00YjRlLWFmMTQtYjQ0NDQyZjhmZTI4IiwidXNlcklkIjoic2NhcnBlbnRpZXIiLCJhdWQiOiJzdG9yYWdlIiwiZXhwIjoxNjYyNTc2MzQxfQ.0XT4TOiVpm8g6h-vKynK-qE3_i1Z366HoGdO7P_FM5M"
time="2022-09-07T18:40:41Z" level=debug msg="[storage] uploading documentId: 6db7fb02-6719-4b4e-af14-b44442f8fe28"
time="2022-09-07T18:40:41Z" level=info msg="[GIN] 2022/09/07 - 18:40:41 | 200 | 7.364388ms | 172.17.0.1 | PUT \"/storage/eyJhbGciOiJIUzI1NiIsImtpZCI6IjEiLCJ0eXAiOiJKV1QifQ.eyJkb2N1bWVudElkIjoiNmRiN2ZiMDItNjcxOS00YjRlLWFmMTQtYjQ0NDQyZjhmZTI4IiwidXNlcklkIjoic2NhcnBlbnRpZXIiLCJhdWQiOiJzdG9yYWdlIiwiZXhwIjoxNjYyNTc2MzQxfQ.0XT4TOiVpm8g6h-vKynK-qE3_i1Z366HoGdO7P_FM5M\""
time="2022-09-07T18:40:41Z" level=info msg="[auth-middleware] UserId: scarpentier deviceId: RM110-149-28614 newSync: false"
time="2022-09-07T18:40:41Z" level=info msg="Id: 6db7fb02-6719-4b4e-af14-b44442f8fe28 Name: PDF test"
time="2022-09-07T18:40:41Z" level=info msg="[GIN] 2022/09/07 - 18:40:41 | 200 | 674.205µs | 172.17.0.1 | PUT \"/document-storage/json/2/upload/update-status\""
time="2022-09-07T18:40:41Z" level=info msg="hub: dispatching notification"
time="2022-09-07T18:40:41Z" level=info msg="Broadcast notification, for all devices of uid:scarpentier id 499678df-bb8e-4dbf-a356-fa6b8f5f497e"
time="2022-09-07T18:41:05Z" level=info msg=/documents
time="2022-09-07T18:41:05Z" level=info msg="[GIN] 2022/09/07 - 18:41:05 | 200 | 58.077163ms | 172.17.0.1 | GET \"/documents\""
time="2022-09-07T18:41:06Z" level=info msg="[ui-authmiddleware] User from token: scarpentier"
time="2022-09-07T18:41:06Z" level=info msg="[GIN] 2022/09/07 - 18:41:06 | 200 | 99.655µs | 172.17.0.1 | HEAD \"/ui/api/\""
time="2022-09-07T18:41:06Z" level=info msg="[ui-authmiddleware] User from token: scarpentier"
time="2022-09-07T18:41:06Z" level=info msg="[GIN] 2022/09/07 - 18:41:06 | 200 | 55.360326ms | 172.17.0.1 | GET \"/ui/api/documents\""
time="2022-09-07T18:41:07Z" level=info msg="[ui-authmiddleware] User from token: scarpentier"
time="2022-09-07T18:41:07Z" level=info msg="exporting 6db7fb02-6719-4b4e-af14-b44442f8fe28"
time="2022-09-07T18:41:07Z" level=debug msg="Fullpath: /data/users/scarpentier/6db7fb02-6719-4b4e-af14-b44442f8fe28.zip"
time="2022-09-07T18:41:07Z" level=info msg="generating all pages"
time="2022-09-07T18:41:08Z" level=error msg="invalid page number (page count too short)"

I'd be very grateful if someone could look into this! I add note pages to my documents constantly. Oh and thanks a lot for this nifty piece of software! I cannot overstate how it adds to my remarkable experience 💖

scarpentier avatar Sep 07 '22 19:09 scarpentier

it's using code from rmapi for the pdf generation, should look into it

ddvk avatar Oct 20 '22 06:10 ddvk

just some status, it has to be implemented.

but a new notes format is also coming with 3.0, so i'm trying to implement it first

ddvk avatar Oct 28 '22 15:10 ddvk