How to create Prince PDF without page breaks? - princexml

Is it possible to direct Prince XML to convert from HTML and create an output file with no page breaks at all, a PDF file that is just one continuous page?

manually specify a very tall paper size, like this:
#page
{
size: 210mm 1485mm
}

Related

How create characters emplacements in a HTML form?

Hello,I want to create a HTML form to create a pdf file.
My problem : I don't find how create the boxes for the characters emplacements (see the following screen shot of an exemple of a pdf file)
It's just | and _ or image or an existing html element ?
Thanks,
Thomas
These should be regular form input elements (most propably of type text) as they're going to be filled by the user.
They won't look the same as in this image though by default (they'll look better), you'll need to style them accordingly.

HTML file to screenshot as .jpg or other image

Nothing to do with rendering an individual image on a webpage. Goal is to render the entire webpage save that as a screenshot. Want to show a thumbnail of an HTML file to the user. The HTML file I will be screenshotting will be an HTML part in a MIME email message - ideally I would like to snapshot the entire MIME file but if I can do this to an HTML file I'll be in good shape.
An API would be ideal but an executable is also good.
You need html2ps, and convert from the package ImageMagick:
html2ps index.html index.ps
convert index.ps index.png
The second program produces one png per page for a long html-page - the page layout was done by by html2ps.
I found a program evince-thumbnailer, which was reported as:
apropos postscript | grep -i png
evince-thumbnailer (1) - create png thumbnails from PostScript and PDF documents
but it didn't work on an simple, first test.
If you like to combine multiple pages to a larger image, convert will help you surely.
Now I see, that convert operates on html directly, so
convert index.html index.png
shall work too. I don't see a difference in the output, and the size of the images is nearly identical.
If you have a multipart mime-type email, you typically have a mail header, maybe some pre-html-text, the html and maybe attachments.
You can extract the html and format it seperately - but rendering it embedded might not be that easy.
Here is a file I tested, which was from Apr. 14, so I extract the one mail from the mailfolder:
sed -n "/From - Sat Apr 14/,/From -/p" /home/stefan/.mozilla-thunderbird/k2jbztqu.default/Mail/Local\ Folders-1/Archives.sbd/sample | \
sed -n '/<html>/,/<\/html>/p' | wkhtmltopdf - - > sample.pdf
then I extract just the html-part of that.
wkhtmltopdf needs - - for reading stdin/writing to stdout. The PDF is rendered, but I don't know how to integrate it into your workflow.
You can replace wkhtml ... with
convert - sample.jpg
I'm going with wkhtmltoimage. This worked once correctly set up xvfb. The postscript suggestion did not render correctly and we need img not pdf.

How to achieve Page numbering Chapter/Section wise in PDF creation using WKHTMLTOPDF PDF engine

I am trying to generate a PDF book using WKHTMLTOPDF for Linux and lunching through a Perl program. I am passing multiple html files with cover page and footer info through html file to WKHTMLTOPDF command line. While printing as PDF WKHTMLTOPDF treats each file as one section/chapter. I can achieve the page numbering on full PDF through variables using Javascript given in footer html. But I want to print the page number of the current chapter/section is in processing and also total no of pages in that chapter/section. Actually it should reset the page number counter after printing chapter/section. This info can be useful to show the total no of pages in each section and page numbering section wise.
Can anyone know how to achieve it? I am using WKHTMLTOPDF patch QT RC11
Thanks
There are at least two ways to solve your problem.
You can provide a --page-offset value with each page file object. For instance: wkhtmltopdf page --page-offset 1 section1.html page --page-offset 1 section2.html
You can calculate the number of pages in the current section by using the query string provided to the footer html script
Use [sitepage] and [sitepages], e.g.:
wkhtmltopdf.exe file:///C:/temp/html1.html --footer-right "Page [sitepage] of [sitepages]" file:///C:/temp/html2.html --footer-right "Page [sitepage] of [sitepages]" output.pdf

Displaying mixed content in a dynamically generated html page

