creating a pdf editor like application in c# - c#-4.0

I want to create a desktop application, whose functioning is as follows :
1. user opens a pdf file in the form
2. then, it gets opened up on the UI. After that, user performs certain editing using mouse
like drawing a rectangle, crossing a certain region (similar to paint)
3. Then, after doing all the editing, he saves that file into another pdf (edited one)
I am doing it in c#. Can you suggest, how to do it ?

This may get handy,
How to write a PDF editor?
iText ® is a library that allows you to create and manipulate PDF documents. It enables developers looking to enhance web- and other applications with dynamic PDF document generation and/or manipulation.
Developers can use iText to:
Serve PDF to a browser
Generate dynamic documents from XML files or databases
Use PDF's many interactive features
Add bookmarks, page numbers, watermarks, etc.
Split, concatenate, and manipulate PDF pages
Automate filling out of PDF forms
Add digital signatures to a PDF file
iText is available in Java as well as in C#.
PDFsharp is the Open Source library that easily creates PDF documents from any .NET language.
The same drawing routines can be used to create PDF documents, draw on the screen, or send output to any printer.
It can use either GDI+ or WPF.
It includes support for Unicode in PDF files.
It also includes MigraDoc Foundation which brings you all the high-level functionality not included in PDFsharp.

Related

Disable copy function in PDFTRON for Android

Is it possible to disable the copy option of the lib when selecting a text in the PDF using the PDFTron lib for Android?
I tried to search for the string, but also have not found it.
If you are using one of the mobile SDK's, or using our PDFViewWPF control for .Net 4+, then this is possible by modifying the tools code that is provided. There will one or two text selection tools, for which you can just comment out. Plus you would want to disable ctrl-c, and right click and select copy abilities. Exact code changes depends on platform. If you are using our older C++ PDFViewCtrl class this is harder to do, but I suspect you are not on this anyway.
Be aware though, there is no real way to prevent a user from extracting text from a PDF, since they can always open it in another PDF viewer and do it there.
See this form post for more info, including how to scramble the unicode values of text.
https://groups.google.com/forum/#!searchin/pdfnet-sdk/disable$20text/pdfnet-sdk/luWQmyhRDTw/z7UIGuu9uYkJ
Note, you will probably be interested in the PDFTron WebViewer technology, which provides much greater control over content. In particular, the original PDF file is never exposed to anyone for download. You can also encrypt the XOD file, so it cannot be opened in an XPS viewer, and you have full control over the UI, including disabling text search/extraction.
https://www.pdftron.com/webviewer/showcase/
https://www.pdftron.com/webviewer/index.html

Inserting a PDF file as a resource, and displaying the pages?

I am using Visual C++, MFC, and would like to:
(a) Load a pdf file as a resource
(b) Display this file, and be able to move through the pdf file.
The reason why I would like to load the pdf as a resource, is that I do not want the User to be able to download the pdf file (at least not easily).
Can someone please help me?
All the best
Alex
You don't need to use ActiveX to accomplish what you want. Adding a custom binary resource to the resource file should be sufficient. This had been asked here and here.
As far as I know there are a couple of PDF OCX/ActiveX controls that allow you to view PDF files.
From Adobe itself there is an ActiveX COM Control. You should be able to add it into your toolbox and to drag it on a MFC dialog.
Also I found an older article on CodeProject

Viewing Word Documents inside Browsers

I'm searching for some kind of Programm / Java Applet / ActiveX Control or magic spell to view Word / Excel Documents inside Browsers (Browser independent would be the best case, but IE only ist just fine).
I don't want to open Word itsself inside a frame, because that gives users the false impression that they can edit and save the document i just want to display its contents.
I also found solutions which converts the word document to pdf first, but i can't do this due to some security restrictions on the environment i'm working on.
This can help when those proprietary file formats can first be converted to ODF (for example by LibreOffice/OpenOffice.org): http://webodf.org/
(I will not comment on "security restrictions" and using Microsoft software ...)

