1

Trying to wrap my head around this one.

2 part question...

  1. Is this possible - I am trying to create a HTML page with certain elements editable (class="editme" contentEditable). Once they click save I want to take that page and convert/save it to pdf while preserving the tags, especially the editme tags. Then I want to be able to later load that pdf back into the HTML for editing and as mentioned look for the tags so I can correctly layout the page.

  2. My preference is for JS but are there any libraries or open APIs out there that can help achieve this? I am looking at mozilla/pdf.js and I looked at MrRio/jsPDF which doesn't support css. I'll need layout, styles, and html tag intact.

As noted I used and tested pdf.js. This fails bc it only converts PDF to SVG or Canvas to view not to HTML per se. It also does not do any format to PDF. jsPDF doesn't handle styles(css) so it is dead to me until it does.

RooksStrife
  • 1,647
  • 3
  • 22
  • 54
  • 2
    Rather than apologising for asking a broad question, *don't ask it*. See [ask]. – jonrsharpe Feb 01 '17 at 20:54
  • 3
    I worked with PDF files for years, my advice: don't waste your time trying to do this. – yms Feb 01 '17 at 20:58
  • 2
    What @yms says. This is going to be a *huge* time sink and will always have bugs and side effects, to the point that what you want to do may turn out not to be feasible in the end even if you get it working. – Pekka Feb 01 '17 at 20:59
  • @yms Thanks for the advice. I am vetting this process for a client and I have the same sentiments. I just want to make sure I am not missing something. – RooksStrife Feb 01 '17 at 20:59
  • 1
    I have an idea, maybe it will give you a starting point. How about this - when you first convert the HTML to PDF, generate a checksum of the resulting PDF file and store the HTML used to generate it in a database. When you load the PDF back in, instead of trying to convert that PDF to HTML, just check if the checksum matches the one in the database and if it does, load the HTML from the database. – Cave Johnson Feb 01 '17 at 21:10
  • @KodosJohnson that does not sound too bad – yms Feb 01 '17 at 21:18

0 Answers0