Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
PDF::FromHTML(3)      User Contributed Perl Documentation     PDF::FromHTML(3)

NAME
       PDF::FromHTML - Convert HTML documents to PDF

SYNOPSIS
	   my $pdf = PDF::FromHTML->new( encoding => 'utf-8' );

	   # Loading from a file:
	   $pdf->load_file('source.html');

	   # Or	from a scalar reference:
	   # $pdf->load_file(\$input);

	   # Perform the actual	conversion:
	   $pdf->convert(
	       # With PDF::API2, font names such as 'traditional' also works
	       Font	   => 'font.ttf',
	       LineHeight  => 10,
	       Landscape   => 1,
	   );

	   # Write to a	file:
	   $pdf->write_file('target.pdf');

	   # Or	to a scalar reference:
	   # $pdf->write_file(\$output);

DESCRIPTION
       This module transforms HTML into	PDF, using an assortment of XML
       transformations implemented in PDF::FromHTML::Twig.

       There is	also a command-line utility, html2pdf.pl, that comes with this
       distribution.

PUBLIC METHODS
   convert(%params)
       Convert the loaded file to PDF.	Valid parameters are:

	   PageWidth	     640
	   PageResolution    540
	   FontBold	     'HelveticaBold'
	   FontOblique	     'HelveticaOblique'
	   FontBoldOblique   'HelveticaBoldOblique'
	   LineHeight	     12
	   FontUnicode	     'Helvetica'
	   Font		     (same as FontUnicode)
	   PageSize	     'A4'
	   Landscape	     0

HINTS &	TIPS
   <img> tags
       Add the height and width	attributes if you are creating the source
       HTML, it	keeps PDF::FromHTML from having	to open	and read the source
       image file to get the real size.	 Less file I/O means faster
       processing.

CAVEATS
       Although	PDF::FromHTML will work	with both HTML and XHTML formats, it
       is not designed to utilise CSS.

       This means any HTML using external or inline CSS	for design and layout,
       including but not limited to: images, backgrounds, colours, fonts
       etc... will not be converted into the PDF.

       To get an idea of the likely resulting PDF, you may wish	to use an non-
       CSS capable browser for testing first.

       There is	currently no plan to adapt this	module to utilise CSS.
       (Patches	welcome, though!)

SEE ALSO
       html2pdf.pl is a	simple command-line interface to this module.

       PDF::FromHTML::Twig, PDF::Template, XML::Twig.

CONTRIBUTORS
       Charleston Software Associates <info@charletonsw.com>

AUTHORS
       Audrey Tang <cpan@audreyt.org>

CC0 1.0	Universal
       To the extent possible under law, ae^3^3	has waived all copyright and
       related or neighboring rights to	PDF-FromHTML.

       This work is published from Taiwan.

       <http://creativecommons.org/publicdomain/zero/1.0>

POD ERRORS
       Hey! The	above document had some	coding errors, which are explained
       below:

       Around line 255:
	   Non-ASCII character seen before =encoding in	'ae^3^3'. Assuming
	   UTF-8

perl v5.32.1			  2019-10-23		      PDF::FromHTML(3)

NAME | SYNOPSIS | DESCRIPTION | PUBLIC METHODS | HINTS & TIPS | CAVEATS | SEE ALSO | CONTRIBUTORS | AUTHORS | CC0 1.0 Universal | POD ERRORS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=PDF::FromHTML&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help