Note that there are some explanatory texts on larger screens.

plurals
  1. POShrink HTML page and convert to A4 size pdf
    primarykey
    data
    text
    <p>Converting html page to pdf. When i convert the page to pdf, <strong>html page content is not fit in A4 page. I want whole html page to be converted as pdf without any content missing.</strong></p> <p>I am already having code that converts html to pdf</p> <pre><code> String tempOutFileNameXHTML = "/Users/Common/index" + i + DOT + "xhtml"; String tempOutFileNamePDF = "/Users/Common/index" + i + DOT + PDF; File targetFile = targetFiles.get(i); // gets all the specified html files CleanerProperties props = new CleanerProperties(); props.setTranslateSpecialEntities(true); props.setTransResCharsToNCR(true); props.setOmitComments(true); //checking of starting and ending tags are in proper HtmlCleaner htmlCleaner = new HtmlCleaner(props); TagNode tagNode = htmlCleaner.clean(targetFile); PrettyXmlSerializer prettyXmlSerializer = new PrettyXmlSerializer(props); prettyXmlSerializer.writeToFile(tagNode, tempOutFileNameXHTML, "utf-8"); File xhtmlpath = new File(tempOutFileNameXHTML); File pdfPath = new File(tempOutFileNamePDF); com.itextpdf.text.Document pdfDocument = null; PdfWriter pdfWriter = null; pdfDocument = new com.itextpdf.text.Document(com.itextpdf.text.PageSize.A4); // TODO handle this pdfWriter = PdfWriter.getInstance(pdfDocument, new FileOutputStream(pdfPath)); pdfDocument.open(); Font catFont = new Font(Font.FontFamily.TIMES_ROMAN, 25, Font.BOLD); pdfDocument.add(new Paragraph("Target : " + targetFile.getParentFile().getName(), catFont)); XMLWorkerHelper.getInstance().parseXHtml(pdfWriter, (com.itextpdf.text.Document) pdfDocument, new FileInputStream(xhtmlpath), null); pdfDocument.close(); </code></pre> <p><strong>The issue here is when the html page width is too long, it is not fit in A4 size pdf.</strong> Is there anyway to shrink or to make it as pdf without any content lose. ? How can i do that ? Html page can be shrinked and converted to pdf ? Any idea on how to do this ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload