Why is my PDF footer text invisible? - pdf

I'm creating PDFs on-demand with ColdFusion's CFDocument tag, like so:
<cfdocument format="PDF" filename="#attributes.fileName#" overwrite="true">
<cfdocumentitem type="footer">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left"><font face="Tahoma" color="black"><strong>My Client's Corporation</strong><br/>Street address<br/>City, ST 55555</font></td>
<td align="right"><font face="Tahoma" color="black">Phone: 555.555.5555<br/>Fax: 555.555.5555<br/>Email: info#domain.com</font></td>
</tr>
</table>
</cfdocumentitem>
<html>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<!--- some content here ... --->
</table>
</body>
</html>
</cfdocument>
The problem I'm having is that sometimes (actually, most of the time, but not always) some of the footer text is there, but invisible. I can highlight it and copy/paste it into notepad, where I can see it all -- but in the generated PDF only the first line of the left column of the footer is visible, the rest is invisible. Hence why I added the font color of black in the code.
Any ideas on how to correct this?

A PDF is what I'm after, so I'm not sure how outputting another format would help.
As it turns out, the footer space just wasn't enough to fit all of this text; verified by the fact that changing the font size to 4pt would fit it all in without a problem.
I spent some time attempting to rewrite the footer code using DDX as outlined here and the CFPDF tag to implement it; but even after several hours of hacking away and finally getting a valid DDX as reported by the new isDDX function, the CFPDF tag reported that it was invalid DDX for some reason.
At this point I decided I had wasted enough of the client's time/money and just reformatted the footer to be 2 lines of centered text, which was good enough.

Usually when PDF shows blank text, it's because the font metrics are embedded in the document, but the glyphs are not. I know nothing about ColdFusion, but you might try the following:
Try a font other than Tahoma as a test. All PDF readers must support 14 basic fonts, including 4 Helvetica variants, 4 Times variants, 4 Courier variants, Symbol and ZapfDingbats, so those are always safe choices
See if ColdFusion offers any control over font embedding
Try a list of alternatives in your font declaration, like "Tahoma,Helvetica,sans-serif"

Related

Can visualforce's RenderAs PDF include href links?

We're using SalesForce's renderAs="PDF" option, and we want a clickable link in the body of the generated PDF. Is this possible?
I have tried an ... and I've tried <apex:outputlink value="...">...</apex:outputlink>, both result in a non clickable rendered version.
Has anyone found a way that works in salesforce's engine?
<apex:page standardController="Opportunity" showHeader="false" renderas="pdf">
<apex:outputLink value="https://google.com">https://google.com</apex:outputLink>
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">
<tr>
<td>
...
Update:
This is browser dependent. Firefox doesn't let you click the link, Google Chrome does.
What type of link are you trying to render in the PDF, a relative link? Using outputlink I have previously had the same behaviour but only for relative links.
Using a full URL should render the hyperlink.

html to pdf ASP.NET.Core 1.1 image not showing after conversion

