Is it possible to read/open PDF-Content directly from memory instead from file ?
I would like to save the pdf file into a database an then load it directly into memory in order to open it with default pdf reader.
At the moment I save the PDF file to a temporary file before opening it with RunProgram(...).
Perhaps the same procedure could also be used to display images...
Thx in advance.
Possible to read a PDF file directly from memory?
Possible to read a PDF file directly from memory?
Last edited by flashbob on Tue Oct 15, 2024 9:56 am, edited 1 time in total.
Re: Possible to read a PDF file directly from memory
If you need an external tool to open your pdf, you need to write it to a file, unless I misunderstood your question.
Re: Possible to read a PDF file directly from memory?
If you use pdfium to render the document, then you can use:
Code: Select all
;// Function: FPDF_LoadMemDocument
;// Open and load a PDF document from memory.
;// Parameters:
;// data_buf - Pointer to a buffer containing the PDF document.
;// size - Number of bytes in the PDF document.
;// password - A string used as the password for the PDF file.
;// If no password is needed, empty or NULL can be used.
;// Return value:
;// A handle to the loaded document, or NULL on failure.
;// Comments:
;// The memory buffer must remain valid when the document is open.
;// The loaded document can be closed by FPDF_CloseDocument.
;// If this function fails, you can use FPDF_GetLastError() to retrieve
;// the reason why it failed.
Prototype FPDF_LoadMemDocument(*data_buf, size, password.p-unicode);
Re: Possible to read a PDF file directly from memory?
Thanks for the info, but I don't want to use additional libs at the moment...