Render to PDF from stream

Hi,

is it possible to render pdf-file from stream?

This is my example how it can to work.
But i can`t get GUID as string and FileContainer expect a guid as string.
public static Stream RenderDocumentAsPDF(Stream DocumentName)
{
Utilities.ApplyLicense();
ViewerImageHandler imageHandler = new ViewerImageHandler(Utilities.GetConfigurations());

PdfFileOptions options = new PdfFileOptions();
Stream guid = DocumentName;
FileContainer container = imageHandler.GetPdfFile(DocumentName, guid, options);
String filename = Path.GetFileNameWithoutExtension(DocumentName.ToString()) + “.pdf”;
Utilities.SaveFile(filename, container.Stream);
return container.Stream;
}


Hi there,


Thanks for posting your issue.

Yes, GroupDocs.Viewer for .NET also provides overloaded GetPdfFile() methods which accept File Stream without using string guid. You can use any of the following methods.

imageHandler.GetPdfFile(Stream s, PdfFileOptions options)
imageHandler.GetPdfFile(Stream s)

Please try and share your feedback.

Warm Regards

Hi,


without guid its works.
But I get more than one file from server and without guid I dont hava a document that is unique. The result without guid is that alle the file will be overwritten.

Hi there,


To accomplish this, you can use unique guid generated by GroupDocs.Viewer API. You can get this guid using following method.

DocumentInfoContainer info = htmlHandler.GetDocumentInfo(stream);
string guid = info.Guid;

Try this and share you feedback.

Have a nice weekend ahead.