Prevent PDFsharp from saving an image file?

315 views Asked by At

I have prevented my program from saving images downloaded as files. (They are saved in Image variables instead). However, my application is slowed down significantly because the PDFsharp libraries save the image files anyway before drawing them to the PDF document. This is done deep within a hierarchy of calls by its functions.

Is there a simple fix to get around this?

2

There are 2 answers

0
I liked the old Stack Overflow On BEST ANSWER

JPEG images are simply copied into the PDF file, all other image formats have to be converted to the PDF format. AFAIK PDFsharp does not save the images to the local file system, however they are saved into a memory stream during the conversion.

There is a simple fix to get around this: write a better conversion and submit it to the PDFsharp team.

1
Aaron Hernandez On

I think PDFSharp always need to save first. It cannot handle byte image that will used to import an image. I recently encountered it when I also coded and used pdfsharp. My process is to save an image then import to code in pdfsharp. I have a part that I need to delete all temporary images.