asked on April 23, 2021
•
Show version history
Is there a way to create a blurry image from a document using the SDK? A client has a PDF and wants to make a blurry copy of the image pages as a sort of "preview" of the document, where someone then pays to obtain the full-quality version. I thought maybe the "CompressionQuality" property of DocumentExporter would help, but the resulting image pages look exactly the same as the original PDF other than having a watermark applied due to the tag.
DocumentInfo original = Document.GetDocumentInfo(51548, cloudSession);
DocumentExporter de = new DocumentExporter();
de.CompressionQuality = 0;
MemoryStream stream = new MemoryStream();
de.ExportPages(original, original.AllPages, stream);
DocumentImporter di = new DocumentImporter();
FolderInfo parent = Folder.GetFolderInfo(51546, cloudSession);
int resultID = Document.Create(parent, "Result", EntryNameOption.AutoRename, cloudSession);
DocumentInfo result = Document.GetDocumentInfo(resultID, cloudSession);
di.Document = result;
di.ImportImages(stream);
TagInfo tag = Laserfiche.RepositoryAccess.Tag.GetInfo("Blurry Watermark", cloudSession);
result.AssignTag(tag, "");
result.Save();
original.Dispose();
result.Dispose();
0
0