After a user uploads a PDF document in our product, we convert that document to XOD. This can take several minutes for a very large document, so we want to show a progress bar to them showing the status of the conversion.
This thread had the same question, but the answer didn't solve the problem for me:
https://groups.google.com/forum/#!searchin/pdfnet-sdk/progress/pdfnet-sdk/ow-9iUmxCts/DPhFNrVRZ1QJ
The example in the answer above shows the bytes that have been converted, but without knowing the total size of the XOD file ahead of time, it isn't helpful in terms of providing a progress bar.
We are using PHP. Here is our code:
<code>
$filter = Convert::ToXod($this->pdfdoc(), $options);
$fReader = new FilterReader($filter);
$buffer = 64 * 1024; //64 KB chunks
$totalBytes = 0;
$fd = fopen("output-file.xod", 'w');
while ($bytesRead = $fReader->Read($buffer)) {
fputs($fd, $bytesRead);
$totalBytes += strlen($bytesRead);
}
fclose($fd);
</code>
Since I don't know the size of $totalBytes until the conversion is done, I can't show a progress bar. Is there a way to get the bytes that have been read (of the original pdf) instead of the bytes written to the XOD file?