PDF File

+2 votes
Hello,

as far as I could retrieve the infos from other posts it is possible to store a PDF-file (or the content of the PDF-file) in the binary cache respectively in a stream.

But does it mean that you can copy and paste only the raw data of the PDF file in the cache item file?

For instance one PDF file contains besides text also graphical elements like pictures, tables, a certain layout, text formatting etc.

I would like to know if it is possible in general to store the original PDF file 1:1 into that cache respectively in a stream and retrieve the original file as well from it?

If it is possible how can this be realized?

Or is it only possible to copy and paste the raw data so that other file elements would get lost?
asked Feb 11, 2019 by itsme12345

1 Answer

+1 vote

You should publish the full PDF file contents as raw binary data in a stream, and then the blockchain will store all elements in that PDF, including graphics, etc...

The easiest way to do this is to create a binary cache item, then copy the PDF file into the on-disk file for that cache item, then publish the cache item using the APIs using the {"cache":"..."} format.

For retrieval you'll need to use the gettxoutdata command for now, but we'll soon add an API to retrieve data from the blockchain into the binary cache, from where you can directly copy the data out.

answered Feb 12, 2019 by MultiChain
Hello,

thank you for help.

In detail how is it possible to copy the PDF file into the ondisk file for the cache item on
Windows because I just found this Linux-based command in the Getting Started Doc:

head -c 536870912 < /dev/urandom >> ~/.multichain/chain1/cache/A1...

Is the appendbinarycache command the proper command for Windows?

Do I get it right that in this case you have to convert the PDF file in Headecimal format at first
before using the appendbinarycache command like this?

appendbinarycache [name of cache item identifier] [hexadecimal format of the pdf file]
You *don't* need to use appendbinarycache if you're copying in the data via the file system. Instead you need to copy the file to this location on Windows:

%APPDATA%\MultiChain\[chain-name]\cache\[cache-item-name]

Substitute the [square bracketed] items above as appropriate.
...