I am trying to implement a feature where i open (suppose in iframe) a PDF file (multiple pages), Highlight a section of the document a get the page number (the one that is displayed in the PDF tool bar).
Eg: if the toolbar display 2/7 which means i am right now in page 2, i need to capture the page number information. Sounds simple but i am not able to get a .dll/function that exposes this property.
Any help would be grateful.Thanks.
I wouldn't think this would be possible, there's no way to control PDFs with JavaScript in the browser, which is what you'd need to do.
This article suggests the same: http://codingforums.com/showthread.php?t=43436.
Content of link:
in short, no, you can't do that.
really don't think JS can read properties of PDFs, since PDFs are viewed in the browser thru a plugin, ie a viewport for another application (for want of a better explanation).
You may be better trying a different route, such as generating the pages as images and implementing your own paging. Depends on your content and requirements, of course. ABCPDF from http://www.websupergoo.com/ is free (with a link-back), not sure if that's any help for you.
Related
I have a functionality where I need to upload a multi-page document. For display purposes, I have to give the user ability to view it page-vise. I have to show no. of pages and then user can navigate back and forth between the pages to view each page.
Any pointers on how this can be accomplished? I am using ASP.Net MVC3 and C# as the language.
Much Thanks!
If by "multi-page document" you mean like a PDF or word doc, then you'll need to embed a 3rd party viewer in your page and have it display. Generally they have the functionality you've mentioned built-in.
On the server that my application is being run on, a virtual PDF printer is being installed (don't know much about this yet, except it's from Adobe), and my application needs to use this 'printer' to create PDF's from HTML pages (a GridView mostly), and then redirect the user to the URL of the where the PDF is stored.
I've been looking at the PrintDocument object in System.Drawing.Printing, however I've read that you can't simply feed this a HTML page. What are my choices? The easiest option would be to be able to 'print' a given HTML page (choosing what and what not to print using CSS), but from what I've read this is fairly difficult, so I'm thinking about somehow constructing whatever object PrintDocument needs programatically, if that makes sense.
Any ideas on how I should do this?
there are some free/cheap libs for creating pdfs on the fly. I've used itextsharp before and it worked pretty well. Takes a bit of time to get up to speed in how it works but I'd suggest checking it out.
There are also printing services like Neevia DocConverter that will monitor a folder and auto convert whatever you put in the folder to a pdf, jpg, etc. you can set it up so that if you drop a url shortcut in the folder it will render the webpage at that url to pdf. it's a bit more of a pain if you want to do realtime rendering but works excellent for generating mass reports in batches that you want to post up to a website or email later.
We are currently developing a Windows Forms application in VS 2008 C#. This application is for reading long (200 - 300 pages) law documents, and it handles about 30 - 40 docs. The application searches in document text, switches between documents, etc.
Our customer has sent the docs in separate *.rtf files for us to "put it into the application". We decided to convert the rtf files into HTML, using the MS Word's "Save as" function, and then selecting "filtered HTML". In this solution, the application can show the documents in a WebBrowser control.
Our problem is: the Customer wants an additional "Pager view" function, where the user can read the documents like it would be a book. He can see the pages on a virtual paper sheet, and then click next page, previous page, etc. Like in the browser's Print preview dialog.
I have searched the internet for any Pager HTML viewer, but I haven't found anything. Could you suggest any solution or component for showing the HTML pages in pager mode?
In last case, we can hold the original rtf files too for Pager View showing. In this case, is there any solution for view RichText files in pager mode? (We want to avoid it, if it's possible.)
Waiting for your answer:
Peter
I don't know of any components that can display HTML in pages, but a couple possible solutions could be:
edit the HTML documents and manually separate them into linked pages (or hidden divs with javascript to hide/unhide divs for navigating)
convert the RTF docs to XPS format and use WPF's DocumentViewer control - but since your app is WinForms, then you'd probably have to do something like this:
http://www.codeproject.com/KB/dialog/WinFormWPFIntegration.aspx
(though someone commented on that page about a memory-leak :S that's something to keep an eye open for...)
Is there any web content editor (like FCKEditor or WMD editor) that allows page layouts (images, tables etc.) like MS Word?
Not quite sure what exactly you ask for regarding page layouts, but telerik has a very feature rich html editor. It's a commercial product though.
Take a look at http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultcs.aspx
TinyMCE is the closest candidate to MSWord... Obviously, being a web interface, it cannot be EXACTLY like Word, but it has a number of word's features.
Both FCK and TinyMCE allow for tables and other layout elements (overall FCK having the better implementation of added elements), and both will allow images that you have a url for.
There is a plug-in for Tiny that allows image uploading, but it is heavy and I think proprietary.
Neither of the above is an inline editor, if that's what you want. Probably the best in that direction currently is TiddlyWiki.
I have been working on my own Mootools based implementation that will allow any webpage to be edited, and has image uploading et al built in. It is currently in Beta, but I can send you a link if that's your goal.
I'm using itextsharp to generate the PDFs, but I need to change some text dynamically.
I know that it's possible to change if there's any AcroField, but my PDF doen's have any of it. It just has some pure texts and I need to change some of them.
Does anyone know how to do it?
Actually, I have a blog post on how to do it! But like IanGilham said, it depends on whether you have control over the original PDF. The basic idea is you setup a form on the page and replace the form fields with the text you want. (You can style the form so it doesn't look like a form)
If you don't have control over the PDF, let me know how to do it!
Here is a link to the full post:
Using a template to programmatically create PDFs with C# and iTextSharp
I haven't used itextsharp, but I have been using PDFNet SDK to explore the content of a large pile of PDFs for localisation over the last few weeks.
I would say that what you require is absolutely achievable, but how difficult it is will depend entirely on how much control you have over the quality of the files. In my case, the files can be constructed from any combination of images, text in any random order, tables, forms, paths, single pixel graphics and scanned pages, some of which are composed from hundreds of smaller images. Let's just say we're having fun with it.
In the PDFTron way of doing things, you would have to implement a viewer (sample available), and add some code over a text selection. Given the complexities of the format, it may be necessary to implement a simple editor in a secondary dialog with the ability to expand the selection to the next line (or whatever other fundamental object is used to make up text). The string could then be edited and applied by copying the entire page of the document into a new page, replacing the selected elements with your new string. You would probably have to do some mathematics to get this to work well though, as just about everything in PDF is located on the page by means of an affine transform.
Good luck. I'm sure there are people on here with some experience of itextsharp and PDF in general.
This question comes up from time to time on the mailing list. The same answer is given time and time again - NO. See this thread for the official answer from the person who created iText.
This question should be a FAQ on the itextsharp tag wiki.