Please give a brief summary of your issue:
Is there any way to use SaveViewerOptimized to save to a stream/buffer using PDFTron SDK in .Net C# like the method used in node-js SaveViewerOptimizedBuffer? Or are there any workarounds to avoid using the filesystem? The SaveViewerOptimized() method only accepts a file path as output.
@kmirsalehi Thanks. Can you give me a quick example of how to use it on a doc?
I forgot to mention I’m using .net 6.
I will add a sample code I’m testing on maybe there is something I missed.
I was thinking that it works the same way as the Save method returning a byte.
Ex: byte saveBuf = doc.Save(SDFDoc.SaveOptions.e_linearized);
But in the sample below I only have the void method accessible with 2 parameters : a path and ViewerOptimizedOptions but nothing that returns a byte when I try to invoke only with 1 argument the opts.
using (PDFDoc doc = new PDFDoc(inputStream))
var optimizerOptions = new ViewerOptimizedOptions();
// A number from 0 (include all thumbnails) to 100
// (include only the first thumbnail). The default value is 50.
// The maximum allowed length for the thumbnail's height/width.
// The default thumbnail size is 1024.
byte buf = doc.SaveViewerOptimized(optimizerOptions);
linearizedOutputStream = new MemoryStream(buf);