How to make marks on pdfs texts and add comments to it? - pdf

I’m developing a system with php to essay’s correction. The student sends an essay in pdf and I have to make, someway, marks on this text to add comments (corrections) in it. For example, mark/select a paragraph and comment something about it. When the user click or pass de mouse up on the mark on the text, the respective comment/correction will be showed. My difficulty is to make the marks/selections on the pdf’s text and map this to add the comments and corrections. Has someone any idea of how this could be implemented?

Oh, that's a tought question boy. I faced the same problem months ago until I found a library called Fabric.js. It will help you to add annotacions and whatever you want over an image file. What about pdf? There is a similar solution which uses that same fabricjs as its core. Check it out: https://github.com/RavishaHesh/PDFJsAnnotations

Related

How to edit Contents in pdf in edge

Actually I got a pdf file today and it's contents are a mess, and the file is way too huge to go through page-by-page to find the required data, is there anyway I can edit the content like:
Chapter - 1
Be sure to check this page!
remember this point!
or even like the following would work:
Chapter - 1
Chapter - 2
please help me out
Do you mean you want to edit the title of the contents highlighted in the picture below?
If yes, it is not possible to edit those contents for a PDF file using the Edge browser.
We can only use the options mentioned in the picture below to draw or highlight something on the PDF file. We can use an eraser to remove the drew or highlighted part. [Note: We cant use these options for the table of contents.]
Reference: Table of contents
I've got the solution for anyone having the same problem as mine, to edit, merge, or split pdfs anyone can consider using 'Wondershare PDFelement' it's a really cool app with tons of features that I found out while searching for solutions for my problem. The app has a really cool interface and you can add, edit or delete bookmarks and save the changes. The free version has limited features and also leaves a watermark but I am ok with it, however you can always buy the pro version.
Thanks.

Create variants of a document with corresponding labels for AI training

I am looking for an easy solution for the following problem:
I have to create variants of a document and export them as an image. This could be easily done with the MS Word Mail Merge, but I need the pixel positions of every text block in that document. The image as well as the pixel positions are input for an AI training.
At the moment I can think of several approaches:
Throw the MS Word Mail Merge output into an OCR and try to identify the positions of the text blocks by comparing them with the original text source.
Create the document with something like JS, Python or Visual Basic and save the exact positions of each inserted text block at the time of inserting.
Maybe use Visual Basic for Word to extract the text positions from the MS Word XML file that was created with the Mail Merge function.
Variant 1 seems to be overly complicated because it uses some kind of reverse engineering. Additionally, using an OCR even on a perfectly readible document can always be a source of error.
So variants 2 or 3 seem fine, but I don't know any libraries that fit the requirements and Visual Basic for Word is absolutely new territory for me.
I hope I described the problem well enough. If you want me to clarify something, please let me know.
I appreciate every idea and help! :)
Best Regards
Henrik
Seems like someone already dislikes my post. Please let me know how I can improve before voting me down..
Anyway, I may have found a way to realize variant 2. This stackoverflow post references a Github Gist that extends the Python Image Library. It offers a function to write text on an image and also set a maximum width for the text box. The function also returns the final width and height of the drawn text box. Using this I will try to implement an algorithm that creates the document images as well as the label files.
Maybe this will also help someone else looking for the same thing.

How to extract pages without comments in acrobat pro 10

I have been searching for this in many places. Tried PDFSam but not working for me in this situation. I would like to extract pages without comments or sticky notes or pencil mark in Acrobat as a separate pdf to check why these pages were not commented on. I am not a coder, but I have a little Javascript knowledge and I have never written a JS code for Acrobat. Kindly guide me in the right direction to write this javascript code.
Thank you for your help!
an easy way to get around this is, you can extract the pages you want. And then delete all the comments.
This 2-step way helps solve your problem.
Note that you don't want to delete the comments one by one.
You click the comments button usually sitting on the lower left corner, which will show all the comments on the left pane. Click any one of it, and hit Ctrl+A and then hit Delete key on your key board. Save and you are done.
It saves you the pain you may get from writing a JS code.
Hope this helps!

VBA - validating slide against master theme

We have a list of power point template with master slide themes and we distribute this it to all our users, everything works fine if they use they use the theme and they don't change any font, font size or color. But the problem is if they change the font, font size etc, how do we know which shape or text the user changed, basically need to validate the slide against master slide theme.
The problem with your question is that you haven't indicated what you've tried, or where you've looked for an answer. That's why you would have attracted a downvote. (Wasn't me, incidentally, but I've seen that happen before.)
When you're asking a question it's also important to pay close attention to the suggested topics which will update as you type; more than once I've spent time searching for an answer, have given up and was about to ask a question here, and then found exactly what I was looking for in the suggested answers meaning that I didn't have to ask at all. In this case it would be worth checking out the suggested answer:
How to detect Theme fonts in Powerpoint 2007 VBA?
which may not give you exactly what you want, but will give you a place to start.

Programatically extract content of PowerPoint slides into MS Word-like format?

I'd like to extract all of the information (formatted text, images, etc) from powerpoint slides into a flowing, readable (MS Word-style) format.
I'm not interested in keeping the slide concept at all--think of taking class slides from a college course and batch converting them all into one collective study guide.
I can't find a way to do this within powerpoint (though if you know of one, please share!) and,
I don't have experience scripting Office apps. Is this kind of thing easily done? Does this kind of script already exist somewhere?
Clarification:
In an earlier version of this post, I used the word "flowing" to refer to a slide-free (MS Word-like) format. This does not, however, refer to the actual formatting of slide content. So keeping bullet lists, etc. is fine and even desirable.
I don't see this being a simple task. College professors use a format of either "TITLE: BULLET POINTS OR IMAGE" or "EVERY WORD I'M ABOUT TO SAY" for their slides in my experience, and you're just not going to get flowing, readable text from the former no matter what you do. For the latter, you've already got your text, you just have to copy it to another document.
I think you might as well just open the PowerPoint, select all the text, and copy+paste into Word/Publisher/InDesign/your favorite page layout program. You'll have the same effect and the same amount of editing after the fact except without all the hassle of writing a program to do it for you.
Doing a Print operation to a PDF with the N-up options might be a good solution for handouts if that's all you need. You could expand the idea and condense ALL the slide decks into one, get it printed (with N slides per page and the note space next to it) and bound, and voila, instant study guide. I've seen that, and then you get options for note taking.
More power to you if you're doing this just because you can - don't let me stop you. There is much good learning to be had that way. You might want to look into writing a program using the Microsoft.Office.Interop namespace in .NET (starting at http://msdn.microsoft.com/en-us/library/bb772069.aspx ), or perhaps look on CPAN ( http://search.cpan.org/search?mode=all&query=powerpoint ) and do it with Perl! There are lots of ways to do it, but you've got to be up for the challenge.
Text is fairly simple to extract, but what text do you want? The text from the title and body text placeholders only? File, Save As, and choose to save the outline.
The other text on the slide? That can be pulled out to a text file programmatically, but in what order? Suppose you have a complex diagram with text callouts. Extracting the text is going to give you gibberish. There's no obvious/meaningful order to the text other than what the human viewer supplies by noting that "Ah. The arrow next to this bit of text points to the fribulator sub-assembly, so must relate to it in some way." Try doing that in code. ;-)
You could give the author a way to sort the text into reading order so that the code knows what order to extract it in, but that would require a fair amount of work on the part of the author.
If you can be certain that all of the content is in title+bullet form, no worries. Otherwise, you'd have to be able to articulate exactly what you want extracted, in what form and in what order before you could get anywhere with this.
MS Word-style is not only readable, but writeable as well (which was not specified in your requirements). If you want a read-only guide, PDF is your natural choice (either through Acrobat Distiller or LibreOffice). Combine individual Acrobatted presentations with PDFtk, or Acrobat or Foxit and you're good to go without any programming at all.
"Is this kind of thing easily done?" - Yes, your humble servant did a couple of similar scripts ages ago (extracting enhanced metafiles from Powerpoint slides).
"Does this kind of script already exist somewhere?" - Yes. Probably at hundreds of places, but not sure if any of them get posted to the 'Net. All things considered think you'd be better off learning some scripting and macro programming on your own, since a ready-made script may be not quite fit for your needs - and to understand and rewrite it you'd need more time than to code & debug from scratch.
Since you mention that title+bullet form is ok, open the file, choose to save as and pick Outline as the save-as type.
I think you could parse through the PowerPoint file for formatting, text and pictures. There are Visual Studio namespaces available for such a task. You open the file, parse through it and make Word file from these. Complicated work, as you would have to consider type of elements and their position, you would have to use a temporary structure for each slide.
Have a look at this sample code :
http://msdn.microsoft.com/en-us/library/office/gg278331.aspx
How to: Get All the Text in All Slides in a Presentation
Basically, using c# and openXML SDK 2.0, it loops through all the slides in the presentation, and then adds each text in every slide into a string builder. You can write out the result into a text file if you like (modification required).
Recommendation: <25 oct 2012>
For your study guide, maybe you could extract all the text in each slide, and dump those text programmatically (by adding that function into the sample code above while it's iterating the slides) into the "Notes" section of each slide. With that, you can print it in Notes Page view. You'll get the entire slide image at the top half of the page, and the actual slide texts at the bottom of it in the Notes Page view. It sure beats trying to copy and paste all the text from the slide into the notes section. You can even print it 2 slides per page, as small text would not be an issue inside the slide's image, and diagrams would still be visible more or less.
Unfortunatly, this method works for simple standard slide format ... meaning, it's OK if your slides just have a title, and a center text box with all the bullet points... any complex slide layout (maybe text boxes scattered everywhere) will come out in non-order and will be confusing. But at least you can still look at the slide image above to make sense of it :)