Inkplate 6PLUS display PDF on screen

Customer:

I want to use the Inkplate 6PLUS to display PDF files (some are multi-page) on the screen. I can only find jpg/bmp samples at this time. How can I get this working?

Originally submitted via email support on 21 November 2023. Migrated to the forum for community visibility.

Soldered Support:

There’s no official Inkplate support for PDFs, but the closest solution I found was this project which uses Inkplate to read ePubs: GitHub - turgu1/EPub-InkPlate: An EPub Reader for the ESP32 based InkPlate e-Ink devices. · GitHub

It’s not written by us, so I can’t guarantee it’ll work flawlessly, but people seem to be using it OK. You could convert your PDF to ePub and try this.

The main challenge is working with a .pdf file on ESP32, decoding it and rendering it. Here are some alternative approaches:

  • Pre-render the pages to images. This would be simpler since support for images is built-in. You could do this on a server and then just fetch the images to Inkplate.
  • If you only care about text and not images, convert the PDFs to raw text and display that on Inkplate.

Customer:

One issue remains: when I upload my sample program using PlatformIO, the display is not updated. When uploading using Arduino IDE it works. I think it has to do with the two 6PLUS versions. Do you have the correct settings for the v2 version?

Attachment omitted in migration: smime.p7s

Attachment omitted in migration: image001.jpg

Soldered Support:

For your version of Inkplate, you likely need to use the “Soldered Inkplate6PLUS” board definition and not the “e-radionica Inkplate6PLUS”. The two board definition versions differ in how the board works with different GPIO expanders and it has to match your Inkplate for the display to update. If it doesn’t work on one, it’ll work on the other. Uploading the wrong board definition won’t damage anything.

To check if your Inkplate works well, upload the basic black and white example from Arduino IDE. If that one works with the selected board definition, that’s the one you should be using.

As for IDEs, we mainly use VSCode with the Arduino extension. It works well with Inkplate and CTRL+Click works well to see details within any libraries. This is what I’d recommend. For PlatformIO, we don’t officially support it and the version of the Inkplate board definitions and/or library they have may be outdated.

Some tips for VSCode+Arduino:

  • In the .vscode folder, in arduino.json, add “output”: “./build” as one of the options to save time compiling
  • In the Arduino extension settings, turn off Analyze on open and analyze on settings change (it gets annoying having to compile every time you save)
  • Create a project in Arduino IDE, save it to a location and then open that folder in VSCode and work from there. This ensures your initial setup is good. In VSCode, initialize the folder as an Arduino project by running “>Arduino: Initialize” from the command palette.

Customer:

I’m switching to VSCode + Arduino extension. I’m currently setting up and need help with partition scheme settings. Can you comment on the different options? I can’t find any documentation about this.

Attachment omitted in migration: image001.png

Attachment omitted in migration: smime.p7s

Attachment omitted in migration: ~WRD0002.jpg

Soldered Support:

I use the default setting for that. This is for when you need special settings related to memory, but for 90% of applications the default setting is enough.

The ESP32’s partition scheme settings determine how the device’s flash memory is allocated for various purposes. Different partition schemes are used depending on the size of the application, the need for file storage, and the total available flash memory. You would change this setting when you need more space for your application code, or when you need different or more file storage capacity. The choice depends on the requirements of your specific project, such as the size of the application, the need for file storage, and the total flash memory available on your ESP32 module.

I haven’t used any other setting than the default one for Inkplate. Same goes for the other settings—they are there just in case advanced users might need them.

Customer:

What is your default setting? Mine is the “Huge APP” one, but I would expect one of the “Default 4MB” ones to be the default?

Attachment omitted in migration: smime.p7s

Attachment omitted in migration: ~WRD0003.jpg

Soldered Support:

It’s the Huge APP setting, the one you have selected.

Customer:

I discovered the sketch name needs to be the same name as the project folder. I now have an almost working dev environment. When I verify the sketch, the library not found errors are gone. The only error on verify is:

Verifying sketch 'DigitaalMarsboekje.ino'
Please see the build logs in output path: d:\Documents\Arduino\DigitaalMarsboekje\build
In file included from C:\Users\[user]\AppData\Local\Arduino15\packages\Inkplate_Boards\hardware\esp32\7.1.0\libraries\SPIFFS\src/SPIFFS.h:17,
from D:\Documents\Arduino\libraries\Painless_Mesh\src/painlessmesh/ota.hpp:12,
from D:\Documents\Arduino\libraries\Painless_Mesh\src/painlessmesh/mesh.hpp:12,
from D:\Documents\Arduino\libraries\Painless_Mesh\src/painlessMeshSTA.h:6,
from D:\Documents\Arduino\libraries\Painless_Mesh\src/painlessMesh.h:20,
from D:\Documents\Arduino\DigitaalMarsboekje\DigitaalMarsboekje.ino:3:
C:\Users\[user]\AppData\Local\Arduino15\packages\Inkplate_Boards\hardware\esp32\7.1.0\libraries\FS\src/FS.h:120:11: error: 'class fs::File' conflicts with a previous declaration
using fs::File;
^~~~
In file included from d:\documents\arduino\libraries\inkplatelibrary\src\libs\sdfat\FatLib/FatLib.h:27,
from d:\documents\arduino\libraries\inkplatelibrary\src\libs\sdfat\sdfat.h:33,
from D:\Documents\Arduino\libraries\InkplateLibrary\src/include/Image.h:23,
from D:\Documents\Arduino\libraries\InkplateLibrary\src/include/Graphics.h:24,
from D:\Documents\Arduino\libraries\InkplateLibrary\src/Inkplate.h:26,
from D:\Documents\Arduino\DigitaalMarsboekje\DigitaalMarsboekje.ino:1:
d:\documents\arduino\libraries\inkplatelibrary\src\libs\sdfat\FatLib/ArduinoFiles.h:122:7: note: previous declaration 'class File'
class File : public FatFile, public Stream {
^~~~
Error during build: exit status 1

My libraries included are:

#include <Inkplate.h>
#include <painlessMesh.h>
#include <sdfat.h>

I think you know why this happens?

Attachment omitted in migration: image001.png

Attachment omitted in migration: smime.p7s

Attachment omitted in migration: image002.jpg

Soldered Support:

The VSCode Arduino extension will automatically look for libraries in the “My Documents / Arduino / libraries” folder, so you can install the library via the traditional Arduino IDE and then include it via just “#include "inkplate.h"”. And yes, the sketch needs to be the same name as the project folder.

As for the conflict, you don’t need to actually include sdfat.h as it’s already in the Inkplate library. I think this is the source of your conflict. My recommendation for the cleanest development environment would be to do the following:

  • Install the traditional Arduino IDE in case you don’t already have it
  • Using Arduino IDE, install the required board definitions and libraries you want to use in your project
  • Create a new working directory, for example a folder called my_project
  • In that folder, make a sketch called my_project.ino (it has to have the same name)
  • Open this folder in VSCode and initialize the Arduino extension on my_project.ino. Then you will be able to include in the sketch all the libraries you installed via the traditional Arduino IDE and develop everything from within VSCode

I know it’s a bit convoluted how it works (combining VSCode and Arduino IDE as sort of a package manager) but I use this every day and it works pretty well.

Also, ‘verifying’ a sketch is the same as compiling it (checking if it will compile). I hope you added the ‘output’: ‘build’ flag I mentioned earlier as it will save time when compiling for Inkplate. You might have noticed it takes a while.