I have two .png files that I would like to display along with some text in an html page that is being dynamically generated by Perl. In a perfect world this would be in a 3 column layout with the text in the first column and the two .png files in the second and third columns. The problem I keep coming across is the need for one of these tags:
print "Content-type: image/png\n\n";
print "Content-type: text/html\n\n";
I can only include one in the html and it means I can only display the text or the images but not both.
Obviously there must be a way to do this but so far Googling has gotten me nowhere.
Any advice is appreciated.
Regards.
Here are the print statements that I am using to generaate the dynamic html:
print "<html>";
print "<head>";
print "Content-type: text/html\n\n";
print "</head>";
print "<body>";
print "<table>";
print "<tr><td>Number of Sentences = $numSentences</td><td rowspan=\"4\"><img src=\"/home/kfarmer/public_html/kevin/charFreq.png\" /></td><td rowspan=\"4\"><img src=\"/home/kfarmer/public_html/kevin/charFreq.png\" /></td></tr>";
print "<tr><td>Number of Words = $numWords</td></tr>";
print "<tr><td>Number of Unique Words = $numUniqueWords</td></tr>";
print "<tr><td>Number of English Characters = $numEnglishCharacters</td></tr>";
print "</table></body></html>";
However, now when I generate this page I get a popup asking me how I would like to open the file -- and the file is just what I've printed above.
One HTTP response sends one thing, and each thing gets its own content header. You don’t need to include everything that will be in the page in one response.
From Perl, just link to the image files using the HTML features for that. In the HTML, you’d include:
<img src="url to PNG"/>
If there’s a CGI script serving up a dynamic image, you’d just link to it in the HTML:
<img src="/cgi-bin/imager.png?key=value;..."/>
That CGI script has to return the proper content type for what it’s sending back, whether HTML or image data.
The browser will interpret the HTML, see the links for the images, and make additional requests to get the images.
Your problem is more likely, that your images are absolute paths on the drive, rather than relative paths to the images on your websever.
I noticed that your img src is '/home/kfarmer/public_html/kevin/charFreq.png'
So, if your webserver's root is '/home/kfarmer/public_html/kevin' and that is what will load when you go to someurl.com, then your img src should just be '/charFreq.png'
If the root of your server is '/home/kfarmer/public_html' then your img src should be 'kevin/charFreq.png'
This is more complicated than that, as urls are relative to where the page is loaded from.
So, if the page is www.someurl.com/kevin/anotherfolder/mypage.html and you want to load an image in 'kevin/someotherplace/charFreq.png' then you need your img src to be either '/kevin/someotherplace/charFreq.png' OR '../someotherplace/charFreq.png'
I am afraid you are mixing up some definitions/technologies.
Context-type is part of the HTTP header. When your browser fetches a web page it normally uses HTTP, which consists of multiple header fields and a data block (for example containing the data which got requested). If you use a (decent) web-server you do not need to worry about HTTP headers (normally).
In order to show a 3 column page, with two (or any other number of) images and some text. You need to generate a HTML page. On this page you tell the browser that it should download the images and present them alongside the text.
In order to do, so you have to generate the HTML page in a pre-defined format containing so called elements:
<html>
<head><title>mypage</title></head>
<body>
This is the visible part of the page
</body>
</html>
Now in the body element, you can generate your text and images. The images can be placed onto the page using the img element.
Check out w3schools for more extensive tutorials on these subjects. If you gained some more basic knowledge, you can try to generate a HTML page using perl (or any other (scripting) language).

Printing landscape html->pdf using abcPDF

I am trying to get a PDF generated by abcPDF from html output to print the first three pages in portrait and then switch the fourth page to landscape.
I have been able to get the html to switch into landscape for the fourth page by applying this class to a div that is the 4th page:
.PageLandscape {
width="100%";
height="100%";
filter: progid:DXImageTransform.Microsoft.BasicImage(Rotation=3);
size:landscape;
}
When abcPDF converts the html to pdf though, the 4th page is still portait.
Any thoughts or hints?
thanks!
Not sure if you've found the answer, but here's how I did it. Found it from ABCpdf docs:
http://www.websupergoo.com/helppdf7net/source/4-examples/08-landscape.htm
I think you can apply the transformation per page. But because you set rotation on the document as a whole (when you save) not sure you can do it on a per page basis.
ABCpdf seems to sometimes ignore style-classes.
Maybe you could you try an inline style-element?