This is an archived forum post. The information may be outdated. Contact us if you have any questions.

usePrintMedia Does not Seem to be Working

knguyen525 wrote on 2013-06-20:
So I set the method "usePrintMedia" to true. I am using inline css by the way. So when preview print the html, it looks fine and it's actually using the print media css. But when I render the html page with the method "convertURI", it does not seem to pickup the font size at all. It seems to max out at a certain font size and won't get any bigger. If I set the print css to 5px, I can see the font get smaller in the PDF generation but when I set it to 20px, it does not seem to work.

Here is my css

<style type="text/css">
h1
{
font-family:Cambria;
font-size:15px;
text-align:center;
}

td, span, ol, p, body
{
font-family: Times New Roman;
font-size:25px;
}


Here is my code for streaming the html to PDF

// create an API client instance
pdfcrowd.Client client = new pdfcrowd.Client("10minutewill", "xxxxxxx");

// convert a web page and write the generated PDF to a memory stream
MemoryStream Stream = new MemoryStream();
client.setHeaderFooterPageExcludeList("1,-1");
client.setPageNumberingOffset(1);
client.setHorizontalMargin("1in");
client.setVerticalMargin("1in");
client.usePrintMedia(true);
client.setFooterHtml("<br><div style='font-family:arial;font-size:12px;'/>" + TextUtil.getIndent(85) + "%p " + TextUtil.getIndent(60) + "______ (initials)</div>");
client.convertURI(SiteUtil.getSecureDomainUrl() + "/Will/FinalWillHtml.aspx?willid=" + willHeaderId + "&token=" + wtok.Token, Stream);
support wrote on 2013-06-20:
Hello,

It is hard to advise without seeing the complete HTML.
If you can post a sample URL that exhibits the problem we will take a look at it.
knguyen525 wrote on 2013-06-20:
Here is the link to our dev site for you to try out:

- Go to 10minutewill.servehttp.com and click "member login" on the top navigation.
- enter username "khanh9000" and password "3443"
- After you are take to the home page for the member, click the first image link "View COmpleted Orders"
- Click "view" link for order number: 100552
- There is 2 links at the bottom to demonstrate my problem. The first link "Download PDF" will render the HTML page below to PDF. The PDF body and header fonts are so small even though I have declared my CSS media to 17px for font size (when you print it, the font is so small). The second link "Debug: Download HTML Will" is the same HTML but not rendered to PDF. If you do a print preview on this page and print it, the font looks of the correct size.



The HTML is attached with the include CSS media type
knguyen525 wrote on 2013-06-20:
Sorry, the html inline css was missing the @media print section. I just added it and still did not help in increasing the font size on the PDF.

See attachment.
knguyen525 wrote on 2013-06-21:
Support,

Can you provide an ETA when this can be answered? I have a client who is really needing the font to be larger? The font on the PDF output is really small and is hard to read.
support wrote on 2013-06-21:
Technical details aside, the problem is caused by the placeholders for signatures and addresses as their width grows when the size of the font increases.

To see what I mean, add the following line to your code before convertURI() and you will notice that some placeholders exceed the right margin of the text body in the generated pdf.

client.setPdfScalingFactor(300);


The solution is to make the placeholder width smaller and constant, independent on the used font size.

Hope this helps.
knguyen525 wrote on 2013-06-21:
Can you explain what you mean by "The solution is to make the placeholder width smaller and constant, independent on the used font size. ". Can you provide what I have now and what to replace that with to increase the font size.
knguyen525 wrote on 2013-06-21:
Support,

Forget my last question. I figured what you meant by that.