I am using this open source library for html to pdf. Everything is working, but when it comes to adding a <img src> tag, it is not showing the image I want in PDF. For example,
string image = "~/images/test.png";
string htmlToConvert = string.Format(#"
<div>
<table>
<tr>
<td>
<img srcset='{0}'>
</td>
</tr>
</table>
</div>", image);
Is there anything wrong with my format or is it simply just not supporting images? If it is true, any working library for asp.net core 1.1? (important because some libraries/suggestions were based on 1.0 which contained project.json file)
p.s. I am going to deploy it via Azure web app service
The image must be in the same folder as where the phantomjs executabels are.
Just take a look at method
PdfGenerator.WriteHtmlToTempFile
There you can see that your html is stored into a file in the phantomjs-installation directory. And this is the root of your html-file, which means that the images must be there too.
https://github.com/TheSalarKhan/PhantomJs.NetCore/blob/master/PdfGenerator.cs.
I suggest that you use the phantomjs-executabels directly to better understand what is going on.

missing background in outlook

Hi I'm making a christmas card with HTML I must use background image in order to avoid spam. However my background image does not appear in Outlook. Can you please fix this? P.S. I don`t know a thing about html I learn everything right now.
</table>
<table width="706" height="462" border="7"; bordercolor="#c89c53" align="center">
<tr>
<td background="http://ch-eu.com/dev/files/32.jpg" bgcolor="#7bceeb" width="636" height="92" valign="top">
</table>

cfchart not printing in PDF

I'm trying to print PDF from HTML using cfdocument. The code works fine when I access it through localhost, but when I use static IP to test it online on the same server it timeouts.
I tried cfhtmltopdf it didn't timeouts but it doesn't generate the chart and shows "image missing icon". nor charts get generated nor images. text gets printed fine. And it takes like 20 to 30 seconds to generated the PDF when an image or chart is used.
I tried this on CF11 32bit and 6bit both having same issue.
Even the simplest codes fails:
<cfhtmltopdf>
<!DOCTYPE html>
<html>
<body>
<div class="pdf_logo" style="margin-bottom: 20px;">
<img src="images/logo.png" width="180">
</div>
</body>
</html>
</cfhtmltopdf>
Your problem is probably with resolution of the path to the image. try an absolute path (http://) Or a file path (file:\) ... try resolving the image from the desktop of the server itself.
Remember that the server internally must resolve your images/logo.png into something like . If (for example) your pdf generating cfm is in a folder that is not the root, the server may resolve it to http://blah.com/some folder/images/logo.png - which naturally won't work because there's no "images" folder in there.
Other possibilities? Your server can't resolve an "internal" natted address, or is trying to use an external non-natted address through the firewall interface.
Fortunately almost all these problems can be easily tested or resolved. You will also save yourself headaches by simply using the file method to include any resources into your PDF file.
For more on resolution issues see my post on Network address resolution and Cfdocument.
Hope this helps! good luck.
I've encountered a similar issue with cfhtmltopdf. In my case, I was using a cfimage tag, and the images were being rendered in the PDF document very sporadically.
I suspect that the rendering of the cfhtmltopdf tag happens asynchronously, in a separate thread from any rendering that may happen inside that tag (for example, cfimage or cfchart). So the cfhtmltopdf tag will finish rendering, and it won't have the results from the rendering of cfimage or cfchart, so it displays the "broken image" icon because it can't find the source.
So this solution based on ColdFusion documentation† might help you:
<!--- 1. Generate the chart as a jpeg image. --->
<cfchart name="myChart" format="jpg">
<cfchartseries type="pie">
<cfchartdata item="New Vehicle Sales" value=500000>
<cfchartdata item="Used Vehicle Sales" value=250000>
<cfchartdata item="Leasing" value=300000>
<cfchartdata item="Service" value=400000>
</cfchartseries>
</cfchart>
<!--- 2. Write the jpeg image to a temporary directory. --->
<cffile
action="write"
file="#ExpandPath('/charts/vehicle.jpg')#"
output="#myChart#" />
<!--- 3. Generate the PDF file. --->
<cfhtmltopdf>
<!DOCTYPE html>
<cfoutput>
<html>
<body>
<div class="chart">
<!--- This image tag refers to the file created by cffile --->
<img src="/charts/vehicle.jpg" />
</div>
</body>
</html>
</cfoutput>
</cfhtmltopdf>
† Based on the example here: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7934.html

Tagged PDF using an HTML to PDF Converter such as Winnovative

There are many converter available on the market to create and manipulate PDF file from a simple HTML/CSS page. These tools are very convenient to create quickly some nice PDF files without the hassle of the more complex reporting tools of this world.
I am using Winnovative software to achieve this goal but I was wondering how to create accessible file (tagged PDF) to improve text-to-speach tool processing.
Are there any HTML tags that exists to achieve this? Anybody has some experience with this kind of requirements?
The tool itself has to be able to support the pdf/ua spec (tagged pdf). The list of possible PDF tags corresponds nicely to html tags. For example, there are <h1> through <h6> tags, table tags (<table>, <th>, <tr>, <td>), list tags (<l>, <li>), and so on.
There are minor differences, such as the tag to start a list is <l> instead of html's <ul> or <ol>. With a PDF document, the screen reader will say "list with 3 items" and then you navigate through each item. It doesn't seem to care if it's bulleted or numbered, thus the reason pdf/ua has <l> and html has <ol> and <ul>.
Anyway, the point is you don't need to use any special html tags to generate tagged pdf. The tool that generates the pdf just needs to support pdf/ua. I didn't see anything on Winnovative's website that indicated it support it.
FYI, here are the tags available in PDF/UA
<Art>
<Annot>
<BibEntry>
<BlockQuote>
<Caption>
<Code>
<Div>
<Document>
<Figure>
<Form>
<Formula>
<H>
<H1>
<H2>
<H3>
<H4>
<H5>
<H6>
<Index>
<Lbl>
<Link>
<L>
<LI>
<Lbody>
<Note>
<P>
<Part>
<Quote>
<Reference>
<Sect>
<Span>
<Table>
<TD>
<TH>
<TOC>
<TOCI>
<TR>
Essential PDF supports generating tagged PDF when converting from HTML to PDF using the Internet Explorer MSHTML engine.
Note: I work for Syncfusion.
Good explanation in slugolicious' answer about tagging PDF. While researching accessible PDF output for a project I found PDFReactor (www.pdfreactor.com) can do this. Unfortunately there's no budget for a license in this project right now, so I haven't tested it in production, but have tried the free personal version with satisfying results.