MFC Application in VC++

I have developed a desktop application using MFC, which has FILE, EDIT, VIEW and HELP options,along with one pen to write on the opened document which saves as test1. It is allowing me to open only test1 or test2 etc. Apart from these types of files, if i want to open PPTs or PDFs how can i do it?
The code to open a file is autogenerated by Visual Studio 2008. Now i need to modify the same.
This is something Microsoft doesn't provide any Wizards to do (at least not directly). The basic idea is that you have to create and add new document and view classes for the new file types. Then you need to add document strings to the string table to describe the association between the file extensions and the document/view classes. Then you register each document/view pair in the app class using the strings you added to the string table.
By far the easiest way to do this is to generate the document, view, and string in another (otherwise throwaway) application, grab the document, view, registration string and registration code from that application and put them into your application. Then generate another throwaway application for the next file extension.
That gives you a skeleton doc/view for each file extension. From there, it's up to you to write the code to actually open, display, edit, save, etc., that type of file. That's not going to be trivial for either PDF or (especially) PPT -- unless you "delegate" and use something like an ActiveX control to do the real work. If you want to do that, the Adobe ActiveX control works reasonably well (somewhat limited capabilities, but it'll show up essentially the same as a PDF in a web browser). Offhand I don't remember whether MS provides an ActiveX control for viewing PPT files. There is a free PPT viewer, but if memory serves it's an executable, rather than a control.

Can you do complex editing of Word Documents in a browser?

A friend of mine wants to have an application where people can upload documents in Word (or text) format, and then allow people to make edits to those documents within a browser.
Is there any mechanism that would support adding text "bubbles" for adding comments? Either floating, or off to the side.
Being able to save back to Word format is a must too. Or at least, some format supported by Word, that would still be editable. Saving it as an image is not acceptable.
I was thinking about opening the Word Document in an FCK Editor window, but FCK only seems to have "normal" inline text editing capabilities (although it is great).
Is this feasible?
Yes it is feasible. Google has done that (and it does have comments). So has Adobe. I'm sure there is more.
Xopus provides a programmable platform that allows you to define editable XML within a WYSIWYG environment. You could use it to define what you want to edit (XML), against which rules you want to edit it (an XSD) and how you want it to look while you edit it (XSL). Then you tie that all together with the Javascript API.
In other words, you could pretty easily define a document that contains multiple paragraphs with optional comments and then have them displayed as bubbles exactly the way you want them; when saved, a script on the server could be executed that converts the XML to a Word document.
Take a look at the demos.
If they are Word 2007 documents, you can use Silverlight. Here's an example application that uses Silverlight to open a Word 2007 document and display it in the browser.
Since StackOverflow is a programmer site, I'll assume you're a programmer. You can use Silverlight to add the bubbles and annotations to a Word 2007 document, but you'll need to know VB.NET or C#.
Take a look at docx2web.appspot.com which is (currently) a very bare bones editor with the distinguishing feature that the browser is directly manipulating (more or less) the "flat OPC" version of the docx.
This means that there is no lossy conversion on either the way in or the way out. So for example, when you save after editing, anything which was in the original docx is round tripped back to Word.
As far as support for older .doc is concerned, POI can be used to convert them to .docx (although your mileage may vary).
Why are you trying to compete with google docs?
I know that TinyMCE provides some rich controls for in browser editing. Last time i looked at it, it had 100% of the stuff i would normally use in word, and then some. On the other hand, i probably has 1% of the features that MS word provides. It would be VERY difficult to implement it all.
As far as saving to MS word compatible format. i am sure its possible. it would probably be easier to save to a non-doc format.
As far as popups etc, those can be easy built using jquery UI or any other javascript framework.
Bottom line: yes, its possible, but why?!
It is possible. For example eyeOS has a text processing application able to open and process Microsoft Office and OpenOffice.org text documents.

Resources