BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi all,
I'm trying to use the Pdfviewer and saving from the pdfviewer on a simple pdf without any fields, and every time the pdf is saved the size increased, we want to be able to when saving not increase the size the pdf unless there are some changes on the pdf, is that possible?
This code is the one we use just to save the same file multiples
protected virtual async Task SaveDocumentAsync() { await PdfViewerElement.SaveAsync(FilePath); var filepath = FilePath.Replace(".pdf", "99.pdf"); for (int i = 0; i <= 2; i++) { await PdfViewerElement.SaveAsync(filepath); Task.Delay(100); await PdfViewerElement.LoadAsync(filepath); Task.Delay(100); } //await SaveDocumentSignaturesAsync(FilePath); //await PdfViewerElement.UnloadAsync(); await Task.CompletedTask; }
We were able to reproduce the reported issue “Saving multiple times increases the size of the file” and suspect this to be a defect. We will analyze further on this and update you with more details in Two business days.
In general, downloading the PDF document will increase its size due to the instances stored for the actions performed in the document. The same behavior occurs in Adobe Reader too.
However, to restrict this file size change you can make use of the below code snippet. This highlighted code will skip the changes made in the document on every save operation. This code need to be handled on save operation.
Code Snippet:
byte[] byteArray; |
By setting the incremental update of the file structure to false, you can restrict the incremental file size.
Kindly find the documentation for restricting the incremental file size.
Documentation: https://help.syncfusion.com/file-formats/pdf/working-with-document#performing-incremental-update-for-pdf-document
Kindly try this and let us know if you have any concerns.