Sharepoint 2010 Create PDF of document in document library - sharepoint

I have a document library in Sharepoint 2010. Is it possible to click on the check boxes next to a document name and convert the documents to pdf? I can't seem to find an option to do this. If not can I programmatically generate the pdf's and add them to the library.

Actually, if you have some programming skills you can create your own EventReceiver for every item added/updated to convert a word document to a PDF. By using Word Automation Services.
check this out:
http://msdn.microsoft.com/en-us/library/office/ff181518.aspx

You'll need a third party product as PDF Conversion doesn't come with SharePoint, unless you count the very basic MS-Word only conversion that is available in some editions of SharePoint 2010.
Have a look at this product, it does exactly what you want, including the checkboxes in SP2010, and can be used via workflows and web service calls as well.
Additional information as well as real world examples can be found here.
Disclaimer, I work for this vendor so it is a shameless plug. Yet it answers your question :-)

Alice,
Or you can use dynamic PDF documents, which can be integrated with Document Library as content types. Have a look at this product: it allows submitting Pdf forms using Adobe Reader (no Reader Extensions are necessary).
Disclaimer: I am using this product and happy with it. It has some limitations but nothing drastic.
Robert

MS Word provides the convert function, you can open the Word document and save as PDF format in the document library.
Also, there are some third-part tools can help you to solve this issue, such as BoostSolutions PDF Converter.

Related

generate multiple pdfs from a database

I would like to generate multiple pdfs at once. Those pdfs should pull data from a database. It can be an excel table or a relational database, doesn't matter, I can create whatever.
Using excel and javascript in adobe acrobat pro I managed to pull data into a template pdf, but for every record (row) I have in excel table I have to manually generate one pdf, then another, and so on.. and there are a lot of records, so I would like to do that automatically if possible.
Is there a way to do that? Any suggestions?
I added an image to better explain it...
Look into the Acrobat SDK, Section: "Interapplication Communication" to learn how you can control Acrobat via VB/VBA and how you can work with the JavaScript Object (JSO).
Then have a look into the "Acrobat JavaScript Scripting reference" and look at
the Doc Object with commands like .. addField and at
the Field object to set the properties of the fields.
That should do what you want, Reinhard
PS: With Open Office you can save spreadsheets as PDF and with newer version of Excel too. Wouldn't that be already enough or perhaps a mix of above and this.
Full disclosure: I founded and run Epsillion Software.
mirta, one option is Epsillion Publisher. We built it for your exact use case.
You would need to specify what your template should look like. The Epsillion team will design it for you.
You then specify what your variables are in a Word document (e.g., name, last name, date of birth). The software will process the Word and Excel files and return PDFs for you.
Templates are flexible and flow as needed.
Hope that helps. Good luck!

Can I Use Microsoft Graph to Convert MSWord Documents to Other Formats?

