PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
ComPDFKit supports incremental saving and full saving.
When the document is saved to the original path, the PDF document will be saved incrementally, meaning all changes will be appended to the file. This can significantly speed up the saving process for large files. However, it results in an increase in document size with each save.
When the document is saved to a new path, the PDF document will undergo non-incremental saving. This entails overwriting the entire document instead of appending changes at the end.
This example shows how to save a document by incremental saving and full saving :
myCPDFDocument.WriteToLoadedPath();// Incrementally save the document object to the current path.
myCPDFDocument.WriteToFilePath(newFilePath);// Save the document object to the current path in a non-incremental manner.ComPDFKit supports saving documents to a Stream or byte[] array, making it convenient to process documents in memory or transmit them over the network without relying on the local file system.
This example shows how to save a document to a FileStream:
// Save document to Stream
using (MemoryStream memoryStream = new MemoryStream())
{
bool success = document.WriteToStream(memoryStream);
if (success)
{
// Document has been successfully written to memoryStream
byte[] pdfData = memoryStream.ToArray();
}
}
// Save document to byte[] array
byte[] documentBytes = document.WriteToBytes();
if (documentBytes != null && documentBytes.Length > 0)
{
// Document has been successfully converted to byte array
}