cfdocument ignoring the scale directive and autoscaling document - coldfusion

Environment : ColdFusion 10 on Windows 8.1 and ColdFusion 9 on Windows Server 2008 R2 Using standard versions of IIS.
I am using cfdocument to generate a standard format letter that has variable content.
In amongst the content is a table that has a fixed width (width::700px;) The document size is A4 with left and right margins of 1.7 cm
I have found that when executing the code on ColdFusion 9, when the width of the table (irrespective of table content) causes the edge of the table to impact the document margin, then cfdocument decides that it ought to auto-scale and it proceeds to reduce the font size of the whole document.
Which would be fine, except that the client insist that the document be produced using a font size of Arial 10 pt. We don't want autoscaling.
We found that reducing the width of the table did the trick, and stopped ColdFusion 9 from messing with the document scale. We had to have a good dose of imagination to accomplish this, because the issue did not appear even when we added a border to the table.
I note that we have set scale="100" set in the cfdocument directive, but in this case it seems to be ignored, and no error message of any sort.
Now, with ColdFusion 10, behaviour seems to be different.
Having reduced the size of the table as above, running the exact same code and the exact same data, I find that cfdocument has decided to up-size everything from 10pt to 12pt just because it feels like it.
The issue for us is that we are developing on PC that runs ColdFusion 10 to a server that runs ColdFusion 9.
So you can imagine that this means extra development/testing effort. It is real pain.
I can find no documentation from Adobe that mentions changes to the behaviour of cfdocument between
ColdFusion 9 and ColdFusion 10.
Is there any way to tell cfdocument to stop messing with the scale of the document and have it stick for ColdFusion 9, 10 (and 11) ?

Related

Coldfusion 2021 Update 5 breaks xml

