Please give a brief summary of your issue:
(Think of this as an email subject)
How to directly convert a pdf to an svg into a byte [] instead of transitioning through a file
Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
Please provide a link to a minimal sample where the issue is reproducible:
Currently there is no such API, since by default the PDF to SVG generation results in multiple different files, which cannot be reliably represented in a single memory buffer.
Why is SVG important to you?
Why exactly is writing to disk an issue for you?
However, when choosing to embed text and images, you can only generate SVG files. Moreover, I need to convert the generated SVG into byte[] and upload it to S3, instead of generating the file locally, then find a way to upload the local file to S3, and finally delete the local file after the upload is successful, which will reduce the efficiency.
So I can achieve what I want to do?Thanks
I agree with all the approaches suggested:
Using specialized libraries is a great solution.
Working directly with bytes in memory is faster.
RAM disk is a good temporary solution to improve performance.
To work with files safely, you not only need to optimize read and write processes, but also protect data. I recently researched cybersecurity solutions (https://andersenlab.com/services/managed-soc-as-a-service) and realized that modern approaches to security monitoring are very important when working with files.
If interested, I can tell you how to safely read SVG files using modern data protection techniques.