HTML web view for debugging?
Hello,
I'm wondering if it's possible to view the result of changes to HTML/CSS without regenerating a PDF. For instance, if I change a font size setting, is there a way to see a "preview" of that change in a simple HTML/web view before generating the PDF once all styling and positioning is in place? I searched the Forum and could not find any answers.
Thanks!
How about using a browser and hitting refresh?
Could you elaborate? : ) Obviously I know what you mean, but it's not quite that simple: I'm generating PDFs from within a Rails app, so are you suggesting I set up a separate PDF view and then just debug that view until it matches what I want to see in the PDF? When working with the Wicked PDF gem (pre-Prince), I used the built-in debugging view, which was triggered just by passing a debug parameter to a URL. See debugging here, that's what I'm after:
https://github.com/mileszs/wicked_pdf
Yes, you could just send the HTML straight to the browser, instead of passing it to Prince. But I'm not a Rails expert, so I don't know how much work that is to toggle.
Got it, was just curious if there might be an option via Prince. Thx!
I generally do all my publishing inside Chrome, then when I'm happy with it, I copy and paste the DOM to a text file, and go.
That allows me the conforms of interactively tweaking the CSS, and trying out various javascripts - and allows me full use of javascript, without using Princes internal javascript engine.
If you just want a preview, then you can run something like imagemagick to convert the pdf to a png.
thank you for the helpful suggestions. i hadn't thought of imagemagick, that's a good idea too. thx!
My HTML looks different in Chrome than when I run it through Prince and translate to PDF. Is there a way to interactively debug the actual content Prince going to render into a PDF rather than what's rendered by some web browser (e.g. chrome)?
We don't have the equivalent of a DOM inspector yet, unfortunately. What kind of differences are you seeing?
I'm seeing fairly significant differences in layout. I've attached a screenshot of what I'm see and would be happy to follow up with more technical details off the forum if that would be helpful.
- html.png 23.9 kB
- pdf.png 16.6 kB
Tricky, this could be a width issue, as paper is typically narrower than a browser window.