I just applied update 5 and now I am getting XML errors:
"Error","ajp-nio-127.0.0.1-8020-exec-10","10/13/22","11:28:42","Medlists3","coldfusion.runtime.CFPage.XmlSearch(Lcoldfusion/xml/XmlNodeList;Ljava/lang/String;)Ljava/lang/Object;
https://helpx.adobe.com/coldfusion/kb/coldfusion-2021-update-5.html says
CHANGE IN XML
If the XML path contains a forward slash or backslash, it will be
blocked. The flag, coldfusion.xml.allowPathCharacters, must be set to
true to allow the same.
But I don't know where to make this change.
This question was asked on CFML Slack and it was said that you needed to manually clear all .class files from disk since the bytecode is not binary compatible.
A legacy Fusebox 5 coldfusion application got this exact error. Following up on gabriel's note: after deleting the contents of cfclasses, I had to restart the Coldfusion 2021 Application in services (Windows Server 2019) in order for the contents of cfclasses to refresh. After the restart, the application worked as normal.
Adobe added the following comment for the patch notes for CF2018 Update 15, but they said that this shouldn't be an issue in ColdFusion 2021-
https://helpx.adobe.com/coldfusion/kb/coldfusion-2018-update-15.html
--
Known issues in this release
If you encounter the following error message, clear the classes in <CF_HOME>/instance/wwwroot/WEB-INF/cfclasses.
"coldfusion.runtime.CFPage.XmlSearch(Lcoldfusion/xml/XmlNodeList;Ljava/lang/String;)Ljava/lang/Object; The specific sequence of files included or processed is: \<filepath>, line: 34 "
java.lang.NoSuchMethodError: coldfusion.runtime.CFPage.XmlSearch(Lcoldfusion/xml/XmlNodeList;Ljava/lang/String;)Ljava/lang/Object;
If the Uninstall button is disabled on Update 15, uninstall the
update using the uninstaller.jar present in the hf-updates folder.
your application uses the functions XmlSearch and XmlTransform,
you'll have to recompile the files after applying Update 15.
--
I added the variable "-Dcoldfusion.xml.allowPathCharacters=true" in Java JVM arguments and it worked.
In your Coldfusion Administrator, under Server Settings, Java and JVM, in the JVM Arguments box, append the following to the end (make sure there is a space after the last entry:
-Dcoldfusion.xml.allowPathCharacters=true
Then restart the CF Service.
Took care of the problem for us.

ColdFusion PDF to text using cfpdf - Formatting issue

We have a requirement to extract the content of an uploaded PDF and then show it in a text area with the same formatting. Our application runs on ColdFusion 10.
We used cfpdf however the extracted text is a single paragraph with No formatting.
Is there anyway in ColdFusion to read the PDF as text retaining the source formatting (100% accuracy is not expected) .
Note:
We tried itext and it works very well however it comes with a licensing cost which I don't want to spend as I'm only going to use this single feature from the bundle that itext is providing.
Tried PDFbox but the formatting is not retained.

Is it possible to use C++ CFX tags in Railo?

I recently had to move several older websites that were running in Coldfusion MX7 onto a server running Railo 4.2.1. These sites all use either CFX_Image or CFX_OpenImage tags for resizing uploaded images. It looks like I could rewrite them all to use CFIMAGE, but I'm hoping to get these older sites working as is, at least for know.
Does anyone know of a way to use the C++ CFX tags in Railo 4.2.1?
Railo 4.2 is supposed to be compatible with CF 10 but it doesn't support C++ tags. It's intended to be compatible as far as cfml syntax goes but
there are however a few things railo doesn't support, c++ cfx tags being one of them. It does support Java CFX tags. Read this
But you can always use cfimage tag to perform various image manipulation operations including image resizing. Like this
<cfimage
action = "resize"
height = "number of pixels|percent%"
source = "absolute pathname|pathname relative to the web root|URL|#cfimage variable#"
width = "number of pixels|percent%"
destination = "absolute pathname|pathname relative to the web root"
isBase64 = "yes|no"
name = "cfimage variable"
overwrite = "yes|no">

CFDocument PDFs are huge (ColdFusion 8)

I wanted to add a PDF generation button for articles. Everything is working well until I noticed that the file sizes are upwards of 4MB for a document with 200KB of JPG images and about 120KB of HTML. So, I tossed the CFDocument into the CFPDF tag which reduced it to 1.5MB. Better. Then I put it through Acrobat's web optimizer which took it down to 335KB. I cannot find an "optimizing" solution with either CFDocument or CFPDF. I was hoping for a quality setting or something. I should also note that CFDocument takes a while to process (relatively speaking). Since ColdFusion 9 added an optimize function, I'm guessing that I'm out of luck until this server is upgraded. True?
<cfdocument format="pdf"
localurl=true
name="loc.tempPDF">
<cfoutput>#loc.articleContent#</cfoutput>
</cfdocument>
<cfpdf action = "write"
destination = "#expandPath('\pdf\temp.pdf')#"
source = "loc.tempPDF"
overwrite = "yes"
saveOption = "linear" />
That's correct, there is currently no way to optimize PDFs in ColdFusion 8 with the native cfdocument or cfpdf tags. If you absolutely have to make this happen without upgrading to CF9 (which has much improved PDF compression), then you could look at the iText library for generating PDFs via Java.
I built a Document Management System using CF 6.1 a few years ago. I used GhostScript to create, concatenate and optimize PDFs.
Here's a blog post showing how you can use GS to optimize a PDF's size.

ColdFusion 8 Printing Issue

I've hit a weird snag developing a reports using ColdFuions 8. The report prints a number of large HTML tables and the customer wants them to be formated ins such a way that when they are printed out the user will get 2 of the tables per page.
So it wasn't hard to make a page break by using a
<p style="page-break-before: always"></p>
However, while I got the desired effect while using the development ColdFusion environment on my laptop, I get a diffent effect when printing reports generated on the test web server. There the reports print out with a much larger font so that the second table spills over onto a second page.
Has anyone else experienced this or has a recomendation for how to try and tackle it?
When a report needs to be printed, I would recommend using CFDOCUMENT to create a PDF. You get much more control over the final output including changing page orientation which is great for tables that are wide. It honors a lot of HTML and CSS including the page-break-before style so you shouldn't have to do to much conversion to use it outside of wrapping the report area with CFDOCUMENT tags. It has been available since CF7 so it should work for you on CF8.