I want to take a .DOC or .DOCX file and convert it to another file format; e.g. PDF or HTML, etc. I don't have MS Word loaded on the local machine nor do I have an Office 365 account.
Will Microsoft Graph provide a way to do this programmatically, or am I barking up the wrong tree?
Thanks in advance for any insight or ideas!
You can do this in various ways in Office365/Graph:
Do a http GET to the drives API in MS Graph. Example:
GET /drive/items/{item-id}/content?format={format}
This also works for files in SharePoint.
See:
https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_get_content_format
Via the Convert File action in Microsoft Flow. See John Liu's blog on this.
Essential DocIO is an option to consider. The library can convert from Doc and Docx to PDF and doesn't rely on Microsoft Office.
The entire product is available for free with no limitations through the community license if you qualify (less than 1 million US$ in revenue per year).
Note: I work for Syncfusion
Today the Microsoft Graph doesn't provide this functionality, but it's a reasonable request. You might want to raise it over at uservoice here.
Microsoft Graph (https://graph.microsoft.io/) can't be used to convert your .DOC or .DOCX files into another format, especially if you don't have MS Word or Office365. Microsoft Graph is basically 'just' an interface to access your data/objects stored in your Office365 tennant.
Without MS Word your only option (besides third party tooling) to convert would be to use Office Open XML, but even so that wouldn't suit your need as .DOC files are not based on the open XML standard. Also rendering to PDF is also not part of the Office Open XML specifications so you need to find another service to do that if you don't want MS Word to do that for you.
So in short, to answer your question ... no you can't use Microsoft Graph to convert MSWord documents to other formats.

Flexible customization - Generating word document using C#

Problem - Generate a word document from information retrieved from database.
My solution - Create a word document template add fields/tags in places where values need to be inserted. The template will require tables and charts as well. Using document reflector that comes with open office xml sdk reflect on the document template and extract the w:document section and port it to C#. The rest of the logic revolves simply around finding the fields/tags, replacing them, etc. Very simple approach but not very flexible!
Challenge - I want the user to have the ability to customize the template or the generated document output. But this will not be possible if I embed the template logic in code.
Any other possibilities - I looked around at Templating using T4 and RazorEngine but could not find any concrete examples of how to create word documents using these two technologies.
Now what is the best approach?
I would really appreciate your inputs on what is the best and most flexible way to generate word documents using C#.
I'm actually working a project where the business users are designing word template with mail merge fields and we are populating the values using a 3rd party software package Aspose Words. http://www.aspose.com/categories/.net-components/aspose.words-for-.net/default.aspx
The software includes a library for merging data from datatables into the mail merge fields in the word document.
I also wrote a customized word task pane add in that retrieves data views from the database and lists the fields in a drag/drop interface that mimics a crystal or sql report writing interface.
Probably would of been easier to just use crystal or sql reporting though...
It's certainly possible to generate the contents of an Office doc using T4 or Razor and then package it up. The TestScribe powertool for Visual Studio Test Manager does just that with T4. There is a thread by Sally Cavanagh in the Q&A on this page http://visualstudiogallery.msdn.microsoft.com/e79e4a0f-f670-47c2-9b8a-3b6f664bf4ae that suggests a way to look at the T4 templates that it uses, which might get you jump-started.
Here is sample to play word document template with C#
You could use a content control databinding approach.
XML Mapping Task Pane for Word 2007/2010 is an authoring tool.
To create an instance document, you just attach your XML data file.
If the resulting documents will be opened in Word, that is all that is required: Word will bind the data itself. If your consuming application is not Word, you might want to resolve the bindings yourself (eg via Open XML SDK).
Content control databinding isn't intended to support repeats and conditionals. For a way to do that, look at my OpenDoPE convention
Take a look at Templater. Disclamer: I'm the author.
Check out JODReports or Docmosis. They are Java based but some of the templating features and output options might be ideal. You can call the command line interfaces unless they also have something better to reach from C#.

Sharepoint List to PDF report

I have a SharePoint list and I need to transform it into a document (any type) and export it to PDF. Would you have any tips on the best way to do this? I have Crystal Reports but not sure if this is the correct use case for this.
You can programatically access the document library using the object model or via web services.
If you use the object model. You can use the SPContext object to get the current site/list. From there, you can iterate through the items or, you can use a method on the SPList object to turn it into a dataset which you could then use to generate a PDF using some kind of PDF library (e.g. PDF4NET). If you go this route the best way to roll it out is by packaging it up as a feature in a solution file (.WSP) which you can deploy to your farm. In this case the code would be running in the share point environment. You can get pretty fancy with this and have something like a "Print PDF" menu option in the action menu for all lists.
On the other hand, you could also access the list remotely using the web services. In such a case you could just use this as a data provider for your reporting package.
The PDFsharepoint tool (http://www.pdfsharepoint.com) can be used to generate the PDF output. Nice thing about this tool is that you will "design" or "import" a template using WYSIWYG editor and only map the data. Without mess of coding your own PDF generator. It is not free tool though ...
I have had much success using MS-Access for creating PDF reports from SharePoint lists. You can even embed the report as a view in the list. When you select the view, it opens Access for you. Plus you can join multiple lists and even other data from within access.
Access 2007 will save a report as a PDF or you can use a PDF printer adapter such as PDFCreator.
The easiest way to export SharePoint list to pdf is, first export the list as Excel file. Then save the Excel file as Pdf document.
There is a 3rd Party product that automates this.
i-PMO's "SharePoint Data Miner" can be used to create a RS Report across any list data, then use the their SharePoint site Report Viewer and Document publisher to output the report as a PDF into a Document Library.

Sharepoint. SPFile.OpenBinary() returns document with content type metadata

I have a method which downloads sharepoint documents to the local disk. I use SPFile.OpenBinary() method to get physical file, but it contains all fields of a parent DocumentLibrary. Does anybody know how to clear file (doc file) from these fields? I found only way to do it using Word interop library (method described here http://maxim-dikhtyaruk.blogspot.com/2009/05/trim-sharepoints-documents.html), but it doesn't fit my requirements cause it works only when Microsoft Office is installed on the machine...
You may want to read this to understand whats going on.
I do not know if this can be turned off or not, but it happens only with Word 2007 documents (docx).
You could do any of the following to turn this off:
Create a new content type and associate it with a document library. Use this document library from now on.
Look into some Open XML library or the Open XML SDK published by Microsoft.
This isn't a bug, it's supposed to be a feature! :-) Seriously though, you need to edit the Word document programmatically to remove these additional fields completely (I think even a content type will leave some behind).
For documents prior to Word 2007, you could use a toolkit like Aspose. I almost needed to do a similar thing once and would have used this product to do it. I'm sure there are other options out there.
For Word 2007 and higher, as SharePoint Newbie says, you should be able to use the Office Open XML formats to edit the document. Here's an MSDN intro article.

Resources