Convert doc to PDF
Hi,
How easy would it be to be able to
convert a word document into a PDF
document during the upload into the library?
Can it be easily integrated within Sitefinity?
----
What I am trying to achieve is to display a Office Document (Word,
Excel, Power Point, etc) inside a Web Browser. In XP was able to do that
but in Windows 7 I can't. Is there a RAD Control that would display
a document embedded in the Browser. I do not want it opening in a separate
window.
Thanks,
Andrei
Hello Andrei,
You can create a custom type that inherits from OpenAccessLibrariesProvider.
Please, make sure that the provider is properly registered inside Sitefinity/Administration/Settings/Advanced/ Libraries/Providers configuration.After you register the provider, please restart the application.
In your custom type you have to override virtual method UploadDataOnly responsible for uploading binary data of media content items(documents, videos and images) and implement your custom logic for converting to .pdf before upload the document.
/// <summary>
/// Uploads only the binary data of an media content item.
/// </summary>
/// <param name="content">The content.</param>
/// <param name="source">The source.</param>
protected
virtual
void
UploadDataOnly(MediaContent content, Stream source)
source.Position = 0;
var buffer =
new
byte
[content.ChunkSize];
int
bytesRead = buffer.Length;
using
(Stream destinaion =
this
.GetContentStream(content))
while
(bytesRead == buffer.Length)
bytesRead = source.Read(buffer, 0, buffer.Length);
if
(bytesRead > 0)
destinaion.Write(buffer, 0, bytesRead);
Thanks Milena,
I will give it a very good think. The desired result would be
to manage to display office documents in browser, but if
that won't work then your solution would be the favourite.
Thanks again,
Andrei