On Aug 23, 2012, at 5:18 AM, pdfjsNewbie wrote:
> I'd like to display a PDF to the user in the browser and give them the capability to do the following:
>
> - rotate a page (e.g. 90 degrees clockwise)
> - delete a page (e.g. remove it from view)
>
> My guess is that there is no way for me to persist these changes on the actual PDF using PDFJS, so I would probably have to make an Ajax call that would call a script that runs something like PDFTK to actually do the rotation and deletion of pages. I just need to know how to rotate and delete the PDF being rendered by PDFJS. Is this the correct approach?
Your guess is correct, there isn't currently a way to save a pdf with pdf.js. You should be able to rotate the viewed pdf with
https://github.com/mozilla/pdf.js/blob/master/src/api.js#L196 . For deleting pages, you should just be able to either hide the pages or not render them. No matter what you do you'll need to hack up our viewer coder or write your own.
>
> I plan to also allow users to reorder the PDF pages and split a PDF document into multiple documents. Again, I assume the same basic approach of trying to get PDFJS to render the changes, then calling some script to effect the actual changes to the file.
>
> Any advice before I get too deep in the wrong direction?
Sounds like a reasonable approach.